// // BN_generate_dsa_nonce from 0xa85bf0 to 0xa85de0 (496 bytes) // // 3 xrefs: // > sub_9F74B8 @ 0x9f75c4 // > ossl_ecdsa_sign_sig @ 0xa02d88 // > @ 0x7a9fc // // This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False! // // Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings // Generated at Fri, 27 Nov 2026 12:08:52 +0000 // bool __fastcall BN_generate_dsa_nonce(int *a1, int *a2, int a3, char *a4, size_t a5, int ***a6) { int v8; // r0 int v9; // r5 char *v10; // r5 _BYTE *v11; // r9 unsigned int v12; // r6 size_t v13; // r11 bool v14; // cc _BOOL4 v15; // r4 int v19; // [sp+1Ch] [bp-1C0h] BYREF char v20[64]; // [sp+20h] [bp-1BCh] BYREF _BYTE v21[64]; // [sp+60h] [bp-17Ch] BYREF char v22[96]; // [sp+A0h] [bp-13Ch] BYREF int v23[55]; // [sp+100h] [bp-DCh] BYREF v8 = BN_num_bits(a2); v9 = v8 + 7; if ( v8 + 7 < 0 ) v9 = v8 + 14; v10 = (char *)((v9 >> 3) + 8); v11 = CRYPTO_malloc(v10, (int)"crypto/bn/bn_rand.c", 213); if ( v11 ) { v12 = 4 * *(_DWORD *)(a3 + 4); if ( v12 > 0x60 ) { ERR_put_error(3, 140, 117, (int)"crypto/bn/bn_rand.c", 225); v15 = 0; goto LABEL_14; } memcpy(v22, *(const void **)a3, 4 * *(_DWORD *)(a3 + 4)); memset(&v22[v12], 0, 96 - v12); v19 = 0; if ( v10 ) { while ( RAND_bytes((int)v20, 64) == 1 ) { SHA512_Init((int)v23); SHA512_Update((int)v23, (char *)&v19, 4u); SHA512_Update((int)v23, v22, 0x60u); SHA512_Update((int)v23, a4, a5); SHA512_Update((int)v23, v20, 0x40u); SHA512_Final(v21, v23); if ( (unsigned int)&v10[-v19] >= 0x40 ) v13 = 64; else v13 = (size_t)&v10[-v19]; memcpy(&v11[v19], v21, v13); v14 = (unsigned int)v10 > v13 + v19; v19 += v13; if ( !v14 ) goto LABEL_16; } } else { LABEL_16: if ( BN_bin2bn(v11, (int)v10, a1) ) { v15 = BN_div(nullptr, (int)a1, a1, a2, a6) == 1; goto LABEL_14; } } } v15 = 0; LABEL_14: CRYPTO_free(v11, (int)"crypto/bn/bn_rand.c", 255); OPENSSL_cleanse(v22, 0x60u); return v15; }
GD Web Decomp Icon

GD Web Decomp

Raw Source