//
// PEM_def_callback from 0xa36028 to 0xa36150 (296 bytes)
//
// 6 xrefs:
// > PEM_do_header @ 0xa36538
// > PEM_ASN1_write_bio @ 0xa36fb4
// > PEM_read_bio_PrivateKey @ 0xa38238
// > d2i_PKCS8PrivateKey_bio @ 0xacf88c
// > sub_ACFB28 @ 0xacfcf0
// > ??> @ 0x7ed4c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:08:08 +0000
//
int __fastcall PEM_def_callback(char *a1, signed int a2, int a3, const char *a4)
{
signed int v7; // r0
int result; // r0
const char *pw_prompt; // r7
if ( !a4 )
{
pw_prompt = (const char *)EVP_get_pw_prompt();
if ( !pw_prompt )
pw_prompt = "Enter PEM pass phrase:";
if ( a3 )
{
while ( !EVP_read_pw_string_min(a1, 4, a2, pw_prompt, a3) )
{
result = strlen(a1);
if ( result > 3 )
return result;
fprintf((FILE *)((char *)&_sF + 168), "phrase is too short, needs to be at least %d chars\n", 4);
}
}
else if ( !EVP_read_pw_string_min(a1, 0, a2, pw_prompt, 0) )
{
return strlen(a1);
}
ERR_put_error(9, 100, 109, (int)"crypto/pem/pem_lib.c", 64);
memset(a1, 0, a2);
return -1;
}
v7 = strlen(a4);
if ( v7 < a2 )
a2 = v7;
memcpy(a1, a4, a2);
return a2;
}