// // OCSP_basic_verify from 0xa3452c to 0xa34b3c (1552 bytes) // // 2 xrefs: // > sub_852C2C @ 0x85371e // > @ 0x67f7c // // This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False! // // 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 12:08:07 +0000 // int __fastcall OCSP_basic_verify(_DWORD *a1, int a2, int a3, __int16 a4) { _DWORD *v8; // r3 const void *v9; // r10 int v10; // r6 int v11; // r11 void *v12; // r0 int v13; // r0 int v14; // r1 bool v15; // cc int v16; // r7 int v17; // r10 int v18; // r6 int v19; // r9 bool v20; // zf int v22; // r7 int v23; // r0 int v24; // r0 int v25; // r1 int v26; // r0 int v27; // r11 int **v28; // r0 int *v29; // r7 int v30; // r11 int v31; // r0 int v32; // r0 int v33; // r0 int v34; // r0 int v35; // r6 _DWORD *v36; // r3 int v37; // r10 int v38; // r0 int v39; // r1 void *v40; // r0 int error; // r8 int v42; // r0 char extension_flags; // r0 void *v44; // [sp+Ch] [bp-28h] void *v45; // [sp+Ch] [bp-28h] int *v46; // [sp+10h] [bp-24h] int v47; // [sp+14h] [bp-20h] _BYTE v48[24]; // [sp+1Ch] [bp-18h] BYREF if ( a1[1] ) { v8 = (_DWORD *)a1[2]; if ( *v8 == 20 ) { v9 = (const void *)v8[2]; v10 = 0; while ( 1 ) { v13 = OPENSSL_sk_num(a2); v14 = v10; v15 = v10++ < v13; if ( !v15 ) break; v11 = OPENSSL_sk_value(a2, v14); v12 = EVP_sha1(); X509_pubkey_digest(v11, v12, v48); if ( !memcmp(v9, v48, 0x14u) ) goto LABEL_14; } } goto LABEL_6; } v11 = X509_find_by_subject(a2, a1[2]); LABEL_14: if ( !v11 ) { LABEL_6: if ( (a4 & 2) != 0 ) goto LABEL_7; v35 = a1[9]; if ( a1[1] ) { v36 = (_DWORD *)a1[2]; if ( *v36 == 20 ) { v37 = a4 & 2; v45 = (void *)v36[2]; while ( 1 ) { v38 = OPENSSL_sk_num(v35); v39 = v37; v15 = v37++ < v38; if ( !v15 ) break; v11 = OPENSSL_sk_value(v35, v39); v40 = EVP_sha1(); X509_pubkey_digest(v11, v40, v48); if ( !memcmp(v45, v48, 0x14u) ) goto LABEL_61; } } goto LABEL_7; } v11 = X509_find_by_subject(a1[9], a1[2]); LABEL_61: if ( !v11 ) { LABEL_7: ERR_put_error(39, 105, 118, (int)"crypto/ocsp/ocsp_vfy.c", 41); v16 = 0; v17 = 0; v18 = 0; v19 = 0; goto LABEL_8; } v17 = X509_STORE_CTX_new(); if ( v17 ) { v16 = 1; goto LABEL_19; } LABEL_71: v17 = 0; ERR_put_error(39, 105, 65, (int)"crypto/ocsp/ocsp_vfy.c", 46); v18 = 0; v19 = 0; v16 = -1; goto LABEL_8; } v17 = X509_STORE_CTX_new(); if ( !v17 ) goto LABEL_71; if ( (a4 & 0x200) != 0 ) a4 |= 0x10u; v16 = 2; LABEL_19: v18 = a4 & 4; if ( (a4 & 4) == 0 ) { v16 = X509_get0_pubkey(v11); if ( !v16 ) { ERR_put_error(39, 105, 130, (int)"crypto/ocsp/ocsp_vfy.c", 55); v18 = 0; v19 = 0; goto LABEL_8; } v16 = ASN1_item_verify(OCSP_RESPDATA_it, a1 + 6, a1[8], a1, v16); if ( v16 <= 0 ) { ERR_put_error(39, 105, 117, (int)"crypto/ocsp/ocsp_vfy.c", 60); v19 = a4 & 4; goto LABEL_8; } } v18 = a4 & 0x10; if ( (a4 & 0x10) != 0 ) { v18 = 0; v19 = 0; goto LABEL_8; } v22 = a4 & 8; if ( (a4 & 8) == 0 ) { v18 = a1[9]; if ( v18 ) { if ( a2 ) { v18 = OPENSSL_sk_dup(a1[9]); while ( 1 ) { v24 = OPENSSL_sk_num(a2); v25 = v22; v15 = v22++ < v24; if ( !v15 ) break; v23 = OPENSSL_sk_value(a2, v25); if ( !OPENSSL_sk_push(v18, v23) ) { v19 = 0; v16 = -1; ERR_put_error(39, 105, 65, (int)"crypto/ocsp/ocsp_vfy.c", 72); goto LABEL_8; } } } } } v19 = X509_STORE_CTX_init(v17, a3, v11, v18); if ( !v19 ) { ERR_put_error(39, 105, 11, (int)"crypto/ocsp/ocsp_vfy.c", 81); v16 = -1; goto LABEL_8; } X509_STORE_CTX_set_purpose(v17, 8); v16 = X509_verify_cert(v17); v26 = X509_STORE_CTX_get1_chain(v17); v19 = v26; if ( v16 <= 0 ) { error = X509_STORE_CTX_get_error(v17); ERR_put_error(39, 105, 101, (int)"crypto/ocsp/ocsp_vfy.c", 91); v42 = X509_verify_cert_error_string(error); ERR_add_error_data(2, "Verify error:", v42); goto LABEL_8; } if ( (a4 & 0x100) != 0 ) { LABEL_31: v16 = 1; goto LABEL_8; } v44 = (void *)a1[4]; if ( OPENSSL_sk_num(v26) <= 0 ) { ERR_put_error(39, 108, 105, (int)"crypto/ocsp/ocsp_vfy.c", 194); v16 = -1; goto LABEL_8; } v47 = OPENSSL_sk_num(v44); if ( v47 <= 0 ) { ERR_put_error(39, 107, 111, (int)"crypto/ocsp/ocsp_vfy.c", 239); v16 = -1; goto LABEL_8; } v46 = *(int **)OPENSSL_sk_value(v44, a4 & 0x100); if ( v47 == 1 ) goto LABEL_45; v27 = 1; while ( 1 ) { v28 = (int **)OPENSSL_sk_value(v44, v27++); v29 = *v28; if ( OCSP_id_issuer_cmp(v46, *v28) ) break; if ( v27 == v47 ) goto LABEL_45; } if ( OBJ_cmp(*v29, *v46) ) { v46 = nullptr; LABEL_45: v30 = OPENSSL_sk_value(v19, 0); if ( OPENSSL_sk_num(v19) <= 1 ) goto LABEL_49; v31 = OPENSSL_sk_value(v19, 1); v32 = sub_A343E0(v31, v46, (int)v44); v16 = v32; if ( v32 < 0 ) goto LABEL_8; if ( v32 ) { extension_flags = X509_get_extension_flags(v30); if ( (extension_flags & 4) != 0 && (X509_get_extended_key_usage(v30) & 0x20) != 0 ) goto LABEL_31; ERR_put_error(39, 106, 103, (int)"crypto/ocsp/ocsp_vfy.c", 318); } else { LABEL_49: v16 = sub_A343E0(v30, v46, (int)v44); if ( v16 ) goto LABEL_8; } } if ( (a4 & 0x20) != 0 ) { v16 = 0; } else { v33 = OPENSSL_sk_num(v19); v34 = OPENSSL_sk_value(v19, v33 - 1); if ( X509_check_trust(v34, 180, 0) == 1 ) { v16 = 1; } else { v16 = 0; ERR_put_error(39, 105, 112, (int)"crypto/ocsp/ocsp_vfy.c", 119); } } LABEL_8: X509_STORE_CTX_free(v17); OPENSSL_sk_pop_free(v19, X509_free); v20 = a2 == 0; if ( a2 ) v20 = a1[9] == 0; if ( !v20 ) OPENSSL_sk_free(v18); return v16; }
GD Web Decomp Icon

GD Web Decomp

Raw Source