//
// X509_to_X509_REQ from 0x8c3294 to 0x8c3388 (244 bytes)
//
// 1 xrefs:
// > ??> @ 0x6b55c
//
// 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
//
_DWORD *__fastcall X509_to_X509_REQ(int a1, int a2, int a3)
{
_DWORD *v6; // r0
_DWORD *v7; // r4
_DWORD *v8; // r5
void *v9; // r0
int v10; // r3
_BYTE *v11; // r3
int subject_name; // r0
int v13; // r1
v6 = X509_REQ_new();
v7 = v6;
if ( v6 )
{
v8 = (_DWORD *)v6[3];
*v8 = 1;
v9 = CRYPTO_malloc((char *)&dword_0 + 1, (int)"crypto/x509/x509_req.c", 38);
v10 = v7[3];
v8[2] = v9;
v11 = *(_BYTE **)(v10 + 8);
if ( v11 )
{
*v11 = 0;
subject_name = X509_get_subject_name(a1);
if ( X509_REQ_set_subject_name(v7, subject_name) )
{
v13 = X509_get0_pubkey(a1);
if ( v13 )
{
if ( X509_REQ_set_pubkey(v7, v13) && (!a2 || X509_REQ_sign((int)v7, a2, a3)) )
return v7;
}
}
}
}
else
{
ERR_put_error(11, 126, 65, (int)"crypto/x509/x509_req.c", 31);
}
X509_REQ_free(v7);
return nullptr;
}