From aa0c91714023244a8db093b7049390c2a2dcc771 Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Fri, 14 May 2021 15:49:19 +0100 Subject: [PATCH] psa: Add PSA_ALG_ECB_NO_PADDING to TF-M v1.0 TF-M v1.0 implements an older version of PSA and does not have the macro `PSA_ALG_ECB_NO_PADDING` required by `mbedtls_psa_translate_cipher_mode()` in Mbed TLS v2.25.0. Copy this macro from Mbed TLS to fix the issue. --- .../include/psa/crypto_values.h | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_0/include/psa/crypto_values.h b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_0/include/psa/crypto_values.h index bc466a3403..a7587fe605 100644 --- a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_0/include/psa/crypto_values.h +++ b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_0/include/psa/crypto_values.h @@ -985,6 +985,26 @@ */ #define PSA_ALG_CBC_NO_PADDING ((psa_algorithm_t)0x04600100) +/** The Electronic Code Book (ECB) mode of a block cipher, with no padding. + * + * \warning ECB mode does not protect the confidentiality of the encrypted data + * except in extremely narrow circumstances. It is recommended that applications + * only use ECB if they need to construct an operating mode that the + * implementation does not provide. Implementations are encouraged to provide + * the modes that applications need in preference to supporting direct access + * to ECB. + * + * The underlying block cipher is determined by the key type. + * + * This symmetric cipher mode can only be used with messages whose lengths are a + * multiple of the block size of the chosen block cipher. + * + * ECB mode does not accept an initialization vector (IV). When using a + * multi-part cipher operation with this algorithm, psa_cipher_generate_iv() + * and psa_cipher_set_iv() must not be called. + */ +#define PSA_ALG_ECB_NO_PADDING ((psa_algorithm_t)0x04404400) + /** The CBC block cipher chaining mode with PKCS#7 padding. * * The underlying block cipher is determined by the key type.