//
// X509_STORE_add_cert from 0x83ffd8 to 0x8400cc (244 bytes)
//
// 6 xrefs:
// > ssl_build_cert_chain @ 0x79269c
// > ssl_build_cert_chain @ 0x7926e8
// > X509_load_cert_file @ 0x83cbac
// > X509_load_cert_file @ 0x83cc54
// > X509_load_cert_crl_file @ 0x83cefc
// > ??> @ 0x5b4dc
//
// 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 X509_STORE_add_cert(int a1, int a2)
{
int *v4; // r0
int *v5; // r7
int v7; // r4
int v8; // r6
if ( !a2 )
return 0;
v4 = X509_OBJECT_new();
v5 = v4;
if ( !v4 )
return 0;
v7 = 1;
*v4 = 1;
v4[1] = a2;
X509_OBJECT_up_ref_count(v4);
CRYPTO_THREAD_write_lock(*(pthread_rwlock_t **)(a1 + 72));
if ( X509_OBJECT_retrieve_match(*(_DWORD **)(a1 + 4), v5) )
{
ERR_put_error(11, 124, 101, (int)"crypto/x509/x509_lu.c", 326);
v8 = 1;
CRYPTO_THREAD_unlock(*(pthread_rwlock_t **)(a1 + 72));
}
else
{
v8 = OPENSSL_sk_push(*(int **)(a1 + 4), (int)v5);
CRYPTO_THREAD_unlock(*(pthread_rwlock_t **)(a1 + 72));
if ( v8 )
goto LABEL_7;
}
X509_OBJECT_free(v5);
v7 = 0;
LABEL_7:
if ( !v8 )
ERR_put_error(11, 124, 65, (int)"crypto/x509/x509_lu.c", 338);
return v7;
}