//
// X509_ATTRIBUTE_set1_data from 0x83e0a4 to 0x83e228 (388 bytes)
//
// 3 xrefs:
// > X509_ATTRIBUTE_create_by_OBJ @ 0x83e2a4
// > X509_ATTRIBUTE_create_by_OBJ @ 0x83e308
// > ??> @ 0x66c2c
//
// 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 X509_ATTRIBUTE_set1_data(int *result, int a2, const char *a3, int a4)
{
int v4; // r9
int *v8; // r5
signed int *v9; // r0
int v10; // r8
_DWORD *v11; // r10
char *v12; // r0
int v13; // r0
if ( result )
{
v4 = a2 & 0x1000;
v8 = result;
if ( (a2 & 0x1000) == 0 )
{
if ( a4 == -1 )
{
v10 = a2 & 0x1000;
}
else
{
v9 = (signed int *)ASN1_STRING_type_new(a2);
v10 = (int)v9;
if ( !v9 )
{
v11 = nullptr;
goto LABEL_8;
}
if ( !ASN1_STRING_set(v9, a3, a4) )
{
v11 = nullptr;
goto LABEL_8;
}
v4 = a2;
}
if ( !a2 )
{
ASN1_STRING_free(v10);
return &dword_0 + 1;
}
v11 = ASN1_TYPE_new();
if ( !v11 )
{
LABEL_8:
ERR_put_error(11, 138, 65, (int)"crypto/x509/x509_att.c", 290);
ASN1_TYPE_free(v11);
ASN1_STRING_free(v10);
return nullptr;
}
if ( a4 == -1 )
{
if ( !ASN1_TYPE_set1() )
goto LABEL_8;
goto LABEL_15;
}
LABEL_14:
ASN1_TYPE_set(v11, v4, v10);
v10 = 0;
LABEL_15:
if ( OPENSSL_sk_push((int *)v8[1], (int)v11) )
return &dword_0 + 1;
goto LABEL_8;
}
v12 = OBJ_obj2nid(*result);
v13 = ASN1_STRING_set_by_NID(0, a3, a4, a2, v12);
v10 = v13;
if ( v13 )
{
v4 = *(_DWORD *)(v13 + 4);
v11 = ASN1_TYPE_new();
if ( !v11 )
goto LABEL_8;
goto LABEL_14;
}
ERR_put_error(11, 138, 13, (int)"crypto/x509/x509_att.c", 257);
return nullptr;
}
return result;
}