//
// EVP_PKEY_derive from 0xa1b434 to 0xa1b53c (264 bytes)
//
// 8 xrefs:
// > ssl_derive @ 0x9a3ddc
// > ssl_derive @ 0x9a3e10
// > sub_9CEC08 @ 0x9ced74
// > tls1_final_finish_mac @ 0x9cf868
// > tls1_generate_master_secret @ 0x9cfa4c
// > CMS_RecipientInfo_kari_decrypt @ 0xa894e4
// > cms_RecipientInfo_kari_encrypt @ 0xa89950
// > ??> @ 0x7494c
//
// 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:07:52 +0000
//
int __fastcall EVP_PKEY_derive(int *a1, int a2, unsigned int *a3)
{
int v4; // r0
int (__fastcall *v5)(int *, int, unsigned int *); // r3
unsigned int v8; // r0
if ( a1 && (v4 = *a1) != 0 && (v5 = *(int (__fastcall **)(int *, int, unsigned int *))(v4 + 96)) != nullptr )
{
if ( a1[4] == 1024 )
{
if ( (*(_DWORD *)(v4 + 4) & 2) == 0 )
return v5(a1, a2, a3);
v8 = EVP_PKEY_size(a1[2]);
if ( !a2 )
{
*a3 = v8;
return 1;
}
if ( v8 <= *a3 )
{
v5 = *(int (__fastcall **)(int *, int, unsigned int *))(*a1 + 96);
return v5(a1, a2, a3);
}
ERR_put_error(6, 153, 155, (int)"crypto/evp/pmeth_fn.c", 293);
return 0;
}
else
{
ERR_put_error(6, 153, 151, (int)"crypto/evp/pmeth_fn.c", 290);
return -1;
}
}
else
{
ERR_put_error(6, 153, 150, (int)"crypto/evp/pmeth_fn.c", 286);
return -2;
}
}