mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-22 13:20:50 +00:00
Make MD<->PSA translation static inline
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
parent
44176b00ad
commit
001cbc98bc
10
library/md.c
10
library/md.c
@ -771,16 +771,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)
|
||||
{
|
||||
return PSA_ALG_CATEGORY_HASH | (psa_algorithm_t) md_type;
|
||||
}
|
||||
|
||||
mbedtls_md_type_t mbedtls_md_type_from_psa_alg(psa_algorithm_t psa_alg)
|
||||
{
|
||||
return (mbedtls_md_type_t) (psa_alg & PSA_ALG_HASH_MASK);
|
||||
}
|
||||
|
||||
int mbedtls_md_error_from_psa(psa_status_t status)
|
||||
{
|
||||
return PSA_TO_MBEDTLS_ERR_LIST(status, psa_to_md_errors,
|
||||
|
@ -42,7 +42,10 @@
|
||||
* \return The PSA algorithm identifier associated with \p md_type,
|
||||
* regardless of whether it is supported or not.
|
||||
*/
|
||||
psa_algorithm_t mbedtls_md_psa_alg_from_type(mbedtls_md_type_t md_type);
|
||||
static inline psa_algorithm_t mbedtls_md_psa_alg_from_type(mbedtls_md_type_t md_type)
|
||||
{
|
||||
return PSA_ALG_CATEGORY_HASH | (psa_algorithm_t) md_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief This function returns the given digest type
|
||||
@ -56,7 +59,10 @@ psa_algorithm_t mbedtls_md_psa_alg_from_type(mbedtls_md_type_t md_type);
|
||||
* \return The MD type associated with \p psa_alg,
|
||||
* regardless of whether it is supported or not.
|
||||
*/
|
||||
mbedtls_md_type_t mbedtls_md_type_from_psa_alg(psa_algorithm_t psa_alg);
|
||||
static inline mbedtls_md_type_t mbedtls_md_type_from_psa_alg(psa_algorithm_t psa_alg)
|
||||
{
|
||||
return (mbedtls_md_type_t) (psa_alg & PSA_ALG_HASH_MASK);
|
||||
}
|
||||
|
||||
/** Convert PSA status to MD error code.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user