From 5ad2bfa6c8ea5b0c7adb80c6aa80aeb567811a08 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Tue, 9 Dec 2025 16:15:48 +0100 Subject: [PATCH] library: ssl: adjust return type of mbedtls_psa_alg_from_pk_sigalg() The correct return type should have been "psa_algorithm_t" since the beginning because this is what the function really returns and this is what the returned value is then used for in the calling functions. Change also the returned value in the default case from MBEDTLS_PK_SIGALG_NONE to PSA_ALG_NONE in order to return the same type as in other cases of the switch case. Signed-off-by: Valerio Setti --- library/mbedtls_utils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/mbedtls_utils.h b/library/mbedtls_utils.h index 948b391061..67f74786b3 100644 --- a/library/mbedtls_utils.h +++ b/library/mbedtls_utils.h @@ -5,8 +5,8 @@ #define MBEDTLS_UTILS_H /* Return the PSA algorithm associated to the given combination of "sigalg" and "hash_alg". */ -static inline int mbedtls_psa_alg_from_pk_sigalg(mbedtls_pk_sigalg_t sigalg, - psa_algorithm_t hash_alg) +static inline psa_algorithm_t mbedtls_psa_alg_from_pk_sigalg(mbedtls_pk_sigalg_t sigalg, + psa_algorithm_t hash_alg) { switch (sigalg) { case MBEDTLS_PK_SIGALG_RSA_PKCS1V15: @@ -16,7 +16,7 @@ static inline int mbedtls_psa_alg_from_pk_sigalg(mbedtls_pk_sigalg_t sigalg, case MBEDTLS_PK_SIGALG_ECDSA: return MBEDTLS_PK_ALG_ECDSA(hash_alg); default: - return MBEDTLS_PK_SIGALG_NONE; + return PSA_ALG_NONE; } }