Hi,
@Basano, excellent work indeed.
I am working on similar task, to find the seed-key algorithm of a ME9.6 hybrid ECU used in saab/opel.
This is what I found so far:
Luckily we have a complete BDM dump of a ME9.6, and 5F BD 5D BD actually is present in the binary.
Further more its refered to from this code, that looks a lot as a seed+key algorithm to me.
ROM:00015A20 # =============== S U B R O U T I N E =======================================
ROM:00015A20
ROM:00015A20
ROM:00015A20 sub_15A20: # CODE XREF: sub_15A68+44p
ROM:00015A20 cmpwi %r3, 5 # Compare Word Immediate
ROM:00015A24 bne loc_15A34 # Branch if not equal
ROM:00015A28 lis %r12, dword_5F80@h # Load Immediate Shifted
ROM:00015A2C lwz %r3, dword_5F80@l(%r12) # Load Word and Zero
ROM:00015A30 b loc_15A44 # Branch
ROM:00015A34 # ---------------------------------------------------------------------------
ROM:00015A34
ROM:00015A34 loc_15A34: # CODE XREF: sub_15A20+4j
ROM:00015A34 lis %r12, dword_5F84@h # Load Immediate Shifted
ROM:00015A38 addi %r12, %r12, dword_5F84@l # Add Immediate
ROM:00015A3C slwi %r11, %r3, 2 # Shift Left Immediate
ROM:00015A40 lwzx %r3, %r12, %r11 # Load Word and Zero Indexed
ROM:00015A44
ROM:00015A44 loc_15A44: # CODE XREF: sub_15A20+10j
ROM:00015A44 cmpwi %r3, 0 # Compare Word Immediate
ROM:00015A48 beq loc_15A60 # Branch if equal
ROM:00015A4C not. %r12, %r3 # Complement Register
ROM:00015A50 beq loc_15A60 # Branch if equal
ROM:00015A54 add %r12, %r4, %r4 # Add
ROM:00015A58 xor %r3, %r3, %r12 # XOR
ROM:00015A5C blr # Branch unconditionally
ROM:00015A60 # ---------------------------------------------------------------------------
ROM:00015A60
ROM:00015A60 loc_15A60: # CODE XREF: sub_15A20+28j
ROM:00015A60 # sub_15A20+30j
ROM:00015A60 li %r3, 0 # Load Immediate
ROM:00015A64 blr # Branch unconditionally
ROM:00015A64 # End of function sub_15A20
ROM:00005F80 dword_5F80: .long 0x52A48911 # DATA XREF: sub_15A20+8o
ROM:00005F80 # sub_15A20+Cr ...
ROM:00005F84 dword_5F84: .long 0x75775EB5, 0x5AEDFED5, 0x6B5F7DD5, 0x6F757B6B, 0x5FBD5DBD, 0x11111111
From the lookup table above:
0x0A221289,0x144890A1,0x24212491,0x290A0285,0x42145091,0x504822C1,0x0A24C4C1,0x14252229,
0x24250525,0x2510A491,0x28488863,0x29148885,0x422184A5,0x49128521,0x50844A85,0x620CC211,
0x124452A9,0x18932251,0x2424A459,0x29149521,0x42352621,0x4A512289,
0x52A48911,0x11891475,
0x22346523,0x4A3118D1,0x64497111,0x0AE34529,0x15398989,0x22324A67,0x2D12B489,0x132A4A75,
0x19B13469,0x25D2C453,0x4949349B,0x524E9259,0x1964CA6B,0x24F5249B,0x28979175,0x352A5959,
0x3A391749,0x51D44EA9,0x564A4F25,0x6AD52649,0x76493925,0x25DE52C9,0x332E9333,0x68D64997,
0x494947FB,0x33749ACF,0x5AD55B5D,0x7F272A4F,0x35BD5B75,0x3F5AD55D,0x5B5B6DAD,0x6B5DAD6B,
0x75B57AD5,0x5DBAD56F,0x6DBF6AAD,
0x75775EB5,0x5AEDFED5,0x6B5F7DD5,0x6F757B6B,0x5FBD5DBD Whats the probability of finding those 1+5 dwords from a seed+key lookup table in a ME9.6 binary and that is NOT the seed+key algorithm?
I looked also in the attached MED9.1 binary that you posted in this thread and the subroutine is exactly the same, even at the same address.
The first seed variable seems to be different for your MED9.1 binary, but still part of the same lookup table:
ROM:00005F80 dword_5F80: .long 0x4A3118D1 # DATA XREF: sub_15A20+8o
ROM:00005F80 # sub_15A20+Cr ...
ROM:00005F84 dword_5F84: .long 0x75775EB5, 0x5AEDFED5, 0x6B5F7DD5, 0x6F757B6B, 0x5FBD5DBD, 0xFFFFFFFF
/Mattias Claesson