* Re: [PATCH] cipher: Allow zero byte input for AEAD cipher
2021-09-10 22:24 [PATCH] cipher: Allow zero byte input for AEAD cipher Inga Stotland
@ 2021-09-10 22:17 ` Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-09-10 22:17 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
Hi Inga,
On 9/10/21 5:24 PM, Inga Stotland wrote:
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] cipher: Allow zero byte input for AEAD cipher
@ 2021-09-10 22:24 Inga Stotland
2021-09-10 22:17 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: Inga Stotland @ 2021-09-10 22:24 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 763 bytes --]
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(-)
diff --git a/ell/cipher.c b/ell/cipher.c
index 866fdb5..6b8528c 100644
--- a/ell/cipher.c
+++ b/ell/cipher.c
@@ -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) {
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-10 22:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 22:24 [PATCH] cipher: Allow zero byte input for AEAD cipher Inga Stotland
2021-09-10 22:17 ` Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).