View Single Post
Old 02-14-2007, 10:10 AM   #12
doctorow
Guru
doctorow ought to be getting tired of karma fortunes by now.doctorow ought to be getting tired of karma fortunes by now.doctorow ought to be getting tired of karma fortunes by now.doctorow ought to be getting tired of karma fortunes by now.doctorow ought to be getting tired of karma fortunes by now.doctorow ought to be getting tired of karma fortunes by now.doctorow ought to be getting tired of karma fortunes by now.doctorow ought to be getting tired of karma fortunes by now.doctorow ought to be getting tired of karma fortunes by now.doctorow ought to be getting tired of karma fortunes by now.doctorow ought to be getting tired of karma fortunes by now.
 
doctorow's Avatar
 
Posts: 914
Karma: 3410461
Join Date: May 2004
Device: Kindle Touch
They use a combination of a SHA-1 hash and a RSA keypair.

The actual check_signature function:
Code:
.text:0000AAE0 check_signature                         ; CODE XREF: USB_UpdateCreatePartitionWithImage+2D0p
.text:0000AAE0
.text:0000AAE0 var_D4          = -0xD4
.text:0000AAE0 var_D0          = -0xD0
.text:0000AAE0 var_CC          = -0xCC
.text:0000AAE0 var_C8          = -0xC8
.text:0000AAE0 var_C4          = -0xC4
.text:0000AAE0 var_C0          = -0xC0
.text:0000AAE0 var_BC          = -0xBC
.text:0000AAE0 var_3C          = -0x3C
.text:0000AAE0
.text:0000AAE0                 STMFD   SP!, {R4-R8,LR}
.text:0000AAE4                 MOV     R2, #0xC0       ; size_t
.text:0000AAE8                 SUB     SP, SP, #0xBC
.text:0000AAEC                 MOV     R5, R0
.text:0000AAF0                 MOV     R6, R1
.text:0000AAF4                 LDR     R0, =ltc_mp     ; void *
.text:0000AAF8                 LDR     R1, =ltm_desc   ; void *
.text:0000AAFC                 BL      _memcpy
.text:0000AB00                 LDR     R0, =sha1_desc
.text:0000AB04                 BL      register_hash
.text:0000AB08                 CMN     R0, #1
.text:0000AB0C                 MOVEQ   R12, R0
.text:0000AB10                 BEQ     loc_AB54
.text:0000AB14                 LDR     R0, =aSha1
.text:0000AB18                 BL      find_hash
.text:0000AB1C                 CMN     R0, #1
.text:0000AB20                 MOV     R4, R0
.text:0000AB24                 MOVEQ   R12, R0
.text:0000AB28                 BEQ     loc_AB54
.text:0000AB2C                 ADD     R7, SP, #0xD4+var_BC
.text:0000AB30                 MOV     R1, R5
.text:0000AB34                 ADD     R3, SP, #0xD4+var_C0
.text:0000AB38                 MOV     R5, #0x80
.text:0000AB3C                 MOV     R2, R7
.text:0000AB40                 STR     R5, [SP,#0xD4+var_C0]
.text:0000AB44                 BL      hash_file       ; ### SHA-1 ###
.text:0000AB48                 CMP     R0, #0
.text:0000AB4C                 BEQ     SHA_OK
.text:0000AB50
.text:0000AB50 CHECK_BAD                               ; CODE XREF: check_signature+9Cj
.text:0000AB50                                         ; check_signature+CCj
.text:0000AB50                 MVN     R12, #0
.text:0000AB54
.text:0000AB54 loc_AB54                                ; CODE XREF: check_signature+30j
.text:0000AB54                                         ; check_signature+48j
.text:0000AB54                                         ; check_signature+E0j
.text:0000AB54                 MOV     R0, R12
.text:0000AB58                 ADD     SP, SP, #0xBC
.text:0000AB5C                 LDMFD   SP!, {R4-R8,PC}
.text:0000AB60 ; ---------------------------------------------------------------------------
.text:0000AB60
.text:0000AB60 SHA_OK                                  ; CODE XREF: check_signature+6Cj
.text:0000AB60                 ADD     R8, SP, #0xD4+var_3C
.text:0000AB64                 LDR     R0, =sigKeyPub
.text:0000AB68                 MOV     R1, #0xA2
.text:0000AB6C                 MOV     R2, R8
.text:0000AB70                 BL      rsa_import
.text:0000AB74                 CMP     R0, #0
.text:0000AB78                 MOV     R12, R0
.text:0000AB7C                 BNE     CHECK_BAD
.text:0000AB80                 STR     R12, [SP,#0xD4+var_D0]
.text:0000AB84                 MOV     R0, R6
.text:0000AB88                 ADD     R12, SP, #0xD4+var_C4
.text:0000AB8C                 MOV     R1, R5
.text:0000AB90                 MOV     R2, R7
.text:0000AB94                 LDR     R3, [SP,#0xD4+var_C0]
.text:0000AB98                 STR     R4, [SP,#0xD4+var_D4]
.text:0000AB9C                 STR     R12, [SP,#0xD4+var_CC]
.text:0000ABA0                 STR     R8, [SP,#0xD4+var_C8]
.text:0000ABA4                 BL      rsa_verify_hash ; ### RSA ###
.text:0000ABA8                 CMP     R0, #0
.text:0000ABAC                 BNE     CHECK_BAD
.text:0000ABB0                 LDR     R3, [SP,#0xD4+var_C4]
.text:0000ABB4                 CMP     R3, #0
.text:0000ABB8                 MOVNE   R12, #0
.text:0000ABBC                 MOVLEQ  R12, 0xFFFFFFFF
.text:0000ABC0                 B       loc_AB54
.text:0000ABC0 ; End of function check_signature
.text:0000ABC0
.text:0000ABC0 ; ---------------------------------------------------------------------------
.text:0000ABC4 ; void *off_ABC4
.text:0000ABC4 off_ABC4        DCD ltc_mp              ; DATA XREF: check_signature+14r
.text:0000ABC8 ; void *off_ABC8
.text:0000ABC8 off_ABC8        DCD ltm_desc            ; DATA XREF: check_signature+18r
.text:0000ABCC off_ABCC        DCD sha1_desc           ; DATA XREF: check_signature+20r
.text:0000ABD0 off_ABD0        DCD aSha1               ; DATA XREF: check_signature+34r
.text:0000ABD0                                         ; "sha1"
.text:0000ABD4 off_ABD4        DCD sigKeyPub           ; DATA XREF: check_signature+84r
doctorow is offline   Reply With Quote