git: 442ad83e38e8 - main - crypto: Don't assert on valid IV length for Chacha20-Poly1305.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 09 Nov 2021 18:53:30 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=442ad83e38e8fda46d9facbd1ddd92bc23e3773e commit 442ad83e38e8fda46d9facbd1ddd92bc23e3773e Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2021-11-09 18:52:30 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2021-11-09 18:52:30 +0000 crypto: Don't assert on valid IV length for Chacha20-Poly1305. The assertion checking for valid IV lengths added in 1833d6042c9a was not properly updated to permit an IV length of 8 in commit 42dcd39528c6. Reported by: syzbot+f0c0559b8be1d6eb28c7@syzkaller.appspotmail.com Reviewed by: markj Fixes: 42dcd39528c6 crypto: Support Chacha20-Poly1305 with a nonce size of 8 bytes. MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32860 --- sys/opencrypto/xform_chacha20_poly1305.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/opencrypto/xform_chacha20_poly1305.c b/sys/opencrypto/xform_chacha20_poly1305.c index 47d26dbd1d21..a88a04b28dad 100644 --- a/sys/opencrypto/xform_chacha20_poly1305.c +++ b/sys/opencrypto/xform_chacha20_poly1305.c @@ -55,7 +55,7 @@ chacha20_poly1305_reinit(void *vctx, const uint8_t *iv, size_t ivlen) { struct chacha20_poly1305_cipher_ctx *ctx = vctx; - KASSERT(ivlen == sizeof(ctx->nonce), + KASSERT(ivlen == 8 || ivlen == sizeof(ctx->nonce), ("%s: invalid nonce length", __func__)); /* Block 0 is used for the poly1305 key. */