// // sub_82EE80 from 0x82ee80 to 0x82f3ac (1324 bytes) // // 1 xrefs: // > @ 0xac0e34 // // 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 sub_82EE80(int a1, _BYTE *a2, int a3, int a4, int a5) { int v7; // r0 int v8; // r7 int *v9; // r8 _DWORD *v10; // r11 int v11; // r0 int v12; // r6 signed int v13; // r6 _BYTE *v14; // r0 bool v15; // zf int v16; // r5 int v17; // r3 int v18; // r9 int v19; // r3 _DWORD *v20; // r0 int v21; // r10 int v22; // r10 int v23; // r0 int v24; // r4 _BYTE *v26; // [sp+10h] [bp-14h] v7 = BN_CTX_new(a1); v8 = v7; if ( !v7 ) { v13 = 0; v26 = nullptr; v24 = -1; goto LABEL_45; } BN_CTX_start(v7); v9 = (int *)BN_CTX_get(v8); v10 = (_DWORD *)BN_CTX_get(v8); v11 = BN_num_bits(*(_DWORD **)(a4 + 16)); v12 = v11 + 7; if ( v11 + 7 < 0 ) v12 = v11 + 14; v13 = v12 >> 3; v14 = CRYPTO_malloc((void *)v13, (int)"crypto/rsa/rsa_ossl.c", 379); v15 = v9 == nullptr; if ( v9 ) v15 = v10 == nullptr; v16 = v15; if ( !v14 ) v16 |= 1u; v26 = v14; if ( v16 ) { ERR_put_error(4, 101, 65, (int)"crypto/rsa/rsa_ossl.c", 381); v24 = -1; goto LABEL_44; } if ( v13 < a1 ) { ERR_put_error(4, 101, 108, (int)"crypto/rsa/rsa_ossl.c", 391); v24 = -1; goto LABEL_44; } if ( !BN_bin2bn(a2, a1, v9) ) goto LABEL_52; if ( BN_ucmp(v9, *(int **)(a4 + 16)) >= 0 ) { ERR_put_error(4, 101, 132, (int)"crypto/rsa/rsa_ossl.c", 401); v24 = -1; goto LABEL_44; } v17 = *(_DWORD *)(a4 + 56); if ( (v17 & 0x80) != 0 ) { v18 = 0; goto LABEL_18; } CRYPTO_THREAD_write_lock(*(_DWORD *)(a4 + 84)); v16 = *(_DWORD *)(a4 + 76); if ( !v16 ) { v16 = RSA_setup_blinding(a4, v8); *(_DWORD *)(a4 + 76) = v16; if ( !v16 ) { CRYPTO_THREAD_unlock(*(_DWORD *)(a4 + 84)); LABEL_59: ERR_put_error(4, 101, 68, (int)"crypto/rsa/rsa_ossl.c", 408); v24 = -1; goto LABEL_44; } } if ( BN_BLINDING_is_current_thread(v16) ) { CRYPTO_THREAD_unlock(*(_DWORD *)(a4 + 84)); v23 = BN_BLINDING_convert_ex(v9, 0, v16, v8); v18 = 0; } else { v16 = *(_DWORD *)(a4 + 80); if ( v16 ) { CRYPTO_THREAD_unlock(*(_DWORD *)(a4 + 84)); } else { v16 = RSA_setup_blinding(a4, v8); *(_DWORD *)(a4 + 80) = v16; CRYPTO_THREAD_unlock(*(_DWORD *)(a4 + 84)); if ( !v16 ) goto LABEL_59; } v18 = BN_CTX_get(v8); if ( !v18 ) { ERR_put_error(4, 101, 65, (int)"crypto/rsa/rsa_ossl.c", 415); v24 = -1; goto LABEL_44; } BN_BLINDING_lock(v16); v22 = BN_BLINDING_convert_ex(v9, v18, v16, v8); BN_BLINDING_unlock(v16); v23 = v22; } if ( !v23 ) goto LABEL_52; v17 = *(_DWORD *)(a4 + 56); LABEL_18: if ( (v17 & 0x20) != 0 || *(_DWORD *)(a4 + 28) && *(_DWORD *)(a4 + 32) && *(_DWORD *)(a4 + 36) && *(_DWORD *)(a4 + 40) && *(_DWORD *)(a4 + 44) ) { if ( (*(int (__fastcall **)(_DWORD *, int *, int, int))(*(_DWORD *)(a4 + 8) + 20))(v10, v9, a4, v8) ) { LABEL_25: if ( !v16 || BN_BLINDING_invert_ex(v10, v18, v16, v8) ) { v19 = BN_bn2bin(v10, v26); switch ( a5 ) { case 1: v24 = RSA_padding_check_PKCS1_type_2(a3, v13, v26, v19, v13); goto LABEL_42; case 2: v24 = RSA_padding_check_SSLv23(a3, v13, v26, v19, v13); goto LABEL_42; case 3: v24 = RSA_padding_check_none(a3, v13, v26, v19, v13); goto LABEL_42; case 4: v24 = RSA_padding_check_PKCS1_OAEP(a3, v13, v26, v19, v13, 0, 0); LABEL_42: if ( v24 < 0 ) ERR_put_error(4, 101, 114, (int)"crypto/rsa/rsa_ossl.c", 477); break; default: ERR_put_error(4, 101, 118, (int)"crypto/rsa/rsa_ossl.c", 473); v24 = -1; break; } goto LABEL_44; } } LABEL_52: v24 = -1; goto LABEL_44; } v20 = (_DWORD *)BN_new(); v21 = (int)v20; if ( !v20 ) { ERR_put_error(4, 101, 65, (int)"crypto/rsa/rsa_ossl.c", 432); v24 = -1; goto LABEL_44; } BN_with_flags(v20, *(int **)(a4 + 24), 4); if ( ((*(_DWORD *)(a4 + 56) & 2) == 0 || BN_MONT_CTX_set_locked((_BYTE **)(a4 + 60), *(_DWORD *)(a4 + 84), *(int ***)(a4 + 16), v8)) && (*(int (__fastcall **)(_DWORD *, int *, int, _DWORD, int, _DWORD))(*(_DWORD *)(a4 + 8) + 24))( v10, v9, v21, *(_DWORD *)(a4 + 16), v8, *(_DWORD *)(a4 + 60)) ) { BN_free(v21); goto LABEL_25; } BN_free(v21); v24 = -1; LABEL_44: BN_CTX_end(v8); LABEL_45: BN_CTX_free(v8); CRYPTO_clear_free(v26, v13, (int)"crypto/rsa/rsa_ossl.c", 483); return v24; }
GD Web Decomp Icon

GD Web Decomp

Raw Source