Lines Matching refs:hlen
1089 unsigned int hlen; in mgf_mask() local
1108 hlen = mbedtls_md_get_size(md_info); in mgf_mask()
1115 hlen = PSA_HASH_LENGTH(alg); in mgf_mask()
1125 use_len = hlen; in mgf_mask()
1126 if (dlen < hlen) { in mgf_mask()
1191 static int hash_mprime(const unsigned char *hash, size_t hlen, in hash_mprime() argument
1216 if ((ret = mbedtls_md_update(&md_ctx, hash, hlen)) != 0) { in hash_mprime()
1243 if ((status = psa_hash_update(&op, hash, hlen)) != PSA_SUCCESS) { in hash_mprime()
1310 unsigned int hlen; in mbedtls_rsa_rsaes_oaep_encrypt() local
1316 hlen = mbedtls_hash_info_get_size((mbedtls_md_type_t) ctx->hash_id); in mbedtls_rsa_rsaes_oaep_encrypt()
1317 if (hlen == 0) { in mbedtls_rsa_rsaes_oaep_encrypt()
1324 if (ilen + 2 * hlen + 2 < ilen || olen < ilen + 2 * hlen + 2) { in mbedtls_rsa_rsaes_oaep_encrypt()
1333 if ((ret = f_rng(p_rng, p, hlen)) != 0) { in mbedtls_rsa_rsaes_oaep_encrypt()
1337 p += hlen; in mbedtls_rsa_rsaes_oaep_encrypt()
1344 p += hlen; in mbedtls_rsa_rsaes_oaep_encrypt()
1345 p += olen - 2 * hlen - 2 - ilen; in mbedtls_rsa_rsaes_oaep_encrypt()
1352 if ((ret = mgf_mask(output + hlen + 1, olen - hlen - 1, output + 1, hlen, in mbedtls_rsa_rsaes_oaep_encrypt()
1358 if ((ret = mgf_mask(output + 1, hlen, output + hlen + 1, olen - hlen - 1, in mbedtls_rsa_rsaes_oaep_encrypt()
1468 unsigned int hlen; in mbedtls_rsa_rsaes_oaep_decrypt() local
1483 hlen = mbedtls_hash_info_get_size((mbedtls_md_type_t) ctx->hash_id); in mbedtls_rsa_rsaes_oaep_decrypt()
1484 if (hlen == 0) { in mbedtls_rsa_rsaes_oaep_decrypt()
1489 if (2 * hlen + 2 > ilen) { in mbedtls_rsa_rsaes_oaep_decrypt()
1506 if ((ret = mgf_mask(buf + 1, hlen, buf + hlen + 1, ilen - hlen - 1, in mbedtls_rsa_rsaes_oaep_decrypt()
1509 (ret = mgf_mask(buf + hlen + 1, ilen - hlen - 1, buf + 1, hlen, in mbedtls_rsa_rsaes_oaep_decrypt()
1529 p += hlen; /* Skip seed */ in mbedtls_rsa_rsaes_oaep_decrypt()
1532 for (i = 0; i < hlen; i++) { in mbedtls_rsa_rsaes_oaep_decrypt()
1540 for (i = 0; i < ilen - 2 * hlen - 2; i++) { in mbedtls_rsa_rsaes_oaep_decrypt()
1663 size_t slen, min_slen, hlen, offset = 0; in rsa_rsassa_pss_sign() local
1693 hlen = mbedtls_hash_info_get_size((mbedtls_md_type_t) ctx->hash_id); in rsa_rsassa_pss_sign()
1694 if (hlen == 0) { in rsa_rsassa_pss_sign()
1706 min_slen = hlen - 2; in rsa_rsassa_pss_sign()
1707 if (olen < hlen + min_slen + 2) { in rsa_rsassa_pss_sign()
1709 } else if (olen >= hlen + hlen + 2) { in rsa_rsassa_pss_sign()
1710 slen = hlen; in rsa_rsassa_pss_sign()
1712 slen = olen - hlen - 2; in rsa_rsassa_pss_sign()
1714 } else if ((saltlen < 0) || (saltlen + hlen + 2 > olen)) { in rsa_rsassa_pss_sign()
1724 p += olen - hlen - slen - 2; in rsa_rsassa_pss_sign()
1747 ret = mgf_mask(sig + offset, olen - hlen - 1 - offset, p, hlen, in rsa_rsassa_pss_sign()
1756 p += hlen; in rsa_rsassa_pss_sign()
2054 unsigned int hlen; in mbedtls_rsa_rsassa_pss_verify_ext() local
2092 hlen = mbedtls_hash_info_get_size(mgf1_hash_id); in mbedtls_rsa_rsassa_pss_verify_ext()
2093 if (hlen == 0) { in mbedtls_rsa_rsassa_pss_verify_ext()
2112 if (siglen < hlen + 2) { in mbedtls_rsa_rsassa_pss_verify_ext()
2115 hash_start = p + siglen - hlen - 1; in mbedtls_rsa_rsassa_pss_verify_ext()
2117 ret = mgf_mask(p, siglen - hlen - 1, hash_start, hlen, mgf1_hash_id); in mbedtls_rsa_rsassa_pss_verify_ext()
2148 if (memcmp(hash_start, result, hlen) != 0) { in mbedtls_rsa_rsassa_pss_verify_ext()