//
// PEM_def_callback from 0x1045130 to 0x1045274 (324 bytes)
//
// 6 xrefs:
// > PEM_do_header @ 0x1045680
// > PEM_ASN1_write_bio @ 0x10460d8
// > PEM_read_bio_PrivateKey @ 0x104728c
// > d2i_PKCS8PrivateKey_bio @ 0x10e2ca4
// > sub_10E2EF8 @ 0x10e30ac
// > ??> @ 0xb7d78
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:16:33 +0000
//
__int64 __fastcall PEM_def_callback(char *a1, unsigned int a2, unsigned int a3, char *a4)
{
int v7; // w0
__int64 result; // x0
const char *pw_prompt; // x22
if ( !a4 )
{
pw_prompt = (const char *)EVP_get_pw_prompt();
if ( pw_prompt )
{
if ( a3 )
goto LABEL_11;
}
else
{
pw_prompt = "Enter PEM pass phrase:";
if ( a3 )
{
LABEL_11:
while ( !(unsigned int)EVP_read_pw_string_min(a1, 4, a2, pw_prompt, a3) )
{
result = strlen(a1);
if ( (int)result > 3 )
return result;
fprintf((FILE *)((char *)&_sF + 304), "phrase is too short, needs to be at least %d chars\n", 4);
}
goto LABEL_12;
}
}
if ( !(unsigned int)EVP_read_pw_string_min(a1, a3, a2, pw_prompt, a3) )
return strlen(a1);
LABEL_12:
ERR_put_error(9, 100, 109, (__int64)"crypto/pem/pem_lib.c", 64);
memset(a1, 0, a2);
return 0xFFFFFFFFLL;
}
v7 = strlen(a4);
if ( v7 <= (int)a2 )
a2 = v7;
memcpy(a1, a4, (int)a2);
return a2;
}