// // ecdh_simple_compute_key from 0xd94204 to 0xd9456c (872 bytes) // // 5 xrefs: // > @ 0x77cb8 // > @ 0x1222270 // > @ 0x12223f0 // > @ 0x1222570 // > @ 0x12272b0 // // 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 // __int64 __fastcall ecdh_simple_compute_key(_QWORD *a1, _QWORD *a2, __int64 a3, __int64 a4) { __int64 v7; // x0 __int64 v8; // x19 unsigned __int64 *v9; // x24 _QWORD **v10; // x20 __int64 *v11; // x23 _QWORD *v12; // x22 __int64 v13; // x0 int degree; // w0 bool v15; // nf int v16; // w1 int v17; // w0 int v18; // w25 int v19; // w0 int v20; // w1 unsigned __int64 v21; // x23 unsigned int v22; // w23 _QWORD **v24; // x0 v7 = BN_CTX_new(a1, a2, a3); v8 = v7; if ( !v7 ) { EC_POINT_free(0); v10 = nullptr; v22 = 0; goto LABEL_17; } BN_CTX_start(v7); v9 = (unsigned __int64 *)BN_CTX_get(v8); BN_CTX_get(v8); v10 = (_QWORD **)EC_KEY_get0_private_key(a4); if ( v10 ) { v11 = (__int64 *)EC_KEY_get0_group(a4); if ( (EC_KEY_get_flags(a4) & 0x1000) == 0 || EC_GROUP_get_cofactor((__int64)v11, v9) && (unsigned int)BN_mul((__int64)v9, (_QWORD **)v9, v10, v8) ) { v12 = EC_POINT_new(v11); if ( v12 ) { if ( (unsigned int)EC_POINT_mul((__int64)v11) ) { v13 = EC_GROUP_method_of((__int64)v11); if ( (unsigned int)EC_METHOD_get_field_type(v13) == 406 ) { if ( (unsigned int)EC_POINT_get_affine_coordinates_GFp((__int64)v11, v12) ) goto LABEL_8; v10 = nullptr; ERR_put_error(16, 257, 155, "crypto/ec/ecdh_ossl.c", 100); v22 = 0; } else { if ( (unsigned int)EC_POINT_get_affine_coordinates_GF2m((__int64)v11, v12) ) { LABEL_8: degree = EC_GROUP_get_degree((__int64)v11); v16 = degree + 7; v15 = degree + 7 < 0; v17 = degree + 14; if ( v15 ) v16 = v17; v18 = v16 >> 3; v19 = BN_num_bits((__int64)v9); v20 = v19 + 14; if ( v19 + 7 >= 0 ) v20 = v19 + 7; v21 = v20 >> 3; if ( v18 >= v21 ) { v24 = (_QWORD **)CRYPTO_malloc(v18, "crypto/ec/ecdh_ossl.c", 119); v10 = v24; if ( v24 ) { memset(v24, 0, v18 - v21); if ( v21 == (int)BN_bn2bin(v9, (_BYTE *)v10 + v18 - v21) ) { *a1 = v10; v22 = 1; *a2 = v18; v10 = nullptr; } else { v22 = 0; ERR_put_error(16, 257, 3, "crypto/ec/ecdh_ossl.c", 126); } } else { v22 = 0; ERR_put_error(16, 257, 65, "crypto/ec/ecdh_ossl.c", 120); } } else { v10 = nullptr; v22 = 0; ERR_put_error(16, 257, 68, "crypto/ec/ecdh_ossl.c", 116); } goto LABEL_16; } v10 = nullptr; ERR_put_error(16, 257, 155, "crypto/ec/ecdh_ossl.c", 107); v22 = 0; } } else { v10 = nullptr; ERR_put_error(16, 257, 155, "crypto/ec/ecdh_ossl.c", 93); v22 = 0; } } else { v10 = nullptr; v22 = 0; ERR_put_error(16, 257, 65, "crypto/ec/ecdh_ossl.c", 88); } } else { v10 = nullptr; v22 = 0; v12 = nullptr; ERR_put_error(16, 257, 65, "crypto/ec/ecdh_ossl.c", 81); } } else { v22 = 0; v12 = nullptr; ERR_put_error(16, 257, 154, "crypto/ec/ecdh_ossl.c", 72); } LABEL_16: EC_POINT_free((__int64)v12); BN_CTX_end(v8); LABEL_17: BN_CTX_free(v8); CRYPTO_free(v10, "crypto/ec/ecdh_ossl.c", 141); return v22; }
GD Web Decomp Icon

GD Web Decomp

Raw Source