From 6d40085177f5c2fe5e07df1371bfcd16be56972a Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 24 Feb 2021 21:39:52 +0100 Subject: [PATCH] Don't duplicate the definition of PSA_ALG_IS_HASH_AND_SIGN Signed-off-by: Gilles Peskine --- include/psa/crypto_extra.h | 7 +++---- include/psa/crypto_values.h | 8 +++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/psa/crypto_extra.h b/include/psa/crypto_extra.h index d4a9ee44f..de9d60eda 100644 --- a/include/psa/crypto_extra.h +++ b/include/psa/crypto_extra.h @@ -407,10 +407,9 @@ psa_status_t mbedtls_psa_inject_entropy(const uint8_t *seed, /* We need to expand the sample definition of this macro from * the API definition. */ -#undef PSA_ALG_IS_HASH_AND_SIGN -#define PSA_ALG_IS_HASH_AND_SIGN(alg) \ - (PSA_ALG_IS_RSA_PSS(alg) || PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) || \ - PSA_ALG_IS_DSA(alg) || PSA_ALG_IS_ECDSA(alg)) +#undef PSA_ALG_IS_VENDOR_HASH_AND_SIGN +#define PSA_ALG_IS_VENDOR_HASH_AND_SIGN(alg) \ + PSA_ALG_IS_DSA(alg) /**@}*/ diff --git a/include/psa/crypto_values.h b/include/psa/crypto_values.h index 24b2e180c..a448bc5c9 100644 --- a/include/psa/crypto_values.h +++ b/include/psa/crypto_values.h @@ -1344,6 +1344,11 @@ #define PSA_ALG_IS_RANDOMIZED_ECDSA(alg) \ (PSA_ALG_IS_ECDSA(alg) && !PSA_ALG_ECDSA_IS_DETERMINISTIC(alg)) +/* Default definition, to be overridden if the library is extended with + * more hash-and-sign algorithms that we want to keep out of this header + * file. */ +#define PSA_ALG_IS_VENDOR_HASH_AND_SIGN(alg) 0 + /** Whether the specified algorithm is a hash-and-sign algorithm. * * Hash-and-sign algorithms are asymmetric (public-key) signature algorithms @@ -1359,7 +1364,8 @@ */ #define PSA_ALG_IS_HASH_AND_SIGN(alg) \ (PSA_ALG_IS_RSA_PSS(alg) || PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) || \ - PSA_ALG_IS_ECDSA(alg)) + PSA_ALG_IS_ECDSA(alg) || \ + PSA_ALG_IS_VENDOR_HASH_AND_SIGN(alg)) /** Get the hash used by a hash-and-sign signature algorithm. *