//
// RSA_padding_check_PKCS1_type_1 from 0xa4409c to 0xa44260 (452 bytes)
//
// 2 xrefs:
// > sub_A42E10 @ 0xa431b0
// > ??> @ 0x7fe6c
//
// 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_check_PKCS1_type_1(void *a1, int a2, _BYTE *a3, int a4, int a5)
{
_BYTE *v5; // r5
int v6; // r3
int v7; // lr
unsigned __int8 *v8; // r2
int v9; // r12
int v10; // t1
const void *v12; // r5
int v13; // r4
if ( a5 <= 10 )
return -1;
if ( a5 == a4 )
{
if ( *a3++ )
{
ERR_put_error(4, 112, 138, (int)"crypto/rsa/rsa_pk1.c", 67);
return -1;
}
a4 = a5 - 1;
}
if ( a4 + 1 != a5 || (v5 = a3 + 1, *a3 != 1) )
{
ERR_put_error(4, 112, 106, (int)"crypto/rsa/rsa_pk1.c", 75);
return -1;
}
v6 = a4 - 1;
if ( v6 <= 0 )
{
if ( !v6 )
{
LABEL_11:
ERR_put_error(4, 112, 113, (int)"crypto/rsa/rsa_pk1.c", 97);
return -1;
}
goto LABEL_22;
}
v7 = (unsigned __int8)a3[1];
if ( v7 == 255 )
{
v8 = a3 + 2;
v9 = 0;
while ( 1 )
{
++v9;
v5 = v8;
if ( v9 == v6 )
goto LABEL_11;
v10 = *v8++;
v7 = v10;
if ( v10 != 255 )
goto LABEL_12;
}
}
v9 = 0;
LABEL_12:
if ( v7 )
{
ERR_put_error(4, 112, 102, (int)"crypto/rsa/rsa_pk1.c", 88);
return -1;
}
v12 = v5 + 1;
if ( v9 <= 7 )
{
LABEL_22:
ERR_put_error(4, 112, 103, (int)"crypto/rsa/rsa_pk1.c", 103);
return -1;
}
v13 = v6 - (v9 + 1);
if ( v13 > a2 )
{
ERR_put_error(4, 112, 109, (int)"crypto/rsa/rsa_pk1.c", 109);
return -1;
}
else
{
memcpy(a1, v12, v6 - (v9 + 1));
return v13;
}
}