//
// RSA_padding_add_PKCS1_type_2 from 0xa44278 to 0xa4436c (244 bytes)
//
// 2 xrefs:
// > sub_A431F4 @ 0xa43404
// > ??> @ 0x7fe8c
//
// 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:08:15 +0000
//
int __fastcall RSA_padding_add_PKCS1_type_2(_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, 109, 110, (int)"crypto/rsa/rsa_pk1.c", 125);
return 0;
}
else
{
v6 = a2 - 3 - a4;
*a1 = 0;
v7 = a1 + 2;
a1[1] = 2;
if ( RAND_bytes((int)(a1 + 2), v6) > 0 )
{
if ( v6 <= 0 )
{
LABEL_7:
*v7 = 0;
memcpy(v7 + 1, 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;
}
}