Remove out of scope macros

Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
This commit is contained in:
gabor-mezei-arm 2020-06-17 10:11:11 +02:00
parent 8809fb64eb
commit ee6bb560a6
No known key found for this signature in database
GPG Key ID: 106F5A41ECC305BD
2 changed files with 12 additions and 13 deletions

View File

@ -806,13 +806,14 @@
* a correct size for a key type and cipher algorithm * a correct size for a key type and cipher algorithm
* that it recognizes, but does not support. * that it recognizes, but does not support.
*/ */
#define PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_length) \ #define PSA_CIPHER_ENCRYPT_OUTPUT_SIZE(key_type, alg, input_length) \
(PSA_ALG_IS_CIPHER(alg) && PSA_KEY_TYPE_IS_SYMMETRIC(key_type) ? \ (PSA_ALG_IS_CIPHER(alg) && \
(alg == PSA_ALG_CBC_PKCS7 ? \ ((key_type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_SYMMETRIC ? \
(((input_length) + PSA_CIPHER_IV_LENGTH(key_type, alg) + 1) / \ (alg == PSA_ALG_CBC_PKCS7 ? \
PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) + 1) * \ (((input_length) + PSA_CIPHER_IV_LENGTH(key_type, alg) + 1) / \
PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) : \ PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) + 1) * \
(input_length) + PSA_CIPHER_IV_LENGTH(key_type, alg) ) : \ PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) : \
(input_length) + PSA_CIPHER_IV_LENGTH(key_type, alg) ) : \
0) 0)
/** The maximum size of the output of psa_cipher_decrypt(), in bytes. /** The maximum size of the output of psa_cipher_decrypt(), in bytes.
@ -836,9 +837,10 @@
* a correct size for a key type and cipher algorithm * a correct size for a key type and cipher algorithm
* that it recognizes, but does not support. * that it recognizes, but does not support.
*/ */
#define PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_length) \ #define PSA_CIPHER_DECRYPT_OUTPUT_SIZE(key_type, alg, input_length) \
(PSA_ALG_IS_CIPHER(alg) && PSA_KEY_TYPE_IS_SYMMETRIC(key_type) ? \ (PSA_ALG_IS_CIPHER(alg) && \
(input_length) : \ ((key_type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_SYMMETRIC ? \
(input_length) : \
0) 0)
#endif /* PSA_CRYPTO_SIZES_H */ #endif /* PSA_CRYPTO_SIZES_H */

View File

@ -354,9 +354,6 @@
(((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_RAW || \ (((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_RAW || \
((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_SYMMETRIC) ((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_SYMMETRIC)
/** Whether a key type is symmetric. */
#define PSA_KEY_TYPE_IS_SYMMETRIC(type) \
(((type) & PSA_KEY_TYPE_CATEGORY_MASK) == PSA_KEY_TYPE_CATEGORY_SYMMETRIC)
/** Whether a key type is asymmetric: either a key pair or a public key. */ /** Whether a key type is asymmetric: either a key pair or a public key. */
#define PSA_KEY_TYPE_IS_ASYMMETRIC(type) \ #define PSA_KEY_TYPE_IS_ASYMMETRIC(type) \
(((type) & PSA_KEY_TYPE_CATEGORY_MASK \ (((type) & PSA_KEY_TYPE_CATEGORY_MASK \