mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 22:45:48 +01:00
Rework PSA_AEAD_NONCE_LENGTH to reduce expansion
Due to repeated calls to PSA_AEAD_NONCE_LENGTH, which in turn calls PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG several times, some macros updated in this PR expanded to over 6000 characters, more than the 4095 that ISO C99 compilers are guaranteed to support. Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
This commit is contained in:
parent
8072db2fcb
commit
598e92991a
@ -375,11 +375,14 @@
|
||||
*/
|
||||
#define PSA_AEAD_NONCE_LENGTH(key_type, alg) \
|
||||
(PSA_BLOCK_CIPHER_BLOCK_LENGTH(key_type) == 16 ? \
|
||||
PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(alg) == PSA_ALG_CCM ? 13 : \
|
||||
PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(alg) == PSA_ALG_GCM ? 12 : \
|
||||
PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, 0) == \
|
||||
PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, 0) ? 13 : \
|
||||
PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, 0) == \
|
||||
PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_GCM, 0) ? 12 : \
|
||||
0 : \
|
||||
(key_type) == PSA_KEY_TYPE_CHACHA20 && \
|
||||
PSA_ALG_AEAD_WITH_DEFAULT_LENGTH_TAG(alg) == PSA_ALG_CHACHA20_POLY1305 ? 12 : \
|
||||
PSA_ALG_AEAD_WITH_SHORTENED_TAG(alg, 0) == \
|
||||
PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CHACHA20_POLY1305, 0) ? 12 : \
|
||||
0)
|
||||
|
||||
/** The maximum default nonce size among all supported pairs of key types and
|
||||
|
Loading…
Reference in New Issue
Block a user