From ef1fb4a3d31a0972f9a6e8d8fc9acb86aaa9e14c Mon Sep 17 00:00:00 2001 From: Przemek Stekiel Date: Fri, 6 May 2022 10:55:10 +0200 Subject: [PATCH] Deprecate mbedtls_cipher_setup_psa() Signed-off-by: Przemek Stekiel --- include/mbedtls/cipher.h | 12 +++++++++--- library/cipher.c | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/mbedtls/cipher.h b/include/mbedtls/cipher.h index c04097dad..9545cd96a 100644 --- a/include/mbedtls/cipher.h +++ b/include/mbedtls/cipher.h @@ -630,10 +630,16 @@ int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx, const mbedtls_cipher_info_t *cipher_info ); #if defined(MBEDTLS_USE_PSA_CRYPTO) +#if !defined(MBEDTLS_DEPRECATED_REMOVED) /** * \brief This function initializes a cipher context for * PSA-based use with the given cipher primitive. * + * \deprecated This function is deprecated and will be removed in a + * future version of the library. + * Please use psa_aead_xxx() / psa_cipher_xxx() directly + * instead. + * * \note See #MBEDTLS_USE_PSA_CRYPTO for information on PSA. * * \param ctx The context to initialize. May not be \c NULL. @@ -651,9 +657,9 @@ int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx, * \return #MBEDTLS_ERR_CIPHER_ALLOC_FAILED if allocation of the * cipher-specific context fails. */ -int mbedtls_cipher_setup_psa( mbedtls_cipher_context_t *ctx, - const mbedtls_cipher_info_t *cipher_info, - size_t taglen ); +int MBEDTLS_DEPRECATED mbedtls_cipher_setup_psa( mbedtls_cipher_context_t *ctx, + const mbedtls_cipher_info_t *cipher_info, size_t taglen ); +#endif /* MBEDTLS_DEPRECATED_REMOVED */ #endif /* MBEDTLS_USE_PSA_CRYPTO */ /** diff --git a/library/cipher.c b/library/cipher.c index 4c7ca3f57..0bac4ee99 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -219,6 +219,7 @@ int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx, } #if defined(MBEDTLS_USE_PSA_CRYPTO) +#if !defined(MBEDTLS_DEPRECATED_REMOVED) int mbedtls_cipher_setup_psa( mbedtls_cipher_context_t *ctx, const mbedtls_cipher_info_t *cipher_info, size_t taglen ) @@ -248,6 +249,7 @@ int mbedtls_cipher_setup_psa( mbedtls_cipher_context_t *ctx, ctx->psa_enabled = 1; return( 0 ); } +#endif /* MBEDTLS_DEPRECATED_REMOVED */ #endif /* MBEDTLS_USE_PSA_CRYPTO */ int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx,