// // ec_GF2m_simple_point2oct from 0x8890b4 to 0x889438 (900 bytes) // // 2 xrefs: // > EC_POINT_point2oct @ 0x7ed3a4 // > @ 0x61bfc // // 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 ec_GF2m_simple_point2oct(int a1, _DWORD *a2, int a3, _BYTE *a4, unsigned int a5, int ***a6) { _BOOL4 v6; // r6 void **v9; // r11 int degree; // r0 int v15; // r8 unsigned int v16; // r8 unsigned int v17; // r10 int v18; // r0 int v19; // r6 size_t v20; // r6 int v21; // r6 unsigned int v22; // r7 int ***v23; // r0 int v24; // r0 int v25; // r4 size_t v26; // r4 int **v27; // [sp+Ch] [bp-10h] int **v28; // [sp+10h] [bp-Ch] int **v29; // [sp+14h] [bp-8h] v6 = a3 != 4; if ( (a3 & 0xFFFFFFFB) != 2 && a3 != 4 ) { ERR_put_error(16, 161, 104, (int)"crypto/ec/ec2_oct.c", 140); LABEL_6: v9 = nullptr; LABEL_7: BN_CTX_free(v9); return 0; } if ( !EC_POINT_is_at_infinity(a1, a2) ) { degree = EC_GROUP_get_degree(a1); v15 = degree + 7; if ( degree + 7 < 0 ) v15 = degree + 14; v16 = v15 >> 3; if ( a3 == 2 ) v17 = v16 + 1; else v17 = 2 * v16; if ( a3 != 2 ) ++v17; if ( a4 ) { if ( v17 > a5 ) { ERR_put_error(16, 161, 100, (int)"crypto/ec/ec2_oct.c", 165); goto LABEL_6; } if ( a6 ) { v9 = nullptr; } else { v23 = (int ***)BN_CTX_new(); a6 = v23; if ( !v23 ) return 0; v9 = (void **)v23; } BN_CTX_start((int)a6); v27 = BN_CTX_get(a6); v28 = BN_CTX_get(a6); v29 = BN_CTX_get(a6); if ( !v29 || !EC_POINT_get_affine_coordinates_GF2m(a1, a2) ) { LABEL_37: BN_CTX_end(a6); goto LABEL_7; } *a4 = a3; if ( v6 && !BN_is_zero((int)v27) ) { if ( !(*(int (__fastcall **)(int, int **, int **, int **, int ***))(*(_DWORD *)a1 + 144))(a1, v29, v28, v27, a6) ) goto LABEL_37; if ( BN_is_odd((int)v29) ) ++*a4; } v18 = BN_num_bits(v27); v19 = v18 + 7; if ( v18 + 7 < 0 ) v19 = v18 + 14; v20 = v16 - (v19 >> 3); if ( v16 < v20 ) { ERR_put_error(16, 161, 68, (int)"crypto/ec/ec2_oct.c", 198); goto LABEL_37; } if ( v20 ) { memset(a4 + 1, 0, v20); v21 = v20 + 1; } else { v21 = 1; } v22 = v16 + 1; if ( v16 + 1 != BN_bn2bin(v27, &a4[v21]) + v21 ) { ERR_put_error(16, 161, 68, (int)"crypto/ec/ec2_oct.c", 208); goto LABEL_37; } if ( (a3 & 0xFFFFFFFD) == 4 ) { v24 = BN_num_bits(v28); v25 = v24 + 7; if ( v24 + 7 < 0 ) v25 = v24 + 14; v26 = v16 - (v25 >> 3); if ( v16 < v26 ) { ERR_put_error(16, 161, 68, (int)"crypto/ec/ec2_oct.c", 216); goto LABEL_37; } if ( v26 ) { memset(&a4[v22], 0, v26); v22 += v26; } v22 += BN_bn2bin(v28, &a4[v22]); } if ( v22 != v17 ) { ERR_put_error(16, 161, 68, (int)"crypto/ec/ec2_oct.c", 228); goto LABEL_37; } BN_CTX_end(a6); } else { v9 = nullptr; } BN_CTX_free(v9); return v17; } if ( !a4 ) return 1; if ( a5 ) { *a4 = 0; return 1; } else { ERR_put_error(16, 161, 100, (int)"crypto/ec/ec2_oct.c", 148); return 0; } }
GD Web Decomp Icon

GD Web Decomp

Raw Source