block_cipher: remove useless use of psa_cipher_operation_t

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-12-13 16:34:07 +01:00
parent 1cf81c3c80
commit 849a1abfdd
2 changed files with 2 additions and 10 deletions

View file

@ -25,7 +25,7 @@
#endif #endif
#if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA) #if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA)
#include "psa/crypto.h" #include "psa/crypto_types.h"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
@ -53,7 +53,6 @@ typedef struct {
mbedtls_block_cipher_id_t MBEDTLS_PRIVATE(id); mbedtls_block_cipher_id_t MBEDTLS_PRIVATE(id);
#if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA) #if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA)
mbedtls_block_cipher_engine_t engine; mbedtls_block_cipher_engine_t engine;
psa_cipher_operation_t psa_operation;
psa_key_type_t psa_key_type; psa_key_type_t psa_key_type;
mbedtls_svc_key_id_t psa_key_id; mbedtls_svc_key_id_t psa_key_id;
#endif #endif

View file

@ -12,8 +12,8 @@
#include "common.h" #include "common.h"
#if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA) #if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA)
#include "psa_crypto_core.h"
#include "psa/crypto.h" #include "psa/crypto.h"
#include "psa_crypto_core.h"
#include "psa_util_internal.h" #include "psa_util_internal.h"
#endif #endif
@ -53,7 +53,6 @@ void mbedtls_block_cipher_free(mbedtls_block_cipher_context_t *ctx)
{ {
#if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA) #if defined(MBEDTLS_BLOCK_CIPHER_SOME_PSA)
if (ctx->engine == MBEDTLS_BLOCK_CIPHER_ENGINE_PSA) { if (ctx->engine == MBEDTLS_BLOCK_CIPHER_ENGINE_PSA) {
psa_cipher_abort(&ctx->psa_operation);
psa_destroy_key(ctx->psa_key_id); psa_destroy_key(ctx->psa_key_id);
return; return;
} }
@ -138,12 +137,6 @@ int mbedtls_block_cipher_setkey(mbedtls_block_cipher_context_t *ctx,
} }
psa_reset_key_attributes(&key_attr); psa_reset_key_attributes(&key_attr);
status = psa_cipher_encrypt_setup(&ctx->psa_operation, ctx->psa_key_id,
PSA_ALG_ECB_NO_PADDING);
if (status != PSA_SUCCESS) {
return mbedtls_cipher_error_from_psa(status);
}
return 0; return 0;
} }
#endif /* MBEDTLS_BLOCK_CIPHER_SOME_PSA */ #endif /* MBEDTLS_BLOCK_CIPHER_SOME_PSA */