//
// PKCS8_encrypt from 0x10e40d4 to 0x10e41f8 (292 bytes)
//
// 4 xrefs:
// > PKCS12_SAFEBAG_create_pkcs8_encrypt @ 0x1049af8
// > sub_10E2EF8 @ 0x10e2fb8
// > sub_10E2EF8 @ 0x10e3068
// > ??> @ 0xb9f80
//
// 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:17:50 +0000
//
_QWORD *__fastcall PKCS8_encrypt(
unsigned int a1,
__int64 a2,
const char *a3,
unsigned int a4,
const void *a5,
unsigned int a6,
unsigned int a7,
__int64 a8)
{
__int64 *v16; // x19
_QWORD *v17; // x20
if ( a1 == -1 )
{
v16 = (__int64 *)PKCS5_pbe2_set(a2, a7, a5, a6);
}
else if ( (unsigned int)EVP_PBE_find(1, a1, nullptr, nullptr, nullptr) )
{
v16 = (__int64 *)PKCS5_pbe2_set_iv(a2, a7, a5, a6, 0, a1);
}
else
{
ERR_clear_error();
v16 = PKCS5_pbe_set(a1, a7, a5, a6);
}
if ( v16 )
{
v17 = PKCS8_set0_pbe(a3, a4, a8, v16);
if ( !v17 )
X509_ALGOR_free((__int64)v16);
}
else
{
v17 = nullptr;
ERR_put_error(35, 125, 13, (__int64)"crypto/pkcs12/p12_p8e.c", 32);
}
return v17;
}