// // ecdh_simple_compute_key from 0x7ed628 to 0x7ed9a0 (888 bytes) // // 5 xrefs: // > @ 0x61c3c // > @ 0xab2760 // > @ 0xab2824 // > @ 0xab28e8 // > @ 0xab502c // // 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 // int __fastcall ecdh_simple_compute_key(int ***a1, unsigned int *a2, int a3, int a4) { int v7; // r0 int v8; // r4 int **v9; // r8 int **v10; // r5 int *v11; // r7 _DWORD *v12; // r6 int v13; // r0 int degree; // r0 int v15; // r9 int v16; // r0 unsigned int v17; // r9 int v18; // r3 int v19; // r7 int v20; // r7 int **v22; // r0 v7 = BN_CTX_new(); v8 = v7; if ( !v7 ) { EC_POINT_free(0); v10 = nullptr; v20 = 0; goto LABEL_17; } BN_CTX_start(v7); v9 = (int **)BN_CTX_get(v8); BN_CTX_get(v8); v10 = (int **)EC_KEY_get0_private_key(a4); if ( v10 ) { v11 = (int *)EC_KEY_get0_group(a4); if ( (EC_KEY_get_flags(a4) & 0x1000) == 0 || EC_GROUP_get_cofactor((int)v11, (int)v9) && BN_mul(v9, v9, v10, v8) ) { v12 = EC_POINT_new(v11); if ( v12 ) { if ( EC_POINT_mul((int)v11) ) { v13 = EC_GROUP_method_of((int)v11); if ( EC_METHOD_get_field_type(v13) == 406 ) { if ( EC_POINT_get_affine_coordinates_GFp((int)v11, v12) ) goto LABEL_8; v10 = nullptr; ERR_put_error(16, 257, 155, "crypto/ec/ecdh_ossl.c", 100); v20 = 0; } else { if ( EC_POINT_get_affine_coordinates_GF2m((int)v11, v12) ) { LABEL_8: degree = EC_GROUP_get_degree((int)v11); v15 = degree + 7; if ( degree + 7 < 0 ) v15 = degree + 14; v16 = BN_num_bits(v9); v17 = v15 >> 3; v18 = v16 + 7; if ( v16 + 7 < 0 ) v18 = v16 + 14; v19 = v18 >> 3; if ( v17 >= v18 >> 3 ) { v22 = (int **)CRYPTO_malloc(v17, "crypto/ec/ecdh_ossl.c", 119); v10 = v22; if ( v22 ) { memset(v22, 0, v17 - v19); if ( BN_bn2bin(v9, (_BYTE *)v10 + v17 - v19) == v19 ) { *a1 = v10; v20 = 1; *a2 = v17; v10 = nullptr; } else { ERR_put_error(16, 257, 3, "crypto/ec/ecdh_ossl.c", 126); v20 = 0; } } else { ERR_put_error(16, 257, 65, "crypto/ec/ecdh_ossl.c", 120); v20 = 0; } } else { v10 = nullptr; ERR_put_error(16, 257, 68, "crypto/ec/ecdh_ossl.c", 116); v20 = 0; } goto LABEL_16; } v10 = nullptr; ERR_put_error(16, 257, 155, "crypto/ec/ecdh_ossl.c", 107); v20 = 0; } } else { v10 = nullptr; ERR_put_error(16, 257, 155, "crypto/ec/ecdh_ossl.c", 93); v20 = 0; } } else { ERR_put_error(16, 257, 65, "crypto/ec/ecdh_ossl.c", 88); v10 = nullptr; v20 = 0; } } else { ERR_put_error(16, 257, 65, "crypto/ec/ecdh_ossl.c", 81); v10 = nullptr; v20 = 0; v12 = nullptr; } } else { ERR_put_error(16, 257, 154, "crypto/ec/ecdh_ossl.c", 72); v20 = 0; v12 = nullptr; } LABEL_16: EC_POINT_free((int)v12); BN_CTX_end(v8); LABEL_17: BN_CTX_free(v8); CRYPTO_free(v10, "crypto/ec/ecdh_ossl.c", 141); return v20; }
GD Web Decomp Icon

GD Web Decomp

Raw Source