//
// sub_100722A04 from 0x100722a04 to 0x100722f34 (1328 bytes)
//
// 1 xrefs:
// > sub_10072AF94 @ 0x10072afe0
//
// 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 11:13:06 +0000
//
void **__fastcall sub_100722A04(__int64 a1, void **a2, int a3, char *a4)
{
void **v8; // x19
_BYTE *v9; // x21
char *v10; // x27
_BYTE *v11; // x28
char *v12; // x27
__int64 *v13; // x28
int v14; // w27
__int64 (__fastcall *v15)(__int64 *, __int64 *, __int64); // x26
_BYTE *v16; // x28
_BYTE *v17; // x28
int v18; // w4
int v19; // w21
__int64 v20; // x0
__int64 v22; // [xsp+8h] [xbp-98h] BYREF
void *v23; // [xsp+10h] [xbp-90h] BYREF
void *v24; // [xsp+18h] [xbp-88h] BYREF
char *__s; // [xsp+20h] [xbp-80h] BYREF
char *__s1; // [xsp+28h] [xbp-78h] BYREF
char v27; // [xsp+30h] [xbp-70h] BYREF
__s = nullptr;
__s1 = nullptr;
v24 = nullptr;
v8 = a2;
if ( !a2 )
{
v8 = (void **)sub_10070460C();
if ( !v8 )
{
sub_100706FB0(9, 116, 65, (__int64)"pem_info.c", 107);
goto LABEL_65;
}
}
v9 = sub_10071A944();
if ( !v9 )
goto LABEL_65;
if ( !(unsigned int)sub_100723604(a1, &__s1, &__s, &v24, &v22) )
{
LABEL_52:
if ( (sub_1007075D4() & 0xFFF) != 0x6C )
goto LABEL_64;
sub_1007072C0();
if ( *(_QWORD *)v9 || *((_QWORD *)v9 + 1) || *((_QWORD *)v9 + 2) || *((_QWORD *)v9 + 7) )
{
if ( !(unsigned int)sub_100704974(v8, (__int64)v9) )
goto LABEL_64;
}
else
{
sub_10071A9B0((__int64)v9);
}
goto LABEL_71;
}
while ( 1 )
{
while ( 1 )
{
v10 = __s1;
if ( !strcmp(__s1, "CERTIFICATE") || !strcmp(v10, "X509 CERTIFICATE") )
{
if ( !*(_QWORD *)v9 )
{
v14 = 0;
v13 = (__int64 *)v9;
v15 = (__int64 (__fastcall *)(__int64 *, __int64 *, __int64))sub_100719DF0;
goto LABEL_35;
}
goto LABEL_31;
}
if ( !strcmp(v10, "TRUSTED CERTIFICATE") )
{
if ( !*(_QWORD *)v9 )
{
v14 = 0;
v13 = (__int64 *)v9;
v15 = sub_100719E14;
goto LABEL_35;
}
goto LABEL_31;
}
if ( !strcmp(v10, "X509 CRL") )
{
v13 = (__int64 *)(v9 + 8);
if ( !*((_QWORD *)v9 + 1) )
{
v14 = 0;
v15 = (__int64 (__fastcall *)(__int64 *, __int64 *, __int64))sub_10071A15C;
goto LABEL_35;
}
LABEL_31:
if ( !(unsigned int)sub_100704974(v8, (__int64)v9) )
goto LABEL_64;
goto LABEL_32;
}
if ( !strcmp(v10, "RSA PRIVATE KEY") )
break;
if ( strcmp(v10, "DSA PRIVATE KEY") )
{
if ( strcmp(v10, "EC PRIVATE KEY") )
goto LABEL_41;
if ( !*((_QWORD *)v9 + 2) )
{
*((_QWORD *)v9 + 7) = 0;
*((_DWORD *)v9 + 12) = 0;
v11 = sub_10071F7FC();
*((_QWORD *)v9 + 2) = v11;
if ( !v11 )
goto LABEL_64;
v12 = __s;
if ( (int)strlen(__s) > 10 )
goto LABEL_29;
v13 = (__int64 *)(v11 + 24);
v14 = 408;
v15 = sub_1006E4D5C;
goto LABEL_35;
}
goto LABEL_31;
}
if ( !*((_QWORD *)v9 + 2) )
{
*((_QWORD *)v9 + 7) = 0;
*((_DWORD *)v9 + 12) = 0;
v17 = sub_10071F7FC();
*((_QWORD *)v9 + 2) = v17;
if ( !v17 )
goto LABEL_64;
v12 = __s;
if ( (int)strlen(__s) > 10 )
{
LABEL_29:
if ( !(unsigned int)sub_100723D30(v12) )
goto LABEL_64;
*((_QWORD *)v9 + 7) = v24;
*((_DWORD *)v9 + 12) = v22;
v24 = nullptr;
goto LABEL_41;
}
v13 = (__int64 *)(v17 + 24);
v14 = 116;
v15 = (__int64 (__fastcall *)(__int64 *, __int64 *, __int64))sub_1006F4EE8;
goto LABEL_35;
}
if ( !(unsigned int)sub_100704974(v8, (__int64)v9) )
goto LABEL_64;
LABEL_32:
v9 = sub_10071A944();
if ( !v9 )
goto LABEL_65;
}
if ( *((_QWORD *)v9 + 2) )
goto LABEL_31;
*((_QWORD *)v9 + 7) = 0;
*((_DWORD *)v9 + 12) = 0;
v16 = sub_10071F7FC();
*((_QWORD *)v9 + 2) = v16;
if ( !v16 )
goto LABEL_64;
v12 = __s;
if ( (int)strlen(__s) > 10 )
goto LABEL_29;
v13 = (__int64 *)(v16 + 24);
v14 = 6;
v15 = (__int64 (__fastcall *)(__int64 *, __int64 *, __int64))sub_1006F0438;
LABEL_35:
if ( !(unsigned int)sub_100723D30(__s) || !(unsigned int)sub_100723FA0((int)&v27, (int)v24, (int)&v22, a3, a4) )
goto LABEL_64;
v23 = v24;
if ( !v14 )
break;
if ( !sub_10071AA34(v14, (_BYTE **)v13, (__int64 *)&v23, v22) )
{
v18 = 245;
goto LABEL_63;
}
LABEL_41:
if ( __s1 )
sub_1006AEDAC(__s1);
if ( __s )
sub_1006AEDAC(__s);
if ( v24 )
sub_1006AEDAC(v24);
__s = nullptr;
__s1 = nullptr;
v24 = nullptr;
if ( !(unsigned int)sub_100723604(a1, &__s1, &__s, &v24, &v22) )
goto LABEL_52;
}
if ( v15(v13, (__int64 *)&v23, v22) )
goto LABEL_41;
v18 = 249;
LABEL_63:
sub_100706FB0(9, 116, 13, (__int64)"pem_info.c", v18);
LABEL_64:
sub_10071A9B0((__int64)v9);
LABEL_65:
if ( (int)sub_100704BB4((unsigned int *)v8) > 0 )
{
v19 = 0;
do
{
v20 = sub_100704BC8((__int64)v8, v19);
sub_10071A9B0(v20);
++v19;
}
while ( v19 < (int)sub_100704BB4((unsigned int *)v8) );
}
if ( v8 != a2 )
sub_10070447C(v8);
v8 = nullptr;
LABEL_71:
if ( __s1 )
sub_1006AEDAC(__s1);
if ( __s )
sub_1006AEDAC(__s);
if ( v24 )
sub_1006AEDAC(v24);
return v8;
}