// // RSA_verify_PKCS1_PSS_mgf1 from 0xdd71d0 to 0xdd79c8 (2040 bytes) // // 3 xrefs: // > sub_DD6C48 @ 0xdd6cd8 // > RSA_verify_PKCS1_PSS @ 0xdd79d8 // > @ 0x79b18 // // 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 // __int64 __fastcall RSA_verify_PKCS1_PSS_mgf1( __int64 a1, __int64 a2, __int64 a3, __int64 a4, unsigned __int8 *a5, int a6) { int **v11; // x24 int v12; // w0 size_t v13; // x25 int v14; // w22 int v15; // w0 unsigned __int8 *v16; // x19 unsigned int v17; // w21 int v19; // w0 int v20; // s8 unsigned __int8 *v21; // d9 unsigned __int8 *v22; // x0 unsigned int v23; // w3 int v24; // w0 unsigned int v25; // w4 unsigned int v26; // w1 int v27; // w2 int8x16_t *v28; // x5 unsigned int v29; // w6 int8x16_t *v30; // x3 int8x16_t *v31; // x9 int8x16_t v32; // t1 int8x16_t v33; // q0 int8x16_t v34; // t1 int v35; // w1 int v36; // w0 int v37; // w5 unsigned __int8 *v38; // x6 int v39; // w4 int v40; // w20 __int64 v41; // x0 int v42; // [xsp+80h] [xbp+80h] _BYTE v43[64]; // [xsp+90h] [xbp+90h] BYREF v11 = (int **)EVP_MD_CTX_new(); if ( !v11 ) goto LABEL_14; if ( !a4 ) a4 = a3; v12 = EVP_MD_size(a3); v13 = v12; if ( v12 < 0 ) { LABEL_14: v16 = nullptr; v17 = 0; goto LABEL_13; } if ( a6 == -1 ) { a6 = v12; } else if ( a6 < -2 ) { v16 = nullptr; ERR_put_error(4, 126, 136, (__int64)"crypto/rsa/rsa_pss.c", 65); v17 = 0; goto LABEL_13; } v14 = ((unsigned __int8)BN_num_bits(*(_QWORD *)(a1 + 32)) - 1) & 7; v15 = RSA_size(a1); if ( ((255 << v14) & *a5) != 0 ) { v16 = nullptr; ERR_put_error(4, 126, 133, (__int64)"crypto/rsa/rsa_pss.c", 72); v17 = 0; goto LABEL_13; } if ( !v14 ) { ++a5; --v15; } if ( v15 <= (int)v13 + a6 + 1 ) { v16 = nullptr; ERR_put_error(4, 126, 109, (__int64)"crypto/rsa/rsa_pss.c", 80); v17 = 0; goto LABEL_13; } if ( a5[v15 - 1] != 188 ) { v16 = nullptr; v17 = 0; ERR_put_error(4, 126, 134, (__int64)"crypto/rsa/rsa_pss.c", 84); goto LABEL_13; } v19 = v15 - v13; v42 = v19 - 1; v20 = v19; v21 = &a5[v19 - 1]; v22 = (unsigned __int8 *)CRYPTO_malloc((void *)(v19 - 1), (__int64)"crypto/rsa/rsa_pss.c", 89); v16 = v22; if ( !v22 ) { v17 = 0; ERR_put_error(4, 126, 65, (__int64)"crypto/rsa/rsa_pss.c", 91); goto LABEL_13; } if ( (PKCS1_MGF1(v22, v42, v21, v13, a4) & 0x80000000) != 0 ) { v17 = 0; goto LABEL_13; } if ( v42 > 0 ) { if ( a5 < v16 + 16 && v16 < a5 + 16 || (unsigned int)v42 <= 0x12 ) { v41 = 0; do { v16[v41] ^= a5[v41]; ++v41; } while ( v42 > (int)v41 ); goto LABEL_59; } v23 = -(int)v16 & 0xF; if ( v23 > v42 ) v23 = v42; if ( v23 ) { *v16 ^= *a5; if ( v23 != 1 ) { v16[1] ^= a5[1]; if ( v23 == 2 ) { v24 = 2; goto LABEL_40; } v16[2] ^= a5[2]; if ( v23 != 3 ) { v16[3] ^= a5[3]; if ( v23 != 4 ) { v16[4] ^= a5[4]; if ( v23 != 5 ) { v16[5] ^= a5[5]; if ( v23 != 6 ) { v16[6] ^= a5[6]; if ( v23 != 7 ) { v16[7] ^= a5[7]; if ( v23 != 8 ) { v16[8] ^= a5[8]; if ( v23 != 9 ) { v16[9] ^= a5[9]; if ( v23 != 10 ) { v16[10] ^= a5[10]; if ( v23 != 11 ) { v16[11] ^= a5[11]; if ( v23 != 12 ) { v16[12] ^= a5[12]; if ( v23 != 13 ) { v16[13] ^= a5[13]; if ( v23 == 15 ) { v24 = 15; v16[14] ^= a5[14]; } else { v24 = 14; } goto LABEL_40; } goto LABEL_78; } v24 = 12; LABEL_40: v25 = v42 - v23; v26 = ((v42 - v23 - 16) >> 4) + 1; v27 = 16 * v26; if ( v20 - 2 - v23 <= 0xE ) goto LABEL_95; v28 = (int8x16_t *)&v16[v23]; v29 = 0; v30 = (int8x16_t *)&a5[v23]; v31 = v28; do { v32 = *v30++; v33 = v32; ++v29; v34 = *v28++; *v31++ = veorq_s8(v33, v34); } while ( v29 < v26 ); v24 += v27; if ( v25 != v27 ) { LABEL_95: v16[v24] ^= a5[v24]; if ( v42 > v24 + 1 ) { v16[v24 + 1] ^= a5[v24 + 1]; if ( v42 > v24 + 2 ) { v16[v24 + 2] ^= a5[v24 + 2]; if ( v42 > v24 + 3 ) { v16[v24 + 3] ^= a5[v24 + 3]; if ( v42 > v24 + 4 ) { v16[v24 + 4] ^= a5[v24 + 4]; if ( v42 > v24 + 5 ) { v16[v24 + 5] ^= a5[v24 + 5]; if ( v42 > v24 + 6 ) { v16[v24 + 6] ^= a5[v24 + 6]; if ( v42 > v24 + 7 ) { v16[v24 + 7] ^= a5[v24 + 7]; if ( v42 > v24 + 8 ) { v16[v24 + 8] ^= a5[v24 + 8]; if ( v42 > v24 + 9 ) { v16[v24 + 9] ^= a5[v24 + 9]; if ( v42 > v24 + 10 ) { v16[v24 + 10] ^= a5[v24 + 10]; if ( v42 > v24 + 11 ) { v16[v24 + 11] ^= a5[v24 + 11]; if ( v42 > v24 + 12 ) { v35 = v24 + 13; v16[v24 + 12] ^= a5[v24 + 12]; if ( v42 > v24 + 13 ) { v36 = v24 + 14; v16[v35] ^= a5[v35]; if ( v42 > v36 ) v16[v36] ^= a5[v36]; } } } } } } } } } } } } } } goto LABEL_59; } } } } } } } } } } } LABEL_78: v24 = v23; goto LABEL_40; } LABEL_59: if ( v14 ) { v37 = (unsigned __int8)((255 >> (8 - v14)) & *v16); *v16 = v37; } else { v37 = *v16; } if ( v37 ) { v40 = 1; } else { if ( v20 <= 2 ) { LABEL_86: v17 = 0; ERR_put_error(4, 126, 135, (__int64)"crypto/rsa/rsa_pss.c", 102); goto LABEL_13; } v38 = v16 + 1; v39 = 0; while ( 1 ) { v37 = *v38; ++v39; ++v38; if ( v37 ) break; if ( v39 == v20 - 2 ) goto LABEL_86; } v40 = v39 + 1; } if ( v37 != 1 ) goto LABEL_86; if ( a6 < 0 || v42 - v40 == a6 ) { v17 = 0; if ( (unsigned int)EVP_DigestInit_ex((__int64 *)v11, a3, 0) && (unsigned int)EVP_DigestUpdate((__int64)v11) && (unsigned int)EVP_DigestUpdate((__int64)v11) && (v42 == v40 || (unsigned int)EVP_DigestUpdate((__int64)v11)) ) { v17 = 0; if ( (unsigned int)EVP_DigestFinal_ex(v11, (__int64)v43, nullptr) ) { v17 = 1; if ( memcmp(v43, v21, v13) ) { v17 = 0; ERR_put_error(4, 126, 104, (__int64)"crypto/rsa/rsa_pss.c", 120); } } } } else { v17 = 0; ERR_put_error(4, 126, 136, (__int64)"crypto/rsa/rsa_pss.c", 106); } LABEL_13: CRYPTO_free(v16, (__int64)"crypto/rsa/rsa_pss.c", 126); EVP_MD_CTX_free((__int64 *)v11); return v17; }
GD Web Decomp Icon

GD Web Decomp

Raw Source