//
// PKCS5_v2_scrypt_keyivgen from 0xadc8a4 to 0xadcadc (568 bytes)
//
// 2 xrefs:
// > ??> @ 0x84b1c
// > ??> @ 0xd19ad0
//
// 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:09:31 +0000
//
int __fastcall PKCS5_v2_scrypt_keyivgen(int *a1, int a2, int a3, _DWORD *a4, int a5, int a6, int a7)
{
_DWORD *v11; // r4
int v12; // r0
int *v13; // r1
unsigned int v14; // r5
int v15; // r6
unsigned __int64 v17; // [sp+28h] [bp-5Ch] BYREF
unsigned __int64 v18; // [sp+30h] [bp-54h] BYREF
unsigned __int64 v19; // [sp+38h] [bp-4Ch] BYREF
unsigned __int64 v20[8]; // [sp+40h] [bp-44h] BYREF
if ( !EVP_CIPHER_CTX_cipher((int)a1) )
{
ERR_put_error(6, 180, 131, (int)"crypto/asn1/p5_scrypt.c", 237);
LABEL_19:
v11 = nullptr;
v15 = 0;
goto LABEL_9;
}
v11 = (_DWORD *)ASN1_TYPE_unpack_sequence((int)byte_C8180C, a4);
if ( !v11 )
{
ERR_put_error(6, 180, 114, (int)"crypto/asn1/p5_scrypt.c", 246);
goto LABEL_19;
}
v12 = EVP_CIPHER_CTX_key_length((int)a1);
v13 = (int *)v11[4];
v14 = v12;
if ( !v13 || ASN1_INTEGER_get_uint64(v20, v13) && v14 == v20[0] )
{
if ( ASN1_INTEGER_get_uint64(&v19, (int *)v11[1])
&& ASN1_INTEGER_get_uint64(&v18, (int *)v11[2])
&& ASN1_INTEGER_get_uint64(&v17, (int *)v11[3])
&& EVP_PBE_scrypt(0, 0, 0, 0, v19, HIDWORD(v19), v18, HIDWORD(v18), v17, HIDWORD(v17), 0, 0, 0, 0) )
{
if ( EVP_PBE_scrypt(
a2,
a3,
*(_DWORD *)(*v11 + 8),
*(_DWORD *)*v11,
v19,
HIDWORD(v19),
v18,
HIDWORD(v18),
v17,
HIDWORD(v17),
0,
0,
v20,
v14) )
{
v15 = EVP_CipherInit_ex(a1, nullptr, nullptr, (int)v20, nullptr, a7);
}
else
{
v15 = 0;
}
}
else
{
ERR_put_error(6, 180, 171, (int)"crypto/asn1/p5_scrypt.c", 269);
v15 = 0;
}
}
else
{
ERR_put_error(6, 180, 123, (int)"crypto/asn1/p5_scrypt.c", 259);
v15 = 0;
}
if ( v14 )
OPENSSL_cleanse(v20, v14);
LABEL_9:
SCRYPT_PARAMS_free(v11);
return v15;
}