//
// OPENSSL_hexstr2buf from 0x103e994 to 0x103eb20 (396 bytes)
//
// 7 xrefs:
// > EVP_PKEY_CTX_hex2ctrl @ 0x102c920
// > sub_1054098 @ 0x1054160
// > X509v3_asid_validate_resource_set @ 0x1078d88
// > sub_107D408 @ 0x107d5e4
// > s2i_ASN1_OCTET_STRING @ 0x108008c
// > sub_108B494 @ 0x108bc54
// > ??> @ 0x52288
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:16:28 +0000
//
void *__fastcall OPENSSL_hexstr2buf(const char *a1, _QWORD *a2)
{
const char *v3; // x19
size_t v4; // x0
void *v5; // x0
void *v6; // x23
_BYTE *v7; // x22
int v8; // w20
unsigned __int8 *v9; // x2
unsigned __int8 *v10; // x4
bool v11; // zf
int v12; // w2
int v13; // w21
int v14; // w0
void *result; // x0
v3 = a1;
v4 = strlen(a1);
v5 = CRYPTO_malloc((void *)(v4 >> 1), (__int64)"crypto/o_str.c", 159);
v6 = v5;
if ( v5 )
{
v7 = v5;
LABEL_3:
v8 = *(unsigned __int8 *)v3;
v9 = (unsigned __int8 *)(v3 + 1);
v10 = (unsigned __int8 *)(v3 + 2);
v11 = v8 == 58;
if ( *v3 )
{
while ( 1 )
{
if ( v11 )
{
v3 = (const char *)v9;
goto LABEL_3;
}
v12 = *((unsigned __int8 *)v3 + 1);
v3 = (const char *)v10;
if ( !v12 )
{
ERR_put_error(15, 118, 103, (__int64)"crypto/o_str.c", 170);
CRYPTO_free(v6, (__int64)"crypto/o_str.c", 171);
return nullptr;
}
v13 = OPENSSL_hexchar2int(v12);
v14 = OPENSSL_hexchar2int(v8);
if ( v14 < 0 || v13 < 0 )
break;
*v7++ = v13 | (16 * v14);
v10 = (unsigned __int8 *)(v3 + 2);
v9 = (unsigned __int8 *)(v3 + 1);
v8 = *(unsigned __int8 *)v3;
v11 = v8 == 58;
if ( !*v3 )
goto LABEL_9;
}
CRYPTO_free(v6, (__int64)"crypto/o_str.c", 177);
ERR_put_error(15, 118, 102, (__int64)"crypto/o_str.c", 178);
return nullptr;
}
else
{
LABEL_9:
if ( a2 )
{
result = v6;
*a2 = v7 - (_BYTE *)v6;
}
else
{
return v6;
}
}
}
else
{
ERR_put_error(15, 118, 65, (__int64)"crypto/o_str.c", 160);
return nullptr;
}
return result;
}