1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-12-14 02:22:15 +03:00

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 <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti
2025-12-09 16:15:48 +01:00
parent d8f0b37d1a
commit 5ad2bfa6c8

View File

@@ -5,7 +5,7 @@
#define MBEDTLS_UTILS_H #define MBEDTLS_UTILS_H
/* Return the PSA algorithm associated to the given combination of "sigalg" and "hash_alg". */ /* 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, static inline psa_algorithm_t mbedtls_psa_alg_from_pk_sigalg(mbedtls_pk_sigalg_t sigalg,
psa_algorithm_t hash_alg) psa_algorithm_t hash_alg)
{ {
switch (sigalg) { switch (sigalg) {
@@ -16,7 +16,7 @@ static inline int mbedtls_psa_alg_from_pk_sigalg(mbedtls_pk_sigalg_t sigalg,
case MBEDTLS_PK_SIGALG_ECDSA: case MBEDTLS_PK_SIGALG_ECDSA:
return MBEDTLS_PK_ALG_ECDSA(hash_alg); return MBEDTLS_PK_ALG_ECDSA(hash_alg);
default: default:
return MBEDTLS_PK_SIGALG_NONE; return PSA_ALG_NONE;
} }
} }