Make MD<->PSA translation static inline
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/library/md.c b/library/md.c
index d8066e2..93fe8c5 100644
--- a/library/md.c
+++ b/library/md.c
@@ -771,16 +771,6 @@
}
#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,
diff --git a/library/md_psa.h b/library/md_psa.h
index 20da5c2..8e00bb1 100644
--- a/library/md_psa.h
+++ b/library/md_psa.h
@@ -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 @@
* \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.
*