//
// EVP_EncryptFinal_ex from 0x802768 to 0x80287c (276 bytes)
//
// 4 xrefs:
// > EVP_EncryptFinal @ 0x80288c
// > EVP_CipherFinal_ex @ 0x802e0c
// > PEM_ASN1_write_bio @ 0x822380
// > ??> @ 0x6350c
//
// 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_EncryptFinal_ex(_DWORD *a1, int a2, _DWORD *a3)
{
int v3; // r6
unsigned int v6; // r7
int v7; // r3
unsigned int v8; // r0
int result; // r0
int v11; // r0
v3 = *a1;
if ( (*(_DWORD *)(*a1 + 16) & 0x100000) != 0 )
{
v11 = (*(int (**)(void))(v3 + 24))();
if ( v11 < 0 )
return 0;
*a3 = v11;
return 1;
}
v6 = *(_DWORD *)(v3 + 4);
if ( v6 > 0x20 )
OPENSSL_die("assertion failed: b <= sizeof ctx->buf", "crypto/evp/evp_enc.c", 392);
if ( v6 == 1 )
{
LABEL_11:
*a3 = 0;
return 1;
}
v7 = a1[23];
v8 = a1[3];
if ( (v7 & 0x100) != 0 )
{
if ( v8 )
{
ERR_put_error(6, 127, 138, (int)"crypto/evp/evp_enc.c", 401);
return 0;
}
goto LABEL_11;
}
if ( v6 > v8 )
memset((char *)a1 + v8 + 48, (unsigned __int8)(v6 - v8), v6 - v8);
result = (*(int (__fastcall **)(_DWORD *, int, _DWORD *, unsigned int))(v3 + 24))(a1, a2, a1 + 12, v6);
if ( result )
*a3 = v6;
return result;
}