From 44176b00ad983fcd135d9487d6f5b0b6b5982f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Wed, 7 Jun 2023 11:23:26 +0200 Subject: [PATCH] Remove guarantee about converting NONE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Pégourié-Gonnard --- library/md.c | 3 --- library/md_psa.h | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/md.c b/library/md.c index d0ea66b9c..d8066e2a3 100644 --- a/library/md.c +++ b/library/md.c @@ -773,9 +773,6 @@ mbedtls_md_type_t mbedtls_md_get_type(const mbedtls_md_info_t *md_info) #if defined(MBEDTLS_PSA_CRYPTO_C) psa_algorithm_t mbedtls_md_psa_alg_from_type(mbedtls_md_type_t md_type) { - if (md_type == MBEDTLS_MD_NONE) { - return PSA_ALG_NONE; - } return PSA_ALG_CATEGORY_HASH | (psa_algorithm_t) md_type; } diff --git a/library/md_psa.h b/library/md_psa.h index 2f6c7017d..20da5c22b 100644 --- a/library/md_psa.h +++ b/library/md_psa.h @@ -31,7 +31,10 @@ * \brief This function returns the PSA algorithm identifier * associated with the given digest type. * - * \param md_type The type of digest to search for. + * \param md_type The type of digest to search for. Must not be NONE. + * + * \warning If \p md_type is \c MBEDTLS_MD_NONE, this function will + * not return \c PSA_ALG_NONE, but an invalid algorithm. * * \warning This function does not check if the algorithm is * supported, it always returns the corresponding identifier.