// // bn_compute_wNAF from 0x10972e0 to 0x1097608 (808 bytes) // // 3 xrefs: // > ec_wNAF_mul @ 0x1010f1c // > ec_wNAF_mul @ 0x10112bc // > @ 0xf7858 // // This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True! // // 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 13:17:24 +0000 // char *__fastcall bn_compute_wNAF(__int64 a1, int a2, unsigned __int64 *a3) { int v6; // w27 int v7; // w20 char v8; // w25 int v9; // w19 unsigned __int64 v10; // x24 char *v11; // x21 unsigned __int64 v12; // x28 unsigned __int64 v13; // x26 int v14; // w3 char v15; // w4 int v16; // w4 char *result; // x0 if ( !BN_is_zero(a1) ) { if ( (unsigned int)(a2 - 1) > 6 ) { v11 = nullptr; ERR_put_error(3, 142, 68, (__int64)"crypto/bn/bn_intern.c", 43); goto LABEL_27; } v6 = 1 << a2; v7 = 2 * (1 << a2); if ( BN_is_negative(a1) ) v8 = -1; else v8 = 1; v9 = v7 - 1; if ( !*(_QWORD *)a1 || !*(_DWORD *)(a1 + 8) ) { v11 = nullptr; ERR_put_error(3, 142, 68, (__int64)"crypto/bn/bn_intern.c", 55); goto LABEL_27; } v10 = (int)BN_num_bits(a1); v11 = (char *)CRYPTO_malloc((void *)(v10 + 1), (__int64)"crypto/bn/bn_intern.c", 60); if ( !v11 ) { ERR_put_error(3, 142, 65, (__int64)"crypto/bn/bn_intern.c", 66); goto LABEL_27; } v12 = 0; v13 = a2 + 1LL; v14 = v9 & **(_QWORD **)a1; while ( !v14 ) { if ( v10 <= v13 ) { if ( v10 + 1 >= v12 ) { *a3 = v12; return v11; } ERR_put_error(3, 142, 68, (__int64)"crypto/bn/bn_intern.c", 130); LABEL_27: CRYPTO_free(v11, (__int64)"crypto/bn/bn_intern.c", 137); return nullptr; } v15 = 0; LABEL_13: ++v12; ++v13; v11[v12 - 1] = v15; v14 = (v14 >> 1) + BN_is_bit_set(a1, a2 + (int)v12) * v6; if ( v7 < v14 ) { ERR_put_error(3, 142, 68, (__int64)"crypto/bn/bn_intern.c", 124); goto LABEL_27; } } v15 = v14 & 1; if ( (v14 & 1) == 0 ) goto LABEL_13; if ( (v14 & v6) != 0 ) { v16 = v14 - v7; if ( v10 <= v13 ) { v16 = v14 & (v9 >> 1); LABEL_19: if ( v6 <= v16 || (v16 & 1) == 0 ) { LABEL_26: ERR_put_error(3, 142, 68, (__int64)"crypto/bn/bn_intern.c", 101); goto LABEL_27; } v14 -= v16; if ( v14 != v7 && v14 != 0 && v6 != v14 ) { ERR_put_error(3, 142, 68, (__int64)"crypto/bn/bn_intern.c", 113); goto LABEL_27; } v15 = v8 * v16; goto LABEL_13; } } else { v16 = v14; } if ( v16 <= -v6 ) goto LABEL_26; goto LABEL_19; } result = (char *)CRYPTO_malloc((char *)dword_0 + 1, (__int64)"crypto/bn/bn_intern.c", 31); v11 = result; if ( !result ) { ERR_put_error(3, 142, 65, (__int64)"crypto/bn/bn_intern.c", 33); goto LABEL_27; } *result = 0; *a3 = 1; return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source