cipher: Allow zero byte input for AEAD cipher
PATCH 1/1 cipher: Allow zero byte input for AEAD cipher
For AEAD-based cipher, either the plaintext or the associated data may contain zero bytes.
Add extra checks to disallow combinations of NULL input data and nonzero data length.
--- ell/cipher.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
ell/cipher.c +4 -1
@@ -607,7 +607,10 @@ LIB_EXPORT bool l_aead_cipher_encrypt(struct l_aead_cipher *cipher,if (unlikely (!cipher))return false; -if (unlikely (!in) ||unlikely (!out)) +if (unlikely (!in && !ad) ||unlikely (!out)) +return false; + +if (unlikely (!in && in_len) ||unlikely (!ad && ad_len))return false;if (cipher->type ==L_AEAD_CIPHER_AES_CCM ) {
Signature · 1 line
2.31.1
Denis Kenzior
AppliedHi Inga,
Quoted 9 lines · Inga Stotland
For AEAD-based cipher, either the plaintext or the associated data may contain zero bytes.
Add extra checks to disallow combinations of NULL input data and nonzero data length.
--- ell/cipher.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Applied, thanks.
Regards,
-Denis