//
// NAME_CONSTRAINTS_check_CN from 0x858388 to 0x858478 (240 bytes)
//
// 2 xrefs:
// > sub_843DE0 @ 0x844ed0
// > ??> @ 0x675dc
//
// 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 NAME_CONSTRAINTS_check_CN(int a1, int *a2)
{
int index_by_NID; // r4
int *subject_name; // r5
int entry; // r0
int *data; // r6
int v7; // r3
int v8; // r6
void *v10; // [sp+4h] [bp-1Ch] BYREF
_DWORD v11[2]; // [sp+8h] [bp-18h] BYREF
_DWORD v12[4]; // [sp+10h] [bp-10h] BYREF
v11[0] = 2;
v12[3] = 0;
v12[1] = 22;
v11[1] = v12;
index_by_NID = -1;
subject_name = (int *)X509_get_subject_name(a1);
while ( 1 )
{
do
{
index_by_NID = X509_NAME_get_index_by_NID(subject_name, 0xDu, index_by_NID);
if ( index_by_NID == -1 )
return 0;
entry = X509_NAME_get_entry(subject_name, index_by_NID);
data = (int *)X509_NAME_ENTRY_get_data(entry);
}
while ( !asn1_valid_host(data) );
v7 = ASN1_STRING_to_UTF8(&v10, data);
if ( v7 <= 0 )
break;
v12[0] = v7;
v12[2] = v10;
v8 = sub_857F64(v11, a2);
CRYPTO_free(v10, (int)"crypto/x509v3/v3_ncons.c", 267);
if ( v8 )
return v8;
}
return 17;
}