// // BN_generate_dsa_nonce from 0xe1a638 to 0xe1a860 (552 bytes) // // 3 xrefs: // > sub_D8A128 @ 0xd8a220 // > ossl_ecdsa_sign_sig @ 0xd94ca8 // > @ 0xc3a38 // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // bool __fastcall BN_generate_dsa_nonce(__int64 a1, __int64 a2, __int64 a3, char *a4, size_t a5, int32x2_t *a6) { int v12; // w0 int v13; // w1 int v14; // w0 unsigned __int64 v15; // x22 _BYTE *v16; // x25 unsigned int v17; // w0 __int64 v18; // x19 unsigned int v19; // w19 _BOOL4 v20; // w19 unsigned int v22; // [xsp+84h] [xbp+84h] BYREF char v23[64]; // [xsp+88h] [xbp+88h] BYREF _BYTE v24[64]; // [xsp+C8h] [xbp+C8h] BYREF char v25[96]; // [xsp+108h] [xbp+108h] BYREF __int64 v26[27]; // [xsp+168h] [xbp+168h] BYREF v12 = BN_num_bits(a2); v13 = v12 + 14; v14 = v12 + 7; if ( v14 < 0 ) v14 = v13; v15 = (unsigned int)((v14 >> 3) + 8); v16 = CRYPTO_malloc((void *)v15, (__int64)"crypto/bn/bn_rand.c", 213); if ( v16 ) { v17 = 8 * *(_DWORD *)(a3 + 8); if ( v17 > 0x60 ) { v20 = 0; ERR_put_error(3, 140, 117, (__int64)"crypto/bn/bn_rand.c", 225); goto LABEL_13; } v18 = v17; memcpy(v25, *(const void **)a3, v17); memset(&v25[v18], 0, 96 - v18); v22 = 0; if ( (_DWORD)v15 ) { while ( (unsigned int)RAND_bytes((__int64)v23, 64) == 1 ) { SHA512_Init((__int64)v26); SHA512_Update((__int64)v26, (char *)&v22, 4u); SHA512_Update((__int64)v26, v25, 0x60u); SHA512_Update((__int64)v26, a4, a5); SHA512_Update((__int64)v26, v23, 0x40u); SHA512_Final(v24, v26); if ( (unsigned int)v15 - v22 > 0x40 ) v19 = 64; else v19 = v15 - v22; memcpy(&v16[v22], v24, v19); v22 += v19; if ( (unsigned int)v15 <= v22 ) goto LABEL_15; } } else { LABEL_15: if ( BN_bin2bn(v16, v15, a1) ) { v20 = BN_div(0, a1, a1, a2, a6); goto LABEL_13; } } } v20 = 0; LABEL_13: CRYPTO_free(v16, (__int64)"crypto/bn/bn_rand.c", 255); OPENSSL_cleanse(v25, 0x60u); return v20; }