//
// EVP_PBE_CipherInit from 0x8b7a94 to 0x8b7c74 (480 bytes)
//
// 3 xrefs:
// > cms_RecipientInfo_pwri_crypt @ 0x876488
// > PKCS12_pbe_crypt @ 0x8bb764
// > ??> @ 0x6a55c
//
// 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
//
int __fastcall EVP_PBE_CipherInit(int a1, const char *a2, size_t a3, int a4, int a5, int a6)
{
char *v10; // r0
unsigned int v11; // r0
char *v12; // r0
int cipherbyname; // r8
unsigned int v14; // r0
char *v15; // r0
int digestbyname; // r4
unsigned int v18; // [sp+14h] [bp-5Ch] BYREF
unsigned int v19; // [sp+18h] [bp-58h] BYREF
int (__fastcall *v20)(int, const char *, size_t, int, int, int, int); // [sp+1Ch] [bp-54h] BYREF
char v21[80]; // [sp+20h] [bp-50h] BYREF
v10 = OBJ_obj2nid(a1);
if ( EVP_PBE_find(0, (int)v10, &v18, &v19, &v20) )
{
if ( a2 )
{
if ( a3 == -1 )
{
a3 = strlen(a2);
v11 = v18;
if ( v18 != -1 )
{
LABEL_6:
v12 = OBJ_nid2sn(v11);
cipherbyname = EVP_get_cipherbyname((int)v12);
if ( !cipherbyname )
{
digestbyname = 0;
ERR_put_error(6, 116, 160, (int)"crypto/evp/evp_pbe.c", 110);
return digestbyname;
}
v14 = v19;
if ( v19 != -1 )
{
LABEL_8:
v15 = OBJ_nid2sn(v14);
digestbyname = EVP_get_digestbyname((int)v15);
if ( digestbyname )
goto LABEL_9;
ERR_put_error(6, 116, 161, (int)"crypto/evp/evp_pbe.c", 120);
return digestbyname;
}
LABEL_14:
digestbyname = 0;
LABEL_9:
digestbyname = v20(a5, a2, a3, a4, cipherbyname, digestbyname, a6);
if ( digestbyname )
return 1;
ERR_put_error(6, 116, 120, (int)"crypto/evp/evp_pbe.c", 126);
return digestbyname;
}
LABEL_13:
v14 = v19;
cipherbyname = 0;
if ( v19 != -1 )
goto LABEL_8;
goto LABEL_14;
}
}
else
{
a3 = 0;
}
v11 = v18;
if ( v18 != -1 )
goto LABEL_6;
goto LABEL_13;
}
ERR_put_error(6, 116, 121, (int)"crypto/evp/evp_pbe.c", 91);
if ( a1 )
i2t_ASN1_OBJECT((int)v21, 80, a1);
else
OPENSSL_strlcpy(v21, "NULL", 0x50u);
ERR_add_error_data(2, "TYPE=", v21);
return 0;
}