From nobody Wed Jul 13 16:47:51 2022 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 0EB0117FD68A; Wed, 13 Jul 2022 16:47:52 +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 4Ljk7q2mgFz3WwW; Wed, 13 Jul 2022 16:47:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657730871; 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=r2mcqIsXnnccLGL67AFQz2IjSOGNH7GY2qsucW0JyuY=; b=Dn+WkMhi0qwoyeX77oQjDcDBmS4orTssHu/SH+QyNbOqd5RztzDmYcoUT8cFXMysj4lQmM edWPxXXW3x1KSLYCRKsospIcPJ0xjgF3mO/WTXEEC1BeqnKqIpaHGPC7vcu4S+CJPN00w0 TrA98kKpNGwmBFWZoAB+YCOU9K4FX0znqgAS+danuCWMCtNaeq+GEH+Gx5N6ig2Bi4HDgp 758npCzuyzLBtj3aIUtT6ClKnoJ8oOhaiYel0RzlWwVydz4blBOyRcHYvDh6x8xLXDuWSU Yp6eCDDNpmgVCxz+wkyqanKiEZJTLEIk1erAyKZ69EltaXRQ6Oiid2sytcMJmg== 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 4Ljk7q1ZDHzVLL; Wed, 13 Jul 2022 16:47:51 +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 26DGlpVe052479; Wed, 13 Jul 2022 16:47:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26DGlpGf052478; Wed, 13 Jul 2022 16:47:51 GMT (envelope-from git) Date: Wed, 13 Jul 2022 16:47:51 GMT Message-Id: <202207131647.26DGlpGf052478@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: b53f356918f8 - stable/13 - crypto: Fix assertions for digest-only sessions with separate output. 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: b53f356918f872063b098741e797b8ebea3d03b9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657730871; 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=r2mcqIsXnnccLGL67AFQz2IjSOGNH7GY2qsucW0JyuY=; b=x2WO8I6HLmK+fj+UBsO/84Jj6szF9J387rrm0JzIBpH7bzrtrQ/uC3jdlZPERjn+2oIBzN +JjPRuWrx16QFEb610i5F8S5yc01fbQ9Cn2g2Xl4dYnxlNr5Q+oWTto7NLs8b/kMGlkUaY Ygo5IN2B2toomiQdZyzD93tz5fGd3gwSHjEGe0zonL8bh6fSc7hZtdrFMPHf4QP2cWbskt sNOITfVuKpZZw9l98mczZ/Q0CTVsvbvDBXVym+FrxydCVc3kdR8l23WptnlMTZq+JJT9UJ V6Hn75D/w3sg8/Ar/Bgn378QnCikeeXsBasfdPRAQpk7b5kNZ3TU4kYrnqZtrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657730871; a=rsa-sha256; cv=none; b=JX1E1x8P76M1Tvr86bvW4/T+lewf3VArLjeTxCO86OXXXbH6/FTg7MwzhIQ6ZPKGQK/Dux yBei5Ptx6vnqFiqjTE2xtuCk0O7nP5Fny8Ol9EAJ96Av+3JGW/qDZzHy9WRhMMFq1Ojdt3 RogHe0/qWEBRux82TsL6L/Mo7glZm7S/5dJVialJlCN3ictO1tNe1vAWrl0qqW8uxzhlEm n0V8rz5tnR2KOyYZchP8itQ7ZVoUl+ZJdUJatZlbLFRa319E1p4qTWci8aScGvbyBsdoDU O1Mbvt+ndZ64U6NM1tOO2McsYdeI6j0vTVBMAwt7KkAl5p/GPnWz7fb6cyrZxw== 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=b53f356918f872063b098741e797b8ebea3d03b9 commit b53f356918f872063b098741e797b8ebea3d03b9 Author: John Baldwin AuthorDate: 2022-06-30 17:10:00 +0000 Commit: John Baldwin CommitDate: 2022-07-13 16:25:14 +0000 crypto: Fix assertions for digest-only sessions with separate output. Digest-only sessions do not generate modified payload as an output, so don't bother asserting anything about the payload with respect to the output buffer other than the payload output start being zero. In addition, a verify request on a digest-only session doesn't generate any output at all so should never have a separate output buffer. PR: 252316 Reviewed by: markj Co-authored-by: Jeremy Faulkner MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35578 (cherry picked from commit c71f2370c5d480cf70f12ee276e044681c57aefc) --- sys/opencrypto/crypto.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 1c5074e847ed..c9ba66650807 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -1423,6 +1423,11 @@ crp_sanity(struct cryptop *crp) if (out == NULL) { KASSERT(crp->crp_payload_output_start == 0, ("payload output start non-zero without output buffer")); + } else if (csp->csp_mode == CSP_MODE_DIGEST) { + KASSERT(!(crp->crp_op & CRYPTO_OP_VERIFY_DIGEST), + ("digest verify with separate output buffer")); + KASSERT(crp->crp_payload_output_start == 0, + ("digest operation with non-zero payload output start")); } else { KASSERT(crp->crp_payload_output_start == 0 || crp->crp_payload_output_start < olen,