//
// sub_82BD00 from 0x82bd00 to 0x82c058 (856 bytes)
//
// 1 xrefs:
// > ??> @ 0xa38d48
//
// 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 sub_82BD00(int a1, int *a2, int a3, int a4)
{
int v9; // r0
int v10; // r5
int *v11; // r8
int *v12; // r8
int v13; // r2
int v14; // r2
int *v15; // r3
int v16; // r2
int v17; // r3
int v18; // r1
int v19; // r1
if ( OBJ_obj2nid(*a2) == (char *)&stru_38C.st_value )
{
v9 = ASN1_TYPE_unpack_sequence(&RSA_PSS_PARAMS_it, a2[1]);
v10 = v9;
if ( v9 )
{
v11 = *(int **)(v9 + 4);
if ( v11 && OBJ_obj2nid(*v11) == (_BYTE *)&stru_38C.st_name + 3 )
v12 = (int *)ASN1_TYPE_unpack_sequence(X509_ALGOR_it, v11[1]);
else
v12 = nullptr;
if ( BIO_puts(a1, (int)"\n") <= 0 || !BIO_indent(a1, a4, 128) || BIO_puts(a1, (int)"Hash Algorithm: ") <= 0 )
goto LABEL_10;
if ( *(_DWORD *)v10 )
{
if ( i2a_ASN1_OBJECT(a1, **(_DWORD **)v10, v13, *(_DWORD *)v10) <= 0 )
goto LABEL_10;
}
else if ( BIO_puts(a1, (int)"sha1 (default)") <= 0 )
{
goto LABEL_10;
}
if ( BIO_puts(a1, (int)"\n") <= 0 || !BIO_indent(a1, a4, 128) || BIO_puts(a1, (int)"Mask Algorithm: ") <= 0 )
goto LABEL_10;
v15 = *(int **)(v10 + 4);
if ( v15 )
{
if ( i2a_ASN1_OBJECT(a1, *v15, v14, (int)v15) <= 0 || BIO_puts(a1, (int)" with ") <= 0 )
goto LABEL_10;
if ( v12 )
{
if ( i2a_ASN1_OBJECT(a1, *v12, v16, v17) <= 0 )
goto LABEL_10;
}
else if ( BIO_puts(a1, (int)"INVALID") <= 0 )
{
goto LABEL_10;
}
}
else if ( BIO_puts(a1, (int)"mgf1 with sha1 (default)") <= 0 )
{
goto LABEL_10;
}
BIO_puts(a1, (int)"\n");
if ( !BIO_indent(a1, a4, 128) || BIO_puts(a1, (int)"Salt Length: 0x") <= 0 )
goto LABEL_10;
v18 = *(_DWORD *)(v10 + 8);
if ( v18 )
{
if ( i2a_ASN1_INTEGER(a1, v18) <= 0 )
goto LABEL_10;
}
else if ( BIO_puts(a1, (int)"14 (default)") <= 0 )
{
goto LABEL_10;
}
BIO_puts(a1, (int)"\n");
if ( BIO_indent(a1, a4, 128) && BIO_puts(a1, (int)"Trailer Field: 0x") > 0 )
{
v19 = *(_DWORD *)(v10 + 12);
if ( v19 )
{
if ( i2a_ASN1_INTEGER(a1, v19) > 0 )
{
LABEL_32:
BIO_puts(a1, (int)"\n");
LABEL_33:
RSA_PSS_PARAMS_free(v10);
X509_ALGOR_free(v12);
if ( a3 )
return X509_signature_dump(a1, a3, a4);
return 1;
}
}
else if ( BIO_puts(a1, (int)"BC (default)") > 0 )
{
goto LABEL_32;
}
}
}
else
{
v12 = nullptr;
if ( BIO_puts(a1, (int)" (INVALID PSS PARAMETERS)\n") > 0 )
goto LABEL_33;
}
LABEL_10:
RSA_PSS_PARAMS_free(v10);
X509_ALGOR_free(v12);
return 0;
}
if ( a3 )
return X509_signature_dump(a1, a3, a4);
return BIO_puts(a1, (int)"\n") > 0;
}