//
// OPENSSL_hexstr2buf from 0x81aec8 to 0x81b010 (328 bytes)
//
// 7 xrefs:
// > EVP_PKEY_CTX_hex2ctrl @ 0x807724
// > sub_82F944 @ 0x82fa0c
// > sub_853810 @ 0x8538c8
// > sub_858480 @ 0x8586ac
// > s2i_ASN1_OCTET_STRING @ 0x85b4e8
// > sub_864F7C @ 0x8657a4
// > ??> @ 0x63c9c
//
// 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
//
unsigned int __fastcall OPENSSL_hexstr2buf(const char *a1, _DWORD *a2)
{
const char *v3; // r4
size_t v4; // r0
_BYTE *v5; // r0
unsigned int v6; // r7
_BYTE *v7; // r9
int v8; // r6
int v9; // r6
int v10; // r0
const char *v11; // r3
const char *v12; // r4
int v13; // r5
int v14; // t1
unsigned int result; // r0
v3 = a1;
v4 = strlen(a1);
v5 = CRYPTO_malloc((void *)(v4 >> 1), (int)"crypto/o_str.c", 159);
v6 = (unsigned int)v5;
if ( v5 )
{
v7 = v5;
while ( 2 )
{
v11 = v3;
do
{
v12 = v11;
v14 = *(unsigned __int8 *)v11++;
v13 = v14;
if ( !v14 )
{
if ( a2 )
v7 -= v6;
result = v6;
if ( a2 )
*a2 = v7;
return result;
}
}
while ( v13 == 58 );
v8 = *((unsigned __int8 *)v12 + 1);
v3 = v12 + 2;
if ( v8 )
{
v9 = OPENSSL_hexchar2int(v8);
v10 = OPENSSL_hexchar2int(v13);
if ( (v10 | v9) >= 0 )
{
*v7++ = v9 | (16 * v10);
continue;
}
CRYPTO_free((void *)v6, (int)"crypto/o_str.c", 177);
ERR_put_error(15, 118, 102, (int)"crypto/o_str.c", 178);
return 0;
}
else
{
ERR_put_error(15, 118, 103, (int)"crypto/o_str.c", 170);
CRYPTO_free((void *)v6, (int)"crypto/o_str.c", 171);
return 0;
}
}
}
else
{
ERR_put_error(15, 118, 65, (int)"crypto/o_str.c", 160);
return 0;
}
}