Move and rename PSA_ALG_AEAD_IS_BASE_EQUAL

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
This commit is contained in:
Bence Szépkúti 2021-04-21 10:33:54 +02:00
parent f5a1fe9392
commit b639d43538
2 changed files with 26 additions and 17 deletions

View file

@ -1175,20 +1175,6 @@
* encoded in #PSA_ALG_AEAD_TAG_LENGTH_MASK. */
#define PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG ((psa_algorithm_t)0x00008000)
/** Macro to test whether two AEAD algorithms correspond to the same base algorithm.
*
* \param aead_alg_1 An AEAD algorithm identifier.
* \param aead_alg_2 An AEAD algorithm identifier.
*
* \return 1 if the base both arguments correspond to the same base
* algorithm, 0 otherwise.
* Unspecified if neither \p aead_alg_1 nor \p aead_alg_2 are
* a supported AEAD algorithm.
*/
#define PSA_ALG_AEAD_IS_BASE_EQUAL(aead_alg_1, aead_alg_2) \
(!(((aead_alg_1) ^ (aead_alg_2)) & \
~(PSA_ALG_AEAD_TAG_LENGTH_MASK | PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG)))
/** Macro to build a shortened AEAD algorithm.
*
* A shortened AEAD algorithm is similar to the corresponding AEAD
@ -2151,4 +2137,27 @@ static inline int mbedtls_svc_key_id_is_null( mbedtls_svc_key_id_t key )
/**@}*/
/** \defgroup helper_macros Helper macros
* @{
*/
/* Helper macros */
/** Check if two AEAD algorithm identifiers refer to the same AEAD algorithm
* regardless of the tag length they encode.
*
* \param aead_alg_1 An AEAD algorithm identifier.
* \param aead_alg_2 An AEAD algorithm identifier.
*
* \return 1 if both identifiers refer to the same AEAD algorithm,
* 0 otherwise.
* Unspecified if neither \p aead_alg_1 nor \p aead_alg_2 are
* a supported AEAD algorithm.
*/
#define MBEDTLS_PSA_ALG_AEAD_EQUAL(aead_alg_1, aead_alg_2) \
(!(((aead_alg_1) ^ (aead_alg_2)) & \
~(PSA_ALG_AEAD_TAG_LENGTH_MASK | PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG)))
/**@}*/
#endif /* PSA_CRYPTO_VALUES_H */