From: Jonathan Cameron <jic23@kernel.org>
To: sashiko-bot@kernel.org
Cc: sashiko-reviews@lists.linux.dev, alistair23@gmail.com,
linux-pci@vger.kernel.org, ojeda@kernel.org,
linux-cxl@vger.kernel.org
Subject: Re: [PATCH v3 17/21] lib: rspdm: Support SPDM get_digests
Date: Wed, 9 Sep 2026 01:36:16 +0100 [thread overview]
Message-ID: <20260909013616.13993627@jic23-huawei> (raw)
In-Reply-To: <20260901012040.554EE1F000E9@smtp.kernel.org>
On Tue, 01 Sep 2026 01:20:39 +0000
sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
> - [High] Buffer under-allocation for SPDM 1.3+ GET_DIGESTS responses leading to transport failure, transcript truncation, and EIO crashes.
> - [Medium] The GET_DIGESTS implementation validates the payload length but completely discards the returned certificate digests.
> - [Low] An undersized/truncated GET_DIGESTS response incorrectly logs an 'Overflow' error.
> --
>
> commit 7b16689f564246befd0f0c43fa0d4515876746e6
> Author: Alistair Francis <alistair@alistair23.me>
>
> lib: rspdm: Support SPDM get_digests
>
> This commit adds support for the GET_DIGESTS SPDM command.
>
> > diff --git a/lib/rspdm/state.rs b/lib/rspdm/state.rs
> > index b78086c753702..131c22319b262 100644
> > --- a/lib/rspdm/state.rs
> > +++ b/lib/rspdm/state.rs
> [ ... ]
> > @@ -612,4 +630,64 @@ pub(crate) fn negotiate_algs(&mut self) -> Result<(), Error> {
> >
> > Ok(())
> > }
> > +
> > + pub(crate) fn get_digests(&mut self) -> Result<(), Error> {
> > + let mut request = GetDigestsReq::default();
> > + request.version = self.version;
> > +
> > + let req_sz = core::mem::size_of::<GetDigestsReq>();
> > + let rsp_sz = core::mem::size_of::<GetDigestsRsp>() + SPDM_SLOTS * self.hash_len;
>
> [Severity: High]
> Does this calculation fail to account for SPDM 1.3+ fields like KeyPairID,
> CertificateInfo, and KeyUsageMask?
>
> For SPDM 1.3+ compliant responders, up to 32 bytes of additional fields
> can be returned. Because param2 is a bitmask of provisioned slots rather
> than a count, any device using slots >= 4 will produce a response size far
> larger than the allocated buffer, which could trigger an EIO crash.
>
> Even for lower slots, this calculation omits the 1.3 fields from the
> transcript, which could cause a permanent signature verification failure
> in challenge authentication due to transcript desynchronization.
Nope. Feature turned off by requester not asking for it (yet!)
>
> > +
> > + // SAFETY: `request` is repr(C) and packed, so we can convert it to a slice
> > + let request_buf = unsafe { from_raw_parts_mut(&mut request as *mut _ as *mut u8, req_sz) };
> > +
> > + let mut response_vec: KVec<u8> = KVec::from_elem(0u8, rsp_sz, GFP_KERNEL)?;
> > +
> > + let len = self.spdm_exchange(request_buf, response_vec.as_mut_slice())? as usize;
> > +
> > + // The transport must report a length within the buffer we provided.
> > + if len > response_vec.len() {
> > + pr_err!("Overflowed digests response\n");
> > + return Err(EIO);
> > + }
> > + response_vec.truncate(len);
> > +
> > + let response: &GetDigestsRsp = Untrusted::new(response_vec.as_slice()).validate()?;
>
> [Severity: Medium]
> Does this completely discard the returned certificate digests?
>
> The SPDM specification mandates that requesters compare the hash of the
> certificate chain with the digest returned in get_digests. There doesn't
> seem to be any storage for these digests in SpdmState, meaning this
> cryptographic binding between the get_digests response and the certificate
> chain downloaded in get_certificate might never be verified.
This one is curious. I can't find a reference to the spec requiring that.
Digests are a short cut, I think you can always ignore them and just use the certs
themselves. I couldn't find any text requiring the certs if we ignore the digests
but maybe it is hiding in there somewhere.
next prev parent reply other threads:[~2026-09-09 0:36 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 1:03 [PATCH v3 00/21] lib: Rust implementation of SPDM alistair23
2026-09-01 1:03 ` [PATCH v3 01/21] rust: transmute: add `cast_slice[_mut]` functions alistair23
2026-09-01 1:11 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 02/21] rust: create basic untrusted data API alistair23
2026-09-01 1:19 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 03/21] rust: validate: add `Validate` trait alistair23
2026-09-01 1:16 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 04/21] X.509: Make certificate parser public alistair23
2026-09-01 1:12 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 05/21] X.509: Parse Subject Alternative Name in certificates alistair23
2026-09-01 1:12 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 06/21] X.509: Move certificate length retrieval into new helper alistair23
2026-09-01 1:10 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 07/21] rust: add bindings for hash.h alistair23
2026-09-01 1:10 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 08/21] rust: error: impl From<FromBytesWithNulError> for Kernel Error alistair23
2026-09-01 1:10 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 09/21] lib: rspdm: Initial commit of Rust SPDM alistair23
2026-09-01 1:17 ` sashiko-bot
2026-09-08 22:57 ` Jonathan Cameron
2026-09-01 1:03 ` [PATCH v3 10/21] PCI/TSM: Rename pf0 to host alistair23
2026-09-01 1:16 ` sashiko-bot
2026-09-08 23:01 ` Jonathan Cameron
2026-09-11 5:00 ` Alistair
2026-09-01 1:03 ` [PATCH v3 11/21] PCI/TSM: Support connecting to PCIe CMA devices alistair23
2026-09-01 1:25 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 12/21] PCI/CMA: Add a PCI TSM CMA driver using SPDM alistair23
2026-09-01 1:20 ` sashiko-bot
2026-09-08 23:21 ` Jonathan Cameron
2026-09-01 1:03 ` [PATCH v3 13/21] PCI/CMA: Validate Subject Alternative Name in certificates alistair23
2026-09-01 1:15 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 14/21] lib: rspdm: Support SPDM get_version alistair23
2026-09-01 1:17 ` sashiko-bot
2026-09-08 23:40 ` Jonathan Cameron
2026-09-01 1:03 ` [PATCH v3 15/21] lib: rspdm: Support SPDM get_capabilities alistair23
2026-09-01 1:15 ` sashiko-bot
2026-09-08 23:47 ` Jonathan Cameron
2026-09-01 1:03 ` [PATCH v3 16/21] lib: rspdm: Support SPDM negotiate_algorithms alistair23
2026-09-01 1:30 ` sashiko-bot
2026-09-04 5:01 ` Aksh Garg
2026-09-09 0:17 ` Jonathan Cameron
2026-09-11 4:53 ` Alistair
2026-09-01 1:03 ` [PATCH v3 17/21] lib: rspdm: Support SPDM get_digests alistair23
2026-09-01 1:20 ` sashiko-bot
2026-09-09 0:36 ` Jonathan Cameron [this message]
2026-09-09 0:31 ` Jonathan Cameron
2026-09-01 1:03 ` [PATCH v3 18/21] lib: rspdm: Support SPDM get_certificate alistair23
2026-09-01 1:21 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 19/21] lib: rspdm: Support SPDM certificate validation alistair23
2026-09-01 1:22 ` sashiko-bot
2026-09-09 0:46 ` Jonathan Cameron
2026-09-01 1:03 ` [PATCH v3 20/21] rust: allow extracting the buffer from a CString alistair23
2026-09-01 1:19 ` sashiko-bot
2026-09-01 1:03 ` [PATCH v3 21/21] lib: rspdm: Support SPDM challenge alistair23
2026-09-01 1:31 ` sashiko-bot
2026-09-09 1:37 ` Jonathan Cameron
2026-09-11 3:46 ` Alistair
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=20260909013616.13993627@jic23-huawei \
--to=jic23@kernel.org \
--cc=alistair23@gmail.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=sashiko-bot@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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;
as well as URLs for NNTP newsgroup(s).