//
// SSL_set_SSL_CTX from 0x7997e0 to 0x7998b0 (208 bytes)
//
// 1 xrefs:
// > ??> @ 0x5c1dc
//
// 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 SSL_set_SSL_CTX(int *a1, int *a2)
{
int *result; // r0
int *v4; // r5
_DWORD *v5; // r6
size_t v6; // r2
int v7; // r1
result = (int *)a1[69];
v4 = a2;
if ( result != a2 )
{
if ( !a2 )
v4 = (int *)a1[111];
v5 = ssl_cert_dup(v4[44]);
if ( v5 )
{
ssl_cert_free(a1[50]);
v6 = a1[51];
a1[50] = (int)v5;
if ( v6 > 0x20 )
OPENSSL_die("assertion failed: ssl->sid_ctx_length <= sizeof(ssl->sid_ctx)", "ssl/ssl_lib.c", 3395);
v7 = a1[69];
if ( v7 && v6 == *(_DWORD *)(v7 + 196) && !memcmp(a1 + 52, (const void *)(v7 + 200), v6) )
{
a1[51] = v4[49];
memcpy(a1 + 52, v4 + 50, 0x20u);
}
SSL_CTX_up_ref((int)v4);
SSL_CTX_free(a1[69]);
a1[69] = (int)v4;
return v4;
}
else
{
return nullptr;
}
}
return result;
}