//
// BIO_dup_chain from 0xd77028 to 0xd77128 (256 bytes)
//
// 1 xrefs:
// > ??> @ 0x75b88
//
// 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 BIO_dup_chain(__int64 result)
{
__int64 v1; // x20
__int64 v2; // x21
__int64 v3; // x22
__int64 v4; // x19
__int64 v5; // x9
__int64 v6; // x8
int v7; // w7
int v8; // w6
int v9; // w5
v1 = result;
if ( result )
{
v2 = 0;
v3 = 0;
while ( 1 )
{
v4 = BIO_new(*(_QWORD *)v1);
if ( !v4 )
break;
v5 = *(_QWORD *)(v1 + 8);
v6 = *(_QWORD *)(v1 + 16);
v7 = *(_DWORD *)(v1 + 24);
v8 = *(_DWORD *)(v1 + 28);
v9 = *(_DWORD *)(v1 + 32);
*(_DWORD *)(v4 + 40) = *(_DWORD *)(v1 + 40);
*(_QWORD *)(v4 + 8) = v5;
*(_QWORD *)(v4 + 16) = v6;
*(_DWORD *)(v4 + 24) = v7;
*(_DWORD *)(v4 + 28) = v8;
*(_DWORD *)(v4 + 32) = v9;
if ( !BIO_ctrl(v1, 0xCu, 0, v4) || !(unsigned int)CRYPTO_dup_ex_data(12, v4 + 96, v1 + 96) )
{
BIO_free((_QWORD *)v4);
break;
}
if ( v3 )
{
BIO_push(v2, v4);
v1 = *(_QWORD *)(v1 + 56);
v2 = v4;
if ( !v1 )
return v3;
}
else
{
v1 = *(_QWORD *)(v1 + 56);
v3 = v4;
v2 = v4;
if ( !v1 )
return v3;
}
}
BIO_free_all(v3);
return 0;
}
return result;
}