// // ossl_ecdsa_sign_setup from 0xa02648 to 0xa02b48 (1280 bytes) // // 2 xrefs: // > @ 0x7b43c // > @ 0xd16d6c // // 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:07:39 +0000 // int __fastcall ossl_ecdsa_sign_setup(int a1, int a2, _BYTE **a3, _BYTE **a4) { int *v6; // r9 int v7; // r7 _DWORD *v8; // r4 _BYTE *v9; // r8 int v10; // r0 bool v11; // zf int v12; // r3 int **v13; // r10 _DWORD *v14; // r11 _DWORD *v15; // r5 int v16; // r5 int v18; // r0 int v19; // r0 int mont_data; // r0 int v23; // [sp+14h] [bp-8h] if ( a1 && (v6 = (int *)EC_KEY_get0_group(a1)) != nullptr ) { if ( EC_KEY_can_sign(a1) ) { if ( a2 ) { v7 = a2; } else { v18 = BN_CTX_new(); v7 = v18; if ( !v18 ) { v16 = 0; ERR_put_error(16, 248, 65, "crypto/ec/ecdsa_ossl.c", 57); return v16; } } v8 = (_DWORD *)BN_new(); v9 = (_BYTE *)BN_new(); v10 = BN_new(); v11 = v8 == nullptr; if ( v8 ) v11 = v9 == nullptr; v12 = v11; if ( !v10 ) v12 |= 1u; v13 = (int **)v10; if ( v12 ) { ERR_put_error(16, 248, 65, "crypto/ec/ecdsa_ossl.c", 67); v14 = nullptr; } else { v14 = EC_POINT_new(v6); if ( v14 ) { v15 = (_DWORD *)EC_GROUP_get0_order((int)v6); if ( v15 ) { do { do { if ( !BN_rand_range(v8, v15) ) { ERR_put_error(16, 248, 158, "crypto/ec/ecdsa_ossl.c", 94); goto LABEL_22; } } while ( BN_is_zero((int)v8) ); if ( !BN_add(v8, v8, v15) ) goto LABEL_22; v23 = BN_num_bits(v8); if ( v23 <= BN_num_bits(v15) && !BN_add(v8, v8, v15) ) goto LABEL_22; if ( !EC_POINT_mul((int)v6) ) { ERR_put_error(16, 248, 16, "crypto/ec/ecdsa_ossl.c", 113); goto LABEL_22; } v19 = EC_GROUP_method_of((int)v6); if ( EC_METHOD_get_field_type(v19) == 406 ) { if ( !EC_POINT_get_affine_coordinates_GFp((int)v6, v14) ) { ERR_put_error(16, 248, 16, "crypto/ec/ecdsa_ossl.c", 120); goto LABEL_22; } } else if ( !EC_POINT_get_affine_coordinates_GF2m((int)v6, v14) ) { ERR_put_error(16, 248, 16, "crypto/ec/ecdsa_ossl.c", 130); goto LABEL_22; } if ( !BN_nnmod(v9, v13, v15, v7, v7, v7) ) { ERR_put_error(16, 248, 3, "crypto/ec/ecdsa_ossl.c", 136); goto LABEL_22; } } while ( BN_is_zero((int)v9) ); if ( EC_GROUP_get_mont_data((int)v6) ) { if ( !BN_set_word(v13, 2) ) { ERR_put_error(16, 248, 3, "crypto/ec/ecdsa_ossl.c", 149); goto LABEL_22; } if ( !BN_mod_sub(v13, v15, v13, v15, v7) ) { ERR_put_error(16, 248, 3, "crypto/ec/ecdsa_ossl.c", 153); goto LABEL_22; } BN_set_flags((int)v13, 4); mont_data = EC_GROUP_get_mont_data((int)v6); if ( !BN_mod_exp_mont_consttime(v8, v8, v13, v15, v7, mont_data) ) { ERR_put_error(16, 248, 3, "crypto/ec/ecdsa_ossl.c", 159); goto LABEL_22; } } else if ( !BN_mod_inverse(v8, v8, v15, v7) ) { ERR_put_error(16, 248, 3, "crypto/ec/ecdsa_ossl.c", 164); goto LABEL_22; } v16 = 1; BN_clear_free(*a4); BN_clear_free(*a3); *a4 = v9; *a3 = v8; goto LABEL_23; } ERR_put_error(16, 248, 16, "crypto/ec/ecdsa_ossl.c", 76); } else { ERR_put_error(16, 248, 16, "crypto/ec/ecdsa_ossl.c", 71); } } LABEL_22: BN_clear_free(v8); BN_clear_free(v9); v16 = 0; LABEL_23: if ( a2 != v7 ) BN_CTX_free(v7); EC_POINT_free((int)v14); BN_clear_free(v13); return v16; } ERR_put_error(16, 248, 159, "crypto/ec/ecdsa_ossl.c", 51); return 0; } else { ERR_put_error(16, 248, 67, "crypto/ec/ecdsa_ossl.c", 46); return 0; } }
GD Web Decomp Icon

GD Web Decomp

Raw Source