git: crypto/chachapoly: Allow output be NULL in decrypting empty plaintext
Aaron LI
aly at crater.dragonflybsd.org
Sat Jan 13 06:01:36 PST 2024
commit 117b0b40069aa1f56a578372cb2e98b7ecd4de31
Author: Aaron LI <aly at aaronly.me>
Date: Mon Jan 8 18:35:41 2024 +0800
crypto/chachapoly: Allow output be NULL in decrypting empty plaintext
Don't distinguish the input cipher data from AD by checking whether the
output buffer is NULL, because it's actually valid to pass it as NULL
when to decrypt a message of empty plaintext. And it's really used by
WireGuard.
So separate the AD process code into a separate helper function named
_chacha20poly1305_update_ad(). Update the assertions to not blindly
assert 'out != NULL'. Also add a note about this special case to the
header file.
Summary of changes:
sys/crypto/chachapoly.c | 73 ++++++++++++++++++++++++++++---------------------
sys/crypto/chachapoly.h | 3 ++
2 files changed, 45 insertions(+), 31 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/117b0b40069aa1f56a578372cb2e98b7ecd4de31
--
DragonFly BSD source repository
More information about the Commits
mailing list