From nobody Tue Nov 23 23:12:41 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6431918A115D; Tue, 23 Nov 2021 23:12:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HzKfy029Qz3vgG; Tue, 23 Nov 2021 23:12:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D61F71F721; Tue, 23 Nov 2021 23:12:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ANNCfPi037410; Tue, 23 Nov 2021 23:12:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ANNCfDe037409; Tue, 23 Nov 2021 23:12:41 GMT (envelope-from git) Date: Tue, 23 Nov 2021 23:12:41 GMT Message-Id: <202111232312.1ANNCfDe037409@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 7ec9f24cdb88 - stable/13 - crypto: Don't assert on valid IV length for Chacha20-Poly1305. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7ec9f24cdb8835dbd383c0b04e2cfda5ccccc38d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1637709162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=49r0hzhHimXpPYsZzRaJm8qxU/cb9VSB/SA5Swd4dBs=; b=in1rBahYEZJAQLM0zssjgzLTsd6RMTbp+mw2NsMc7KIwZNNa1CS63lhjFhsHb1DRq6F1SX jMr+4dxgJRCPfH946zCxX1GNSS9LguMVZAfctS+V4NhFy08RlyhKpk8+68pVY2AL1X98Qi HE+zu9Biu8IsTPag7A/LD6ApP2dpd82wpyG7GQm6o3Txy9E+uyRyHA7aRZVWzCFxW5vhnb +BgHbmwSxgIzd+k+mvVQcrxuf4PPNfKi21Nk/Uhe7J1nFbqhHUgBu3PKJZN9OwszEeVEkY IdKxb4hePNlDlnuToiGNL86Qdsfq1xf6N0IWIiA5O+s1wPEX3eBXFUF7LGfZlw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1637709162; a=rsa-sha256; cv=none; b=vYhCYZz1y+8pamDEmLy6Q094h5hEBuslawo1HpjkuQkTzWEgNRItRiMVjlV0nXrhBWUakV S08QxGUeM95nO4D3r8ZYcaBixabbCV8AZYVrYTnZ3DOh9DnLTcr9WIWgGet6kOnYiFQ2+Q 6A9qWYjVIyPnJPDZ24Dx1L/kXmg79WMuPQMbyiLqeFNsTGlwBd0SuIGWoKsGK6MY56Y7a0 cO9gbT4c7LFGT0Tu8tVLUoowc1Z2FFyNC1uKJ0yLG2XfObQtMqjkEjF33sdOhYTyrNR6y2 gdOeaNH23W871qsZF45XIOeBgWamminc/FjwbobFTQkjHiS0WAPZrBQszwDi5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7ec9f24cdb8835dbd383c0b04e2cfda5ccccc38d commit 7ec9f24cdb8835dbd383c0b04e2cfda5ccccc38d Author: John Baldwin AuthorDate: 2021-11-09 18:52:30 +0000 Commit: John Baldwin 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. */