Skip to content

Commit 98e3730

Browse files
committed
PSA: Reinstate deprecated macro
PSA_ALG_AEAD_WITH_TAG_LENGTH has been replaced with PSA_ALG_AEAD_WITH_SHORTENED_TAG upstream. We could just update psa_util.h to use the new macro, but we still have some targets that only support older versions of PSA, so we reinstate the removed macro.
1 parent c7df122 commit 98e3730

File tree

1 file changed

+23
-0
lines changed
  • platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/include/psa

1 file changed

+23
-0
lines changed

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/include/psa/crypto_values.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,29 @@
12201220
* encoded in #PSA_ALG_AEAD_TAG_LENGTH_MASK. */
12211221
#define PSA_ALG_AEAD_AT_LEAST_THIS_LENGTH_FLAG ((psa_algorithm_t)0x00008000)
12221222

1223+
/** Macro to build a shortened AEAD algorithm.
1224+
*
1225+
* A shortened AEAD algorithm is similar to the corresponding AEAD
1226+
* algorithm, but has an authentication tag that consists of fewer bytes.
1227+
* Depending on the algorithm, the tag length may affect the calculation
1228+
* of the ciphertext.
1229+
*
1230+
* \param aead_alg An AEAD algorithm identifier (value of type
1231+
* #psa_algorithm_t such that #PSA_ALG_IS_AEAD(\p alg)
1232+
* is true).
1233+
* \param tag_length Desired length of the authentication tag in bytes.
1234+
*
1235+
* \return The corresponding AEAD algorithm with the specified
1236+
* length.
1237+
* \return Unspecified if \p alg is not a supported
1238+
* AEAD algorithm or if \p tag_length is not valid
1239+
* for the specified AEAD algorithm.
1240+
*/
1241+
#define PSA_ALG_AEAD_WITH_TAG_LENGTH(aead_alg, tag_length) \
1242+
(((aead_alg) & ~PSA_ALG_AEAD_TAG_LENGTH_MASK) | \
1243+
((tag_length) << PSA_AEAD_TAG_LENGTH_OFFSET & \
1244+
PSA_ALG_AEAD_TAG_LENGTH_MASK))
1245+
12231246
/** Macro to build a shortened AEAD algorithm.
12241247
*
12251248
* A shortened AEAD algorithm is similar to the corresponding AEAD

0 commit comments

Comments
 (0)