From: liulongfang <liulongfang@huawei.com>
To: Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
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, 2 Dec 2026 09:27:45 +0800 [thread overview]
Message-ID: <339b4365-d60d-2c4f-66bf-c6d1fcf4c64f@huawei.com> (raw)
In-Reply-To: <awcjJ8/jvscOuCLl@gcabiddu-mobl.ger.corp.intel.com>
On 2026/11/26 2:04, Giovanni Cabiddu wrote:
> 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).
>
Yes, I also think it makes sense to make the change centrally in the common file,
rather than duplicating it in every driver that registers the "dh" algorithm.
Thanks.
> Thanks,
>
prev parent reply other threads:[~2026-12-02 1:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 14:12 Ryan Prinz
2026-11-25 18:04 ` Giovanni Cabiddu
2026-11-25 23:31 ` rc4d5a
2026-12-02 1:27 ` liulongfang [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=339b4365-d60d-2c4f-66bf-c6d1fcf4c64f@huawei.com \
--to=liulongfang@huawei.com \
--cc=davem@davemloft.net \
--cc=giovanni.cabiddu@intel.com \
--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®