Unify PSA to Mbed TLS error translation
Move all error translation utilities to psa_util.c.
Introduce macros and functions to avoid having
a local copy of the error translating function in
each place.
Identify overlapping errors and introduce a
generic function.
Provide a single macro for all error translations
(unless one file needs a couple of different ones).
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
diff --git a/library/ssl_misc.h b/library/ssl_misc.h
index 7385c6e..7d08ef4 100644
--- a/library/ssl_misc.h
+++ b/library/ssl_misc.h
@@ -2514,6 +2514,7 @@
psa_key_type_t *key_type,
size_t *key_size);
+#if !defined(MBEDTLS_DEPRECATED_REMOVED)
/**
* \brief Convert given PSA status to mbedtls error code.
*
@@ -2521,7 +2522,7 @@
*
* \return corresponding mbedtls error code
*/
-static inline int psa_ssl_status_to_mbedtls(psa_status_t status)
+static inline MBEDTLS_DEPRECATED int psa_ssl_status_to_mbedtls(psa_status_t status)
{
switch (status) {
case PSA_SUCCESS:
@@ -2542,6 +2543,7 @@
return MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED;
}
}
+#endif /* !MBEDTLS_DEPRECATED_REMOVED */
#endif /* MBEDTLS_USE_PSA_CRYPTO || MBEDTLS_SSL_PROTO_TLS1_3 */
#if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \