From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=180.181.231.80 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796360831; b=SIV2cIX2zUcYM9mdEm/UEAWYVi65ZzbyNARH6DbKEwNyVjdV8EjX9Ojr5euzbjU2GS7K dwZh65+fyhKQb/gml4YQWk6RmZkGrwnYJbJujYsFzr11Z3H2yqVjBQo3iEu7JnY1nY42a kc5s73b8sB+YKKyL8mZd+0wzVQLnHN7bb4MZSXhUluhY5fqlZIpnBkw7Kos67xk2DfSZ4 N8NYGLf/ZoPHfjnTTTF2KISVqJOh0J2P3VkRnG78hu/fDvcgaOthLyatpwZ4Qwknt9JP1 7OLPV+3HESF3w70Anzd8zb2ea7NSEL4FqSEFHCuBVCeVQHXmFGD8R5F+SEa3vrgZ8/Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796360831; h=DMARC-Filter:DKIM-Signature:Received:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=BYWgdB5inZJrGjD5Gr5FNWwSJy1g/JPmvzssq/QfoGk=; b=OcdWmGKQ5mEG+JCLwJcjdfobVuuak/zbFLlQ/NH9TUNu1fcrhHTdrMaa53nqOB1LPUL0 dZHbtQq3cMokmr1wG35Zxck+Gt2AO0/1wfhGWQeHzO63NuDO5gXV4RKPUa44YmKIbJHTO 0soMNUnMM7LlLTq+Mw46le6X6S4puWfs7FUbdduCqBHv7tmxTej64SOA5ppfYyBvuL5T+ z4mEz2ipbzYsUxqIFbp309Nl6y0Nd7iWHHI8l9Ye68v1rdr2C4WAEXh6ZOn0ORKAAvczy 14q82v/3YQXh2VZcBLqyh8c1lX6b/ib9bWu1VOm1NvJyhwfdPmFs3E2HMlO58yCjbbQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gondor.apana.org.au; spf=pass smtp.mailfrom=gondor.apana.org.au; dkim=pass header.d=gondor.apana.org.au header.i=@gondor.apana.org.au header.a=rsa-sha256 header.s=h01 header.b=MHaGO+mh; arc=none smtp.remote-ip=180.181.231.80 Received: from abb.hmeau.com (abb.hmeau.com [180.181.231.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23EBC606A32C; Fri, 4 Dec 2026 05:07:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 23EBC606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gondor.apana.org.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gondor.apana.org.au Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=gondor.apana.org.au header.i=@gondor.apana.org.au header.a=rsa-sha256 header.s=h01 header.b=MHaGO+mh DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gondor.apana.org.au; s=h01; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:cc:to:subject:message-id:date: from:content-type:reply-to; bh=BYWgdB5inZJrGjD5Gr5FNWwSJy1g/JPmvzssq/QfoGk=; b=MHaGO+mhmfu0EF7XDw10tn07XAmFrsODD0Q44ZKjgTN2u9ekECqiRwLYl+quaMg6SuT1tsDHOZO GZPqiZyGc9QYTN+/vMmlTXSLS0UUFd+VeMLC5W+1Ns4jbxwVPerI0FqVp4cwM1mlaDMJbSgabgD3H iH4Sdhc53DdooJCQyHymqenAFb/Ox1z1Iav4fBroNsB99YSLcmkYhG2RVjYbqbpkCeWkk1pRG2iPn XRdlAGwfe6pIIjM1hU+Atjsp48gjLYn5gle2rrFx1ueD2PuvtSpVFvSnwbpFlGsbw1FjSmH0ojVLQ u6wi5z2QBxZuDZc8yPHmr7WA8EX7bbNF8VVg==; Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.100.1 #2 (Debian)) id 1xZLVi-00000005EMp-12x8; Fri, 04 Dec 2026 13:07:07 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Fri, 04 Dec 2026 13:07:06 +0800 Date: Fri, 4 Dec 2026 13:07:06 +0800 From: Herbert Xu To: Ryan Prinz Cc: Giovanni Cabiddu , "David S . Miller" , qat-linux@intel.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] crypto: qat - fix missing DH public key validation Message-ID: References: <20261125231859.1857450-1-rc4d5a@protonmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261125231859.1857450-1-rc4d5a@protonmail.com> On Wed, Nov 25, 2026 at 11:19:18PM +0000, Ryan Prinz wrote: > qat_dh_compute_value() passes the peer's DH public value into the > hardware queue without checking it. The only checks on req->src are > on length (req->src_len > ctx->p_size); never on the value itself. > > crypto/dh.c's dh_is_pubkey_valid() is the generic software check for > this: it rejects a value outside [2, p-2], but only when FIPS mode > is enabled, and only for callers using the software implementation. > QAT's hardware path has no equivalent check in either mode. > > QAT registers "dh" at cra_priority 1000, versus the generic software > implementation's 100, so any caller requesting "dh" gets this > unvalidated path whenever a QAT device is present and the requested > modulus size (1536/2048/3072/4096 bits) is one QAT supports; > qat_dh_set_secret() only falls back to software for sizes outside > that set. > > drivers/nvme/common/auth.c requests "ffdheNNNN(dh)" for NVMe-oF's > in-band DH-HMAC-CHAP authentication. Three of its five supported > group sizes, 2048, 3072 and 4096 bits, match QAT's hardware sizes. > Forcing the derived session key Ks to a known value lets an > attacker who holds a handshake transcript perform an offline > brute-force attack against the pre-shared key, which is what the DH > exchange is documented to protect against on top of plain CHAP. > > Fixed by validating the peer-supplied value before it reaches the > hardware queue, rejecting any value outside [2, p-2]. > > Fixes: c9839143ebbf ("crypto: qat - Add DH support") > Signed-off-by: Ryan Prinz > --- > v3: > - Giovanni pointed out that this range check was about to exist > twice, byte-for-byte identical, once here and once in the > HiSilicon HPRE fix for the same bug. Moved the comparison itself > into crypto_dh_pubkey_in_range() in crypto/dh_helper.c, exported > via dh.h, so this and the HPRE fix (and the generic software path, > if that's wired up too) share one implementation instead of each > carrying a private copy. This driver's own zero-padding and (p - 1) > computation are unchanged; only the final comparison call moved. > Depends on the separate "crypto: dh - add shared DH public key > range check" patch. This needs to go into a patch series. Otherwise it's impossible for Sashiko to review this. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt