//
// RSA_padding_add_SSLv23 from 0x832190 to 0x832294 (260 bytes)
//
// 2 xrefs:
// > sub_82E5F4 @ 0x82e818
// > ??> @ 0x6641c
//
// 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 RSA_padding_add_SSLv23(_BYTE *a1, int a2, const void *a3, signed int a4)
{
int v6; // r5
unsigned __int8 *v7; // r9
unsigned __int8 *v8; // r4
unsigned __int8 *v9; // r6
int v10; // r3
int v11; // r5
if ( a2 - 10 <= a4 )
{
ERR_put_error(4, 110, 110, (int)"crypto/rsa/rsa_ssl.c", 24);
return 0;
}
else
{
v6 = a2 - 11 - a4;
*a1 = 0;
v7 = a1 + 2;
a1[1] = 2;
if ( RAND_bytes((int)(a1 + 2), v6) > 0 )
{
if ( v6 <= 0 )
{
LABEL_7:
memset(v7, 3, 8u);
v7[8] = 0;
memcpy(v7 + 9, a3, a4);
return 1;
}
v8 = v7;
v9 = &v7[v6];
while ( 1 )
{
v10 = *v8;
v11 = (int)v8++;
if ( !v10 )
break;
LABEL_6:
v7 = v8;
if ( v8 == v9 )
goto LABEL_7;
}
while ( RAND_bytes(v11, 1) > 0 )
{
if ( *(v8 - 1) )
goto LABEL_6;
}
}
return 0;
}
}