mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
To: Ryan Prinz <rc4d5a@protonmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>, <qat-linux@intel.com>,
	<linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] crypto: qat - fix missing DH public key validation
Date: Wed, 25 Nov 2026 18:04:23 +0000	[thread overview]
Message-ID: <awcjJ8/jvscOuCLl@gcabiddu-mobl.ger.corp.intel.com> (raw)
In-Reply-To: <20261124141238.1743680-1-rc4d5a@protonmail.com>

On Tue, Nov 24, 2026 at 02:12:54PM +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.
Would it make sense to have a provider-independent check for the public
key in crypto/dh_helper.c instead?

This way, software DH, QAT and HiSilicon HPRE, which all register "dh",
could use the same check (regardless of FIPS mode).

Thanks,

-- 
Giovanni

      reply	other threads:[~2026-11-25 18:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 14:12 Ryan Prinz
2026-11-25 18:04 ` Giovanni Cabiddu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awcjJ8/jvscOuCLl@gcabiddu-mobl.ger.corp.intel.com \
    --to=giovanni.cabiddu@intel.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qat-linux@intel.com \
    --cc=rc4d5a@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®