//
// EVP_PBE_CipherInit from 0xe61ba8 to 0xe61dcc (548 bytes)
//
// 3 xrefs:
// > cms_RecipientInfo_pwri_crypt @ 0xe20e14
// > PKCS12_pbe_crypt @ 0xe65c88
// > ??> @ 0x46698
//
// 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 EVP_PBE_CipherInit(
__int64 a1,
const char *a2,
unsigned int a3,
__int64 a4,
__int64 a5,
unsigned int a6)
{
int v12; // w0
unsigned int v13; // w0
char *v14; // x0
__int64 cipherbyname; // x22
unsigned int v16; // w0
char *v17; // x0
__int64 digestbyname; // x5
unsigned int v19; // w19
unsigned int v21; // [xsp+50h] [xbp+50h] BYREF
unsigned int v22; // [xsp+54h] [xbp+54h] BYREF
unsigned int (__fastcall *v23)(__int64, const char *, _QWORD, __int64, __int64, __int64, _QWORD); // [xsp+58h] [xbp+58h] BYREF
char v24[80]; // [xsp+60h] [xbp+60h] BYREF
v12 = OBJ_obj2nid(a1);
if ( !(unsigned int)EVP_PBE_find(0, v12, &v21, &v22, &v23) )
{
ERR_put_error(6, 116, 121, (__int64)"crypto/evp/evp_pbe.c", 91);
if ( a1 )
i2t_ASN1_OBJECT((__int64)v24, 80, a1);
else
OPENSSL_strlcpy(v24, "NULL", 0x50u);
ERR_add_error_data(2, "TYPE=", v24);
return 0;
}
if ( a2 )
{
if ( a3 != -1 )
{
v13 = v21;
if ( v21 != -1 )
goto LABEL_5;
LABEL_11:
v16 = v22;
cipherbyname = 0;
if ( v22 != -1 )
goto LABEL_7;
goto LABEL_12;
}
a3 = strlen(a2);
v13 = v21;
if ( v21 == -1 )
goto LABEL_11;
}
else
{
v13 = v21;
a3 = 0;
if ( v21 == -1 )
goto LABEL_11;
}
LABEL_5:
v14 = OBJ_nid2sn(v13);
cipherbyname = EVP_get_cipherbyname((__int64)v14);
if ( !cipherbyname )
{
v19 = 0;
ERR_put_error(6, 116, 160, (__int64)"crypto/evp/evp_pbe.c", 110);
return v19;
}
v16 = v22;
if ( v22 != -1 )
{
LABEL_7:
v17 = OBJ_nid2sn(v16);
digestbyname = EVP_get_digestbyname((__int64)v17);
if ( !digestbyname )
{
v19 = 0;
ERR_put_error(6, 116, 161, (__int64)"crypto/evp/evp_pbe.c", 120);
return v19;
}
goto LABEL_8;
}
LABEL_12:
digestbyname = 0;
LABEL_8:
if ( v23(a5, a2, a3, a4, cipherbyname, digestbyname, a6) )
return 1;
ERR_put_error(6, 116, 120, (__int64)"crypto/evp/evp_pbe.c", 126);
return 0;
}