//
// PKCS7_set_type from 0x104c95c to 0x104cb3c (480 bytes)
//
// 3 xrefs:
// > PKCS7_content_new @ 0x104cb60
// > PKCS12_pack_p7encdata @ 0x10e3820
// > ??> @ 0xc4798
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:16:37 +0000
//
__int64 __fastcall PKCS7_set_type(__int64 a1, unsigned int a2)
{
char **v3; // x0
unsigned int v4; // w20
_QWORD *v6; // x0
_QWORD *v7; // x0
__int64 v8; // x0
_QWORD *v9; // x0
_QWORD *v10; // x0
char ***v11; // x19
_QWORD *v12; // x0
char ***v13; // x19
char ***v14; // x19
v3 = OBJ_nid2obj(a2);
switch ( a2 )
{
case 0x15u:
*(_QWORD *)(a1 + 24) = v3;
v8 = ASN1_OCTET_STRING_new();
*(_QWORD *)(a1 + 32) = v8;
return v8 != 0;
case 0x16u:
*(_QWORD *)(a1 + 24) = v3;
v9 = (_QWORD *)PKCS7_SIGNED_new();
*(_QWORD *)(a1 + 32) = v9;
if ( !v9 )
return 0;
v4 = ASN1_INTEGER_set(*v9, 1);
if ( v4 )
{
return 1;
}
else
{
PKCS7_SIGNED_free(*(_QWORD *)(a1 + 32));
*(_QWORD *)(a1 + 32) = 0;
}
return v4;
case 0x17u:
*(_QWORD *)(a1 + 24) = v3;
v10 = (_QWORD *)PKCS7_ENVELOPE_new();
*(_QWORD *)(a1 + 32) = v10;
if ( !v10 || !(unsigned int)ASN1_INTEGER_set(*v10, 0) )
return 0;
v4 = 1;
v11 = *(char ****)(*(_QWORD *)(a1 + 32) + 16LL);
*v11 = OBJ_nid2obj(0x15u);
return v4;
case 0x18u:
*(_QWORD *)(a1 + 24) = v3;
v12 = (_QWORD *)PKCS7_SIGN_ENVELOPE_new();
*(_QWORD *)(a1 + 32) = v12;
if ( !v12 )
return 0;
ASN1_INTEGER_set(*v12, 1);
if ( !(unsigned int)ASN1_INTEGER_set(**(_QWORD **)(a1 + 32), 1) )
return 0;
v4 = 1;
v13 = *(char ****)(*(_QWORD *)(a1 + 32) + 40LL);
*v13 = OBJ_nid2obj(0x15u);
return v4;
case 0x19u:
*(_QWORD *)(a1 + 24) = v3;
v6 = (_QWORD *)PKCS7_DIGEST_new();
*(_QWORD *)(a1 + 32) = v6;
if ( !v6 )
return 0;
return (unsigned int)ASN1_INTEGER_set(*v6, 0) != 0;
case 0x1Au:
*(_QWORD *)(a1 + 24) = v3;
v7 = (_QWORD *)PKCS7_ENCRYPT_new();
*(_QWORD *)(a1 + 32) = v7;
if ( !v7 || !(unsigned int)ASN1_INTEGER_set(*v7, 0) )
return 0;
v4 = 1;
v14 = *(char ****)(*(_QWORD *)(a1 + 32) + 8LL);
*v14 = OBJ_nid2obj(0x15u);
return v4;
default:
v4 = 0;
ERR_put_error(33, 110, 112, (__int64)"crypto/pkcs7/pk7_lib.c", 171);
return v4;
}
}