New macro PSA_ALG_FULL_LENGTH_MAC
Provide a documented way of constructing the full-length MAC algorithm
from a truncated version.
diff --git a/include/psa/crypto.h b/include/psa/crypto.h
index 48c9713..99c4b52 100644
--- a/include/psa/crypto.h
+++ b/include/psa/crypto.h
@@ -803,6 +803,21 @@
(((alg) & ~PSA_ALG_MAC_TRUNCATION_MASK) | \
((mac_length) << PSA_MAC_TRUNCATION_OFFSET & PSA_ALG_MAC_TRUNCATION_MASK))
+/** Macro to build the base MAC algorithm corresponding to a truncated
+ * MAC algorithm.
+ *
+ * \param alg A MAC algorithm identifier (value of type
+ * #psa_algorithm_t such that #PSA_ALG_IS_MAC(\p alg)
+ * is true). This may be a truncated or untruncated
+ * MAC algorithm.
+ *
+ * \return The corresponding base MAC algorithm.
+ * \return Unspecified if \p alg is not a supported
+ * MAC algorithm.
+ */
+#define PSA_ALG_FULL_LENGTH_MAC(alg) \
+ ((alg) & ~PSA_ALG_MAC_TRUNCATION_MASK)
+
/** Length to which a MAC algorithm is truncated.
*
* \param alg A MAC algorithm identifier (value of type