Official Name: SigModR
Other Name: Rabin
BCALL Address: 80A2
Squares a large integer modulo n.
- OP1-OP6 hold the plaintext, a big integer
- All registers
- 8100h: 130-byte area which the multiplication routine uses to store its result
- 8182h: 65-byte area used as the first argument to the multiplication routine
- 81C3h: 65-byte area used as the second argument to the multiplication routine
This BCALL takes a large integer pointed to by HL and squares it modulo n. The OS uses this to decrypt the Rabin encrypted MD5 hash of an app.
B_CALL SetupAppPubKey ;loads the modulus into 8000h ld de,tempSwapArea push de ld hl,myInt ld bc,myIntEnd-myInt ldir ;copy large int to RAM pop hl ;address of large int to square B_CALL SigModR ;square it ;8100h should now contain the number 3412h^2 mod the 0104 key. ;Since the n of the public key is significantly larger, the answer is simply ;3412h^2. So the contents of memory after this BCALL are ;8100h: 04 44 51 97 0A ;(the integer A975144h) myInt: db 2,12h,34h myIntEnd: