From 7986f7e14bab46b47b7b63485b1bbb719bebf043 Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Tue, 9 Mar 2021 10:03:08 +0100 Subject: [PATCH] psa: Export "internally" mbedtls_cipher_info_from_psa Export "internally" mbedtls_cipher_info_from_psa to be able to use it in psa_crypto_cipher.c. Signed-off-by: Ronald Cron --- library/psa_crypto.c | 2 +- library/psa_crypto_core.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 3c8b97dbe8..94d0c05c27 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -2310,7 +2310,7 @@ psa_status_t psa_hash_clone( const psa_hash_operation_t *source_operation, /* MAC */ /****************************************************************/ -static const mbedtls_cipher_info_t *mbedtls_cipher_info_from_psa( +const mbedtls_cipher_info_t *mbedtls_cipher_info_from_psa( psa_algorithm_t alg, psa_key_type_t key_type, size_t key_bits, diff --git a/library/psa_crypto_core.h b/library/psa_crypto_core.h index ec7ac8049b..f949c7188d 100644 --- a/library/psa_crypto_core.h +++ b/library/psa_crypto_core.h @@ -212,6 +212,22 @@ psa_status_t psa_copy_key_material_into_slot( psa_key_slot_t *slot, */ psa_status_t mbedtls_to_psa_error( int ret ); +/** Get Mbed TLS cipher information given the cipher algorithm PSA identifier + * as well as the PSA type and size of the key to be used with the cipher + * algorithm. + * + * \param alg PSA cipher algorithm identifier + * \param key_type PSA key type + * \param key_bits Size of the key in bits + * \param[out] cipher_id Mbed TLS cipher algorithm identifier + * + * \return The Mbed TLS cipher information of the cipher algorithm. + * \c NULL if the PSA cipher algorithm is not supported. + */ +const mbedtls_cipher_info_t *mbedtls_cipher_info_from_psa( + psa_algorithm_t alg, psa_key_type_t key_type, size_t key_bits, + mbedtls_cipher_id_t *cipher_id ); + /** Import a key in binary format. * * \note The signature of this function is that of a PSA driver