// // RSA_padding_check_PKCS1_OAEP_mgf1 from 0xe6b9c8 to 0xe6c48c (2756 bytes) // // 3 xrefs: // > sub_DD7090 @ 0xdd717c // > RSA_padding_check_PKCS1_OAEP @ 0xe6c4a0 // > @ 0x701e8 // // 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_padding_check_PKCS1_OAEP_mgf1( void *a1, int a2, const void *a3, int a4, int a5, __int64 a6, int a7, __int64 a8, __int64 a9) { __int64 v9; // x22 __int64 v16; // x21 int v17; // w0 int v18; // w26 unsigned __int8 *v19; // x20 unsigned __int8 *v20; // x25 int v21; // w23 int v23; // s11 __int64 v24; // d10 size_t v25; // d8 unsigned __int8 *v26; // x0 size_t v27; // x2 const void *v28; // x1 __int64 v29; // x24 int v30; // s8 signed int v31; // w0 int v32; // w1 int v33; // w0 unsigned int v34; // w1 int v35; // w3 unsigned int v36; // w4 unsigned int v37; // w2 int v38; // w0 int8x16_t *v39; // x10 int8x16_t *v40; // x1 int8x16_t *v41; // x11 unsigned int v42; // w5 int8x16_t v43; // t1 int8x16_t v44; // q0 int8x16_t v45; // t1 int v46; // w0 int v47; // w0 int v48; // w5 unsigned __int8 *v49; // x3 int v50; // w1 int i; // w7 int v52; // t1 int v53; // w6 int v54; // w4 int v55; // w6 int v56; // w1 void *v57; // x0 __int64 v58; // x4 __int64 v59; // x0 int v60; // [xsp+80h] [xbp+80h] int v61; // [xsp+90h] [xbp+90h] int v62; // [xsp+90h] [xbp+90h] int v63; // [xsp+A0h] [xbp+A0h] unsigned __int8 *v64; // [xsp+A0h] [xbp+A0h] int v65; // [xsp+A8h] [xbp+A8h] int v66; // [xsp+A8h] [xbp+A8h] int8x16_t v67; // [xsp+B0h] [xbp+B0h] BYREF int8x16_t v68; // [xsp+C0h] [xbp+C0h] BYREF int8x16_t v69; // [xsp+D0h] [xbp+D0h] int8x16_t v70; // [xsp+E0h] [xbp+E0h] unsigned __int8 v71[64]; // [xsp+F0h] [xbp+F0h] BYREF v9 = a8; v16 = a9; if ( !a8 ) { v66 = a7; v57 = EVP_sha1(); a7 = v66; v9 = (__int64)v57; } if ( !a9 ) v16 = v9; v65 = a7; v17 = EVP_MD_size(v9); v18 = v17; if ( a2 > 0 && a4 > 0 ) { if ( a4 > a5 || a5 < 2 * (v17 + 1) ) { v19 = nullptr; v20 = nullptr; goto LABEL_10; } v23 = a5 - v17; v24 = a5 - v17 - 1; v25 = a5; v61 = v17 + 1; v63 = a5 - v17 - 1; v20 = (unsigned __int8 *)CRYPTO_malloc((void *)v24, (__int64)"crypto/rsa/rsa_oaep.c", 153); v26 = (unsigned __int8 *)CRYPTO_malloc((void *)a5, (__int64)"crypto/rsa/rsa_oaep.c", 154); v19 = v26; if ( !v26 || !v20 ) { v21 = -1; ERR_put_error(4, 153, 65, (__int64)"crypto/rsa/rsa_oaep.c", 156); goto LABEL_11; } v60 = v61; memset(v26, 0, v25); v27 = a4; v28 = a3; v21 = -1; v29 = v18 + 1LL; memcpy(&v19[v25 - v27], v28, v27); v30 = *v19; if ( (unsigned int)PKCS1_MGF1((__int64)&v67, v18, (__int64)&v19[v29], v24, v16) ) goto LABEL_11; if ( v18 > 0 ) { if ( (&v67 >= (int8x16_t *)(v19 + 17) || &v68 <= (int8x16_t *)(v19 + 1)) && (unsigned int)v18 > 0xF ) { v31 = 16 * (((unsigned int)(v18 - 16) >> 4) + 1); v67 = veorq_s8(*(int8x16_t *)(v19 + 1), v67); if ( (unsigned int)(v18 - 16) >> 4 ) { v68 = veorq_s8(*(int8x16_t *)(v19 + 17), v68); if ( (unsigned int)(v18 - 16) >> 4 != 1 ) { v69 = veorq_s8(*(int8x16_t *)(v19 + 33), v69); if ( (unsigned int)(v18 - 16) >> 4 != 2 ) v70 = veorq_s8(*(int8x16_t *)(v19 + 49), v70); } } if ( v18 != v31 ) { v67.n128_u8[v31] ^= v19[v31 + 1]; if ( v18 > v31 + 1 ) { v67.n128_u8[v31 + 1] ^= v19[v31 + 2]; if ( v18 > v31 + 2 ) { v67.n128_u8[v31 + 2] ^= v19[v31 + 3]; if ( v18 > v31 + 3 ) { v67.n128_u8[v31 + 3] ^= v19[v31 + 4]; if ( v18 > v31 + 4 ) { v67.n128_u8[v31 + 4] ^= v19[v31 + 5]; if ( v18 > v31 + 5 ) { v67.n128_u8[v31 + 5] ^= v19[v31 + 6]; if ( v18 > v31 + 6 ) { v67.n128_u8[v31 + 6] ^= v19[v31 + 7]; if ( v18 > v31 + 7 ) { v67.n128_u8[v31 + 7] ^= v19[v31 + 8]; if ( v18 > v31 + 8 ) { v67.n128_u8[v31 + 8] ^= v19[v31 + 9]; if ( v18 > v31 + 9 ) { v67.n128_u8[v31 + 9] ^= v19[v31 + 10]; if ( v18 > v31 + 10 ) { v67.n128_u8[v31 + 10] ^= v19[v31 + 11]; if ( v18 > v31 + 11 ) { v67.n128_u8[v31 + 11] ^= v19[v31 + 12]; if ( v18 > v31 + 12 ) { v32 = v31 + 13; v67.n128_u8[v31 + 12] ^= v19[v31 + 13]; if ( v18 > v31 + 13 ) { v33 = v31 + 14; v67.n128_u8[v32] ^= v19[v32 + 1]; if ( v18 > v33 ) v67.n128_u8[v33] ^= v19[v33 + 1]; } } } } } } } } } } } } } } } else { v58 = 0; do { v67.n128_u8[v58] ^= v19[v58 + 1]; ++v58; } while ( v58 != (unsigned int)(v18 - 1) + 1LL ); } } v62 = v63; v21 = -1; v64 = &v19[v29]; if ( (unsigned int)PKCS1_MGF1((__int64)v20, v24, (__int64)&v67, v18, v16) ) goto LABEL_11; if ( v62 > 0 ) { if ( (v64 >= v20 + 16 || v20 >= &v19[v18 + 17]) && (unsigned int)v62 > 0x12 ) { v34 = -(int)v20 & 0xF; if ( v62 <= v34 ) v34 = v62; if ( !v34 ) goto LABEL_89; *v20 ^= *v64; if ( v34 == 1 ) goto LABEL_89; v20[1] ^= v64[1]; if ( v34 == 2 ) goto LABEL_89; v20[2] ^= v64[2]; if ( v34 == 3 ) goto LABEL_89; v20[3] ^= v64[3]; if ( v34 == 4 ) goto LABEL_89; v20[4] ^= v64[4]; if ( v34 == 5 ) { v35 = 5; goto LABEL_60; } v20[5] ^= v64[5]; if ( v34 == 6 || (v20[6] ^= v64[6], v34 == 7) || (v20[7] ^= v64[7], v34 == 8) || (v20[8] ^= v64[8], v34 == 9) || (v20[9] ^= v64[9], v34 == 10) || (v20[10] ^= v64[10], v34 == 11) || (v20[11] ^= v64[11], v34 == 12) || (v20[12] ^= v64[12], v34 == 13) ) { LABEL_89: v35 = v34; } else { v20[13] ^= v64[13]; if ( v34 == 15 ) { v35 = 15; v20[14] ^= v64[14]; } else { v35 = 14; } } LABEL_60: v36 = v62 - v34; v37 = ((v62 - v34 - 16) >> 4) + 1; v38 = 16 * v37; if ( v23 - 2 - v34 <= 0xE ) goto LABEL_64; v39 = (int8x16_t *)&v20[v34]; v40 = (int8x16_t *)&v19[v29 + v34]; v41 = v39; v42 = 0; do { v43 = *v40++; v44 = v43; ++v42; v45 = *v41++; *v39++ = veorq_s8(v44, v45); } while ( v37 > v42 ); v35 += v38; if ( v38 != v36 ) { LABEL_64: v20[v35] ^= v64[v35]; if ( v62 > v35 + 1 ) { v20[v35 + 1] ^= v64[v35 + 1]; if ( v62 > v35 + 2 ) { v20[v35 + 2] ^= v64[v35 + 2]; if ( v62 > v35 + 3 ) { v20[v35 + 3] ^= v64[v35 + 3]; if ( v62 > v35 + 4 ) { v20[v35 + 4] ^= v64[v35 + 4]; if ( v62 > v35 + 5 ) { v20[v35 + 5] ^= v64[v35 + 5]; if ( v62 > v35 + 6 ) { v20[v35 + 6] ^= v64[v35 + 6]; if ( v62 > v35 + 7 ) { v20[v35 + 7] ^= v64[v35 + 7]; if ( v62 > v35 + 8 ) { v20[v35 + 8] ^= v64[v35 + 8]; if ( v62 > v35 + 9 ) { v20[v35 + 9] ^= v64[v35 + 9]; if ( v62 > v35 + 10 ) { v20[v35 + 10] ^= v64[v35 + 10]; if ( v62 > v35 + 11 ) { v20[v35 + 11] ^= v64[v35 + 11]; if ( v62 > v35 + 12 ) { v20[v35 + 12] ^= v64[v35 + 12]; if ( v62 > v35 + 13 ) { v20[v35 + 13] ^= v64[v35 + 13]; if ( v62 > v35 + 14 ) v20[v35 + 14] ^= v64[v35 + 14]; } } } } } } } } } } } } } } goto LABEL_79; } v59 = 0; do { v20[v59] ^= v64[v59]; ++v59; } while ( v62 > (int)v59 ); } LABEL_79: v21 = -1; if ( !(unsigned int)EVP_Digest(a6, v65, (__int64)v71, nullptr, v9, 0) ) goto LABEL_11; v46 = CRYPTO_memcmp(v20, v71, v18); v47 = (((v30 - 1) & ~v30) >> 31) & (((v46 - 1) & ~v46) >> 31); if ( v18 < v62 ) { v48 = 0; v49 = &v20[v18]; v50 = 0; for ( i = v60; ; ++i ) { v52 = *v49++; v53 = (((v52 ^ 1) - 1) & ~(v52 ^ 1)) >> 31; v54 = v53 & ~v48; v48 |= v53; v55 = v54 & v18; v18 = i; v50 = v50 & ~v54 | v55; v47 &= v48 | (((v52 - 1) & ~v52) >> 31); if ( i == v62 ) break; } if ( (v48 & v47) != 0 ) { v56 = v50 + 1; v21 = i - v56; if ( a2 >= i - v56 ) { memcpy(a1, &v20[v56], v21); goto LABEL_11; } ERR_put_error(4, 153, 109, (__int64)"crypto/rsa/rsa_oaep.c", 223); } } LABEL_10: v21 = -1; ERR_put_error(4, 153, 121, (__int64)"crypto/rsa/rsa_oaep.c", 236); LABEL_11: CRYPTO_free(v20, (__int64)"crypto/rsa/rsa_oaep.c", 238); CRYPTO_free(v19, (__int64)"crypto/rsa/rsa_oaep.c", 239); return (unsigned int)v21; } return 0xFFFFFFFFLL; }
GD Web Decomp Icon

GD Web Decomp

Raw Source