Fix calculation in PSA_AEAD_UPDATE_OUTPUT_SIZE
This commit is contained in:
parent
f02aec90dc
commit
248010caa0
1 changed files with 6 additions and 3 deletions
|
@ -53,6 +53,9 @@
|
||||||
#define PSA_BITS_TO_BYTES(bits) (((bits) + 7) / 8)
|
#define PSA_BITS_TO_BYTES(bits) (((bits) + 7) / 8)
|
||||||
#define PSA_BYTES_TO_BITS(bytes) ((bytes) * 8)
|
#define PSA_BYTES_TO_BITS(bytes) ((bytes) * 8)
|
||||||
|
|
||||||
|
#define PSA_ROUND_UP_TO_MULTIPLE(block_size, length) \
|
||||||
|
(((length) + (block_size) - 1) / (block_size) * (block_size))
|
||||||
|
|
||||||
/** The size of the output of psa_hash_finish(), in bytes.
|
/** The size of the output of psa_hash_finish(), in bytes.
|
||||||
*
|
*
|
||||||
* This is also the hash size that psa_hash_verify() expects.
|
* This is also the hash size that psa_hash_verify() expects.
|
||||||
|
@ -317,8 +320,8 @@
|
||||||
* implementation to delay the output until it has a full block. */
|
* implementation to delay the output until it has a full block. */
|
||||||
#define PSA_AEAD_UPDATE_OUTPUT_SIZE(alg, input_length) \
|
#define PSA_AEAD_UPDATE_OUTPUT_SIZE(alg, input_length) \
|
||||||
(PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) ? \
|
(PSA_ALG_IS_AEAD_ON_BLOCK_CIPHER(alg) ? \
|
||||||
((plaintext_length) + PSA_MAX_BLOCK_CIPHER_BLOCK_SIZE - 1) / PSA_MAX_BLOCK_CIPHER_BLOCK_SIZE : \
|
PSA_ROUND_UP_TO_MULTIPLE(PSA_MAX_BLOCK_CIPHER_BLOCK_SIZE, (input_length)) : \
|
||||||
(plaintext_length))
|
(input_length))
|
||||||
|
|
||||||
/** A sufficient ciphertext buffer size for psa_aead_finish().
|
/** A sufficient ciphertext buffer size for psa_aead_finish().
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue