//
// RSA_sign_ASN1_OCTET_STRING from 0x8317e8 to 0x831900 (280 bytes)
//
// 2 xrefs:
// > sub_830AA0 @ 0x830bf0
// > ??> @ 0x6654c
//
// 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_sign_ASN1_OCTET_STRING(int a1, size_t a2, size_t a3, int a4, int *a5, int a6)
{
int v7; // r6
int v8; // r0
unsigned int v9; // r5
_BYTE *v10; // r8
int v11; // r4
int v12; // r0
int *v13; // r3
_BYTE *v15; // [sp+Ch] [bp-14h] BYREF
size_t v16[4]; // [sp+10h] [bp-10h] BYREF
v16[2] = a2;
v16[0] = a3;
v16[1] = 4;
v7 = i2d_ASN1_OCTET_STRING(v16, nullptr);
v8 = RSA_size(a6);
if ( v7 >= v8 - 10 )
{
ERR_put_error(4, 118, 112, (int)"crypto/rsa/rsa_saos.c", 34);
return 0;
}
else
{
v9 = v8 + 1;
v10 = CRYPTO_malloc((void *)(v8 + 1), (int)"crypto/rsa/rsa_saos.c", 37);
if ( v10 )
{
v15 = v10;
v11 = 1;
i2d_ASN1_OCTET_STRING(v16, (int *)&v15);
v12 = RSA_private_encrypt(v7, (int)v10, a4, a6);
if ( v12 <= 0 )
v11 = 0;
else
v13 = a5;
if ( v12 > 0 )
*v13 = v12;
CRYPTO_clear_free(v10, v9, (int)"crypto/rsa/rsa_saos.c", 50);
return v11;
}
else
{
ERR_put_error(4, 118, 65, (int)"crypto/rsa/rsa_saos.c", 39);
return 0;
}
}
}