Thread: GMP function
View Single Post
  #1  
Old 06-15-2011, 22:56
Git's Avatar
Git Git is offline
Old Git
 
Join Date: Mar 2002
Location: Torino
Posts: 1,116
Rept. Given: 220
Rept. Rcvd 265 Times in 157 Posts
Thanks Given: 110
Thanks Rcvd at 220 Times in 126 Posts
Git Reputation: 200-299 Git Reputation: 200-299 Git Reputation: 200-299
GMP function

Anybody familiar enough with GMP (Gnu MP big number library) to identify this function?. None of the gmp sigs I have tried recognise any of the library functions but I am certain it is GMP or a derivative. I may have misidentified the 16byte struct type that the parameter points to.


Code:
.text:10001000 ; void __cdecl SUB01(mpf_ptr x)
.text:10001000 SUB01           proc near 
.text:10001000
.text:10001000 x               = dword ptr  4
.text:10001000
.text:10001000                 mov     ecx, [esp+x]
.text:10001004                 mov     edx, [ecx+mpf_struct._mp_size]
.text:10001007                 mov     eax, [ecx+mpf_struct._mp_prec]
.text:10001009                 push    esi
.text:1000100A                 mov     esi, edx        ; esi = x->_mp_size
.text:1000100C                 ror     esi, 5          ; esi = ROR(x->_mp_size, 5)
.text:1000100F                 sub     eax, esi        ; eax = x->_mp_prec - ROR(x->_mp_size, 5)
.text:10001011                 mov     esi, [ecx+mpf_struct._mp_exp] ; esi = x->_mp_exp
.text:10001014                 push    edi
.text:10001015                 mov     edi, esi        ; edi = x->_mp_exp
.text:10001017                 ror     edi, 0Fh        ; edi = ROR(x->_mp_exp, 15)
.text:1000101A                 xor     edi, edx        ; edi = ROR(x->_mp_exp, 15) ^ x->_mp_size
.text:1000101C                 mov     edx, [ecx+mpf_struct._mp_d] ; edx = x->_mp_d
.text:1000101F                 add     esi, edx        ; esi = x->_mp_exp + x->_mp_d
.text:10001021                 add     edx, eax        ; edx = x->_mp_d + x->_mp_prec - ROR(x->_mp_size, 5)
.text:10001023                 mov     [ecx+mpf_struct._mp_exp], edx ; x->_mp_exp = x->_mp_d + x->_mp_prec - ROR(x->_mp_size, 5)
.text:10001026                 mov     edx, edi        ; edx = ROR(x->_mp_exp, 15) ^ x->_mp_size
.text:10001028                 mov     [ecx+mpf_struct._mp_prec], edi ; x->_mp_prec = ROR(x->_mp_exp, 15) ^ x->_mp_size
.text:1000102A                 add     eax, edx        ; eax = x->_mp_prec - ROR(x->_mp_size, 5) + ROR(x->_mp_exp, 15) ^ x->_mp_size
.text:1000102C                 pop     edi
.text:1000102D                 mov     [ecx+mpf_struct._mp_size], esi ; x->_mp_size = x->_mp_exp + x->_mp_d
.text:10001030                 mov     [ecx+mpf_struct._mp_d], eax ; x->_mp_d = x->_mp_prec - ROR(x->_mp_size, 5) + ROR(x->_mp_exp, 15) ^ x->_mp_size
.text:10001033                 pop     esi
.text:10001034                 retn
.text:10001034 SUB01           endp
.text:10001034

void __cdecl SUB01(mpf_ptr x)
{
   x->_mp_exp = x->_mp_d + x->_mp_prec - ROR(x->_mp_size, 5)
   x->_mp_prec = ROR(x->_mp_exp, 15) ^ x->_mp_size
   x->_mp_size = x->_mp_exp + x->_mp_d
   x->_mp_d = x->_mp_prec - ROR(x->_mp_size, 5) + ROR(x->_mp_exp, 15) ^ x->_mp_size    // can simplify
   return
}
Reply With Quote