//
// X509_to_X509_REQ from 0xe6efb8 to 0xe6f0b8 (256 bytes)
//
// 1 xrefs:
// > ??> @ 0xaaa00
//
// 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_to_X509_REQ(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v6; // x0
__int64 v7; // x19
__int64 v8; // x20
void *v9; // x0
__int64 v10; // x1
_BYTE *v11; // x3
__int64 subject_name; // x0
__int64 v13; // x1
__int64 result; // x0
v6 = X509_REQ_new();
v7 = v6;
if ( !v6 )
{
ERR_put_error(11, 126, 65, (__int64)"crypto/x509/x509_req.c", 31);
goto LABEL_11;
}
v8 = *(_QWORD *)(v6 + 24);
*(_DWORD *)v8 = 1;
v9 = CRYPTO_malloc((char *)dword_0 + 1, (__int64)"crypto/x509/x509_req.c", 38);
v10 = *(_QWORD *)(v7 + 24);
*(_QWORD *)(v8 + 8) = v9;
v11 = *(_BYTE **)(v10 + 8);
if ( !v11 )
goto LABEL_11;
*v11 = 0;
subject_name = X509_get_subject_name(a1);
if ( !(unsigned int)X509_REQ_set_subject_name(v7, subject_name) )
goto LABEL_11;
v13 = X509_get0_pubkey(a1);
if ( !v13 || !(unsigned int)X509_REQ_set_pubkey(v7, v13) )
goto LABEL_11;
result = v7;
if ( !a2 )
return result;
if ( !(unsigned int)X509_REQ_sign(v7, a2, a3) )
{
LABEL_11:
X509_REQ_free(v7);
return 0;
}
return v7;
}