From nobody Fri Apr 29 20:55:03 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 889DC19943E1; Fri, 29 Apr 2022 20:55:04 +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 4Kql9g5vp8z3FH3; Fri, 29 Apr 2022 20:55:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651265703; 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=OudTQDcS4PJ5zqYqnGzDIQN4Z/WzkMUCrwz8DdidzSQ=; b=jWhALDmrkhhehRH9TAwxeRb6tWaJZEdHTn86LBzaNh9nGkGabEVEwYjSq2Ub62YdE/bSpa PTb5ZnceJyang3QZlzWuiGV5b9ns8ALfl2VvQhglP7+nId/5XPYFg7iefRzmX2hZlHDUN/ FN5fvPXfXRZdvTucgTBgfllef7IkEFSOasVJl2mvcKEHV3Dhx5Hrmp2Fo5QVBrW8cgacHC rr6bPrQ5s/YcudqR8cFNivrXiH9T0nyZRcFLLNa3recd2MNBPTlJo4wKtZkA/qQbtwofWO 9V6rMUznUqpecB8blLAnOXb/PtpJy2T0CcTNfjC60CC4xecgQsr6tA4yb6/ejg== 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 66576140D7; Fri, 29 Apr 2022 20:55:03 +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 23TKt34H055134; Fri, 29 Apr 2022 20:55:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23TKt3pv055133; Fri, 29 Apr 2022 20:55:03 GMT (envelope-from git) Date: Fri, 29 Apr 2022 20:55:03 GMT Message-Id: <202204292055.23TKt3pv055133@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: ff9b4d5d031f - stable/13 - cryptosoft: Reject AES-CCM/GCM sessions with invalid key lengths. 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: ff9b4d5d031f2cf7b53877bcb1adc1cc0d12ec1b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651265703; 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=OudTQDcS4PJ5zqYqnGzDIQN4Z/WzkMUCrwz8DdidzSQ=; b=JzJjOXJGSI97IJrzp4UNXhOn47uIr2B8Kj2YItySbp5AjtQGEu1wyNHpojMrZDfvxAqjWY kMWt3QMynWw3tRuY2rtXHAHASD5uVSqT6Tp2imHMAhe4f1TmTjagaUnCjPPdrst9nvTKxk 3rwVwzGYo9jmZ8INWhBAVpD3sMyKwyDssrZ0zN8BV0cXW2E3Rgd7ofDPfUcFh0Bs12F/a0 xg/vTZPNi1x8+lwDeIBDnjWQB8zmzln90qhvvkSzxlrAuV+zYAV4wuT0ycMNA/zMGpwnft 1W/verNy0XdCobvWiQXpNekul2SYVea8aIU7CzVw5jHISHhb1vBrja0CdvNX2Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651265703; a=rsa-sha256; cv=none; b=yF0JnJGTaOWL36e6ZONg9PWTd7tG27seN1Qqkb2/8I83obCoJGIWD/97O17YW+DnYmqAg7 JxQ1GHmJmNXGiQs0AHl+pnMzQIKEA0QdHrrz/EXYcHuOLo3YTaeRHSR0R/eTPWq9kvFckm L/Ow45ruSfr3gNYZEGiYdA72b0STeABxNXnR7F7e/u6XVoGYPLN17pcYNHs/n8TUx4yq0Y V18Nmc9/E5hr/yZi4rM/w2ixiGzl3EBq0RtQLR7yJIfslJNXHTzCU1RFLwHLLdQ2oAkPpv 7FkeKl/CBI74rmf/18msYlLOlupVFerjh5W6Z89tYM5ivbZo2fgbbupG6vbr+A== 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=ff9b4d5d031f2cf7b53877bcb1adc1cc0d12ec1b commit ff9b4d5d031f2cf7b53877bcb1adc1cc0d12ec1b Author: John Baldwin AuthorDate: 2021-12-09 19:52:41 +0000 Commit: John Baldwin CommitDate: 2022-04-29 20:50:04 +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 (cherry picked from commit c172a407fb0d2e6b4389625ebf604b5a2f831054) --- sys/opencrypto/cryptosoft.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index b6c964b540bc..b77a86e8b93a 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: