Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Nov 2021 23:12:41 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 7ec9f24cdb88 - stable/13 - crypto: Don't assert on valid IV length for Chacha20-Poly1305.
Message-ID:  <202111232312.1ANNCfDe037409@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=7ec9f24cdb8835dbd383c0b04e2cfda5ccccc38d

commit 7ec9f24cdb8835dbd383c0b04e2cfda5ccccc38d
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-11-09 18:52:30 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-11-23 23:11:34 +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.
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D32860
    
    (cherry picked from commit 442ad83e38e8fda46d9facbd1ddd92bc23e3773e)
---
 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 f593faa9b5ef..9e3414887efc 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. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111232312.1ANNCfDe037409>