1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/psa_crypto: fix PSA signing macros

guarding {sign,verify}_{hash,message} functions

see 72718dd87e/include/psa/crypto_values.h\#L1678
This commit is contained in:
Mikolai Gütschow 2023-09-27 16:23:55 +02:00
parent 963775bdd9
commit 335c4f8c0c
No known key found for this signature in database
GPG Key ID: 943E2F37AA659AD5

View File

@ -526,9 +526,9 @@ extern "C" {
* A wildcard signature algorithm policy, using @ref PSA_ALG_ANY_HASH, returns the same
* value as the signature algorithm parameterised with a valid hash algorithm.
*/
#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_HASH_EDDSA(alg))
#define PSA_ALG_IS_HASH_AND_SIGN(alg) \
(PSA_ALG_IS_SIGN_HASH(alg) && \
((alg) & PSA_ALG_HASH_MASK) != 0)
/**
* @brief Whether the specified algorithm is an HKDF algorithm.
@ -746,7 +746,8 @@ extern "C" {
* 0 if alg is not a signature algorithm
*/
#define PSA_ALG_IS_SIGN_HASH(alg) \
PSA_ALG_IS_SIGN(alg)
(PSA_ALG_IS_RSA_PSS(alg) || PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) || \
PSA_ALG_IS_ECDSA(alg) || PSA_ALG_IS_HASH_EDDSA(alg))
/**
* @brief Whether the specified algorithm is a signature algorithm that can be used with
@ -760,8 +761,7 @@ extern "C" {
* 0 if alg is not a signature algorithm.
*/
#define PSA_ALG_IS_SIGN_MESSAGE(alg) \
(PSA_ALG_IS_SIGN(alg) && \
(alg) != PSA_ALG_ECDSA_ANY && (alg) != PSA_ALG_RSA_PKCS1V15_SIGN_RAW)
(PSA_ALG_IS_SIGN_HASH(alg) || (alg) == PSA_ALG_PURE_EDDSA)
/**
* @brief Whether the specified algorithm is a stream cipher.