From nobody Mon Oct 25 12:47:46 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 3808E1805010; Mon, 25 Oct 2021 12:47:47 +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 4HdF9G681Mz3CSj; Mon, 25 Oct 2021 12:47:46 +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 AB49AF4D; Mon, 25 Oct 2021 12:47:46 +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 19PClkVk007328; Mon, 25 Oct 2021 12:47:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19PClku1007327; Mon, 25 Oct 2021 12:47:46 GMT (envelope-from git) Date: Mon, 25 Oct 2021 12:47:46 GMT Message-Id: <202110251247.19PClku1007327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d84e0dd2f4e1 - stable/13 - safexcel: Set the context record unconditionally 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d84e0dd2f4e1865f8f99c208cedf9f3e07202d4d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d84e0dd2f4e1865f8f99c208cedf9f3e07202d4d commit d84e0dd2f4e1865f8f99c208cedf9f3e07202d4d Author: Mark Johnston AuthorDate: 2021-10-18 13:40:47 +0000 Commit: Mark Johnston CommitDate: 2021-10-25 12:46:55 +0000 safexcel: Set the context record unconditionally The condition added in commit 5bdb8b273aaf excludes plain SHA transforms, so for such sessions crypto operations would return incorrect results. Fixes: 5bdb8b273aaf ("safexcel: Maintain per-session context records") Sponsored by: The FreeBSD Foundation (cherry picked from commit 36e4dcf47d45bbb87875ee4a9f5cc26a72a9f048) --- sys/dev/safexcel/safexcel.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index 807040a7a1d8..6095787330c1 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -2520,15 +2520,12 @@ safexcel_newsession(device_t dev, crypto_session_t cses, if (csp->csp_auth_mlen != 0) sess->digestlen = csp->csp_auth_mlen; - if ((csp->csp_cipher_alg == 0 || csp->csp_cipher_key != NULL) && - (csp->csp_auth_alg == 0 || csp->csp_auth_key != NULL)) { - sess->encctx.len = safexcel_set_context(&sess->encctx.ctx, - CRYPTO_OP_ENCRYPT, csp->csp_cipher_key, csp->csp_auth_key, - sess); - sess->decctx.len = safexcel_set_context(&sess->decctx.ctx, - CRYPTO_OP_DECRYPT, csp->csp_cipher_key, csp->csp_auth_key, - sess); - } + sess->encctx.len = safexcel_set_context(&sess->encctx.ctx, + CRYPTO_OP_ENCRYPT, csp->csp_cipher_key, csp->csp_auth_key, + sess); + sess->decctx.len = safexcel_set_context(&sess->decctx.ctx, + CRYPTO_OP_DECRYPT, csp->csp_cipher_key, csp->csp_auth_key, + sess); return (0); }