//
// X509_VERIFY_PARAM_add1_host from 0xdee800 to 0xdee958 (344 bytes)
//
// 2 xrefs:
// > SSL_add1_host @ 0xd3ea88
// > ??> @ 0x95628
//
// 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 X509_VERIFY_PARAM_add1_host(__int64 a1, char *a2, unsigned __int64 a3)
{
_BOOL4 v3; // w21
__int64 v6; // x19
size_t v7; // x2
size_t v9; // x0
int *v10; // x19
__int64 v11; // x0
_BYTE *v12; // x20
int *v13; // x0
v3 = a2 == nullptr;
v6 = a3;
if ( !a2 || !a3 )
{
if ( !a2 )
goto LABEL_9;
v9 = strlen(a2);
v6 = v9;
if ( !v9 )
goto LABEL_9;
v11 = v9 - 1;
if ( a2[v11] )
{
LABEL_12:
if ( !v6 || v3 )
goto LABEL_9;
goto LABEL_14;
}
LABEL_20:
v6 = v11;
goto LABEL_12;
}
if ( a3 <= 1 )
v7 = 1;
else
v7 = a3 - 1;
if ( memchr(a2, 0, v7) )
return 0;
v11 = v6 - 1;
if ( !a2[v6 - 1] )
goto LABEL_20;
LABEL_14:
v12 = CRYPTO_strndup(a2, v6, (__int64)"crypto/x509/x509_vpm.c", 0x3Cu);
if ( !v12 )
return 0;
v10 = *(int **)(a1 + 56);
if ( !v10 )
{
v13 = (int *)OPENSSL_sk_new_null();
*(_QWORD *)(a1 + 56) = v13;
v10 = v13;
if ( !v13 )
{
CRYPTO_free(v12, (__int64)"crypto/x509/x509_vpm.c", 66);
return (unsigned int)v10;
}
}
if ( !(unsigned int)OPENSSL_sk_push(v10, (__int64)v12) )
{
CRYPTO_free(v12, (__int64)"crypto/x509/x509_vpm.c", 71);
LODWORD(v10) = OPENSSL_sk_num(*(unsigned int **)(a1 + 56));
if ( !(_DWORD)v10 )
{
OPENSSL_sk_free(*(void ***)(a1 + 56));
*(_QWORD *)(a1 + 56) = 0;
return (unsigned int)v10;
}
return 0;
}
LABEL_9:
LODWORD(v10) = 1;
return (unsigned int)v10;
}