From nobody Thu Dec 9 20:17:41 2021 X-Original-To: dev-commits-src-main@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 6294F18DA262; Thu, 9 Dec 2021 20:17: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 4J951d6K8fz4r7N; Thu, 9 Dec 2021 20:17:41 +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 A234C4D6B; Thu, 9 Dec 2021 20:17: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 1B9KHfxF053702; Thu, 9 Dec 2021 20:17:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B9KHftL053701; Thu, 9 Dec 2021 20:17:41 GMT (envelope-from git) Date: Thu, 9 Dec 2021 20:17:41 GMT Message-Id: <202112092017.1B9KHftL053701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c172a407fb0d - main - cryptosoft: Reject AES-CCM/GCM sessions with invalid key lengths. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: c172a407fb0d2e6b4389625ebf604b5a2f831054 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639081062; 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=zTMcjmsgLBAVJdTxFeFnftv/1JEQgo80i97DJRVb5JI=; b=ZHKHPE/c925gUN+akUTHF8HMjmEOlBfXEjdwZ4MbGAk6z5ONaj602KtfeyrAMVgoAbzXjn DG/OR0MmmkF2ACtQG6DPBr7IxXPAvqS/3dvpd0E5/MB7IN5iJpvIBaAsWffU6QpGSZBhyD zTRmbyCYQfEzdDJYFVZSc3gA9/IUU9cbXbxAI8p9zRr9m7Dpb4OsPJ6KQ+9fydJ0Sh/5dY 7KpU+YQVD2QiHMt9BHK8T2M60V5dY2UPjczfNRRcczOFXH7rgYNCYftyF2KkU1imt9ocs8 2QCjUfwXlxbaEikK/pLUKA+tK+diH0V6A91s22atTf0EGYn3ZrrTUfKPKxm82Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639081062; a=rsa-sha256; cv=none; b=IJP8Uy7Y2dGP2+2b67G/5J5DYrVwKAbgb3/3NPeQxD38wDDVe4qAj74siFbXcyw2lWDHJr dElK+nYR1mf5Mm9XQOmoA01U2ueGpN9Xu5Ft1qdczXMoyHZSMkBjY4u1IxHaGX9q63FR+4 l2EAbuP5GjtPs6bESZcW0QZF0xuPoUu4S+ws6UrJ7yhwzWviDYMRMDDZ+C3WUE9w2lSNgW P52ynOFcwOr6oPN0WUA3hOTzA8IS/CuHoI2b38N7BfIzEiAq6adOnWT5tBeZ/LyW2a8O1w Cq+JRrUcp97GblxkmaL2rZcbc4o9T0niTgrBkkBcbu2xpYOuvX/YCQTkyOuf6g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c172a407fb0d2e6b4389625ebf604b5a2f831054 commit c172a407fb0d2e6b4389625ebf604b5a2f831054 Author: John Baldwin AuthorDate: 2021-12-09 19:52:41 +0000 Commit: John Baldwin CommitDate: 2021-12-09 19:52:41 +0000 cryptosoft: Reject AES-CCM/GCM sessions with invalid key lengths. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33195 --- sys/opencrypto/cryptosoft.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 5013cf145288..84caf9d8c676 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1508,6 +1508,15 @@ swcr_probesession(device_t dev, const struct crypto_session_params *csp) switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + switch (csp->csp_cipher_klen * 8) { + case 128: + case 192: + case 256: + break; + default: + return (EINVAL); + } + break; case CRYPTO_CHACHA20_POLY1305: break; default: