From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: <firstname.lastname@example.org>, <email@example.com>
Cc: <firstname.lastname@example.org>, <email@example.com>,
Chris Browy <firstname.lastname@example.org>, <email@example.com>,
Lorenzo Pieralisi <firstname.lastname@example.org>,
Bjorn Helgaas <email@example.com>,
Jeremy Kerr <firstname.lastname@example.org>
Subject: Re: [RFC PATCH 0/4] PCI/CMA and SPDM library
Date: Thu, 5 Aug 2021 17:43:46 +0100 [thread overview]
Message-ID: <email@example.com> (raw)
On Thu, 5 Aug 2021 00:18:35 +0800
Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:
> This is an RFC to start discussions about how we support the Component
> Measurement and Authentication (CMA) ECN (pcisig.com)
> CMA provides an adaptation of the data objects and underlying protocol
> defined in the DMTF SPDM specification to be used to authenticate and
> conduct run-time measurements of the state of PCI devices (kind of like
> IMA for devices / firmware). This is done using a Data Object Exchange (DOE)
> protocol described in the ECN.
> The CMA ECN is available from the PCI SIG and SPDM can be found at
> CMA/SPDM is focused on establishing trust of the device by:
> 1) Negotiate algorithms supported.
> 2) Retrieve and check the certificate chain from the device against
> a suitable signing certificate on the host.
> 3) Issue a challenge to the device to verify it can sign with the private
> key associated with the leaf certificate.
> 4) (Request a measurement of device state)
> 5) (Establish a secure channel for further measurements or other uses)
> 6) (Mutual authentication)
> This RFC only does steps 1-3
> Testing of this patch set has been conducted against QEMU emulation of
> the device backed by openSPDM emulation of the SPDM protocol.
Note testing also works with libspdm and libspdm-emu from
https://github.com/DMTF/spdm-emu with no modifications.
The openSPDM modifications Chris and team made were all associated with the host
end and are not needed for this code (the QEMU part is still needed to provide
the DOE emulation and forward the traffic to spdm_responder_emu)
I should also have mentioned this series is on top of the recently posted
DOE series rebased onto the linux-cxl next git tree. I'm not really expecting
anyone to test it at this stage, but if desired I can push a full tree out
somewhere with this in place.
> Open questions are called out in the individual patches but the big ones are
> 1) Certificate management.
> Current code uses a _cma keyring created by the kernel, into which a
> suitable root certificate can be inserted from userspace.
> A=$(keyctl search %:_cma keyring _cma)
> evmctl import ecdsaca.cert.der $A
> Is this an acceptable way to load the root certificates for this purpose?
> The root of the device provided certificate chain is then checked against
> certificates on this keychain, but is itself (with the other certificates
> in the chain) loaded into an SPDM instance specific keychain. Currently
> there is no safe cleanup of this which will need to be fixed.
> Using the keychain mechanism provides a very convenient way to manage these
> certificates and to allow userspace to read them for debug purpose etc, but
> is this the right use model?
> Finally the leaf certificate of this chain is used to check signatures of
> the rest of the communications with the device.
> 2) ASNL1 encoder for ECDSA signature
> It seems from the openSPDM implementation that for these signatures,
> the format is a simple pair of raw values. The kernel implementation of
> ECDSA signature verification assumes ASN1 encoding as seems to be used
> in x509 certificates. Currently I work around that by encoding the
> signatures so that the ECDSA code can un-encode them again and use them.
> This seems slightly silly, but it is minimum impact on current code.
> Other suggestions welcome.
> 3) Interface to present to drivers. Currently I'm providing just one exposed
> function that wraps up all the exhanges until a challenge authentication
> response from the device. This is done using one possible sequence.
> I don't think it makes sense to expose the low level components due to the
> underlying spdm_state updates and there only being a fixed set of valid
> Future patches will raise questions around management of the measurements, but
> I'll leave those until I have some sort of implementation to shoot at.
> The 'on probe' use in the CXL driver is only one likely time when authentication
> would be needed.
> Note I'm new to a bunch of the areas of the kernel this touches, so have
> probably done things that are totally wrong.
> CC list is best effort to identify those who 'might' care. Please share
> with anyone I've missed.
> Jonathan Cameron (4):
> lib/asn1_encoder: Add a function to encode many byte integer values.
> spdm: Introduce a library for DMTF SPDM
> PCI/CMA: Initial support for Component Measurement and Authentication
> cxl/pci: Add really basic CMA authentication support.
> drivers/cxl/Kconfig | 1 +
> drivers/cxl/mem.h | 2 +
> drivers/cxl/pci.c | 13 +-
> drivers/pci/Kconfig | 9 +
> drivers/pci/Makefile | 1 +
> drivers/pci/doe.c | 2 -
> include/linux/asn1_encoder.h | 3 +
> include/linux/pci-doe.h | 2 +
> lib/Kconfig | 3 +
> lib/Makefile | 2 +
> lib/asn1_encoder.c | 54 ++
> lib/spdm.c | 1196 ++++++++++++++++++++++++++++++++++
> 12 files changed, 1285 insertions(+), 3 deletions(-)
> create mode 100644 lib/spdm.c
next prev parent reply other threads:[~2021-08-05 16:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-04 16:18 [RFC PATCH 0/4] PCI/CMA and SPDM library Jonathan Cameron
2021-08-04 16:18 ` [RFC PATCH 1/4] lib/asn1_encoder: Add a function to encode many byte integer values Jonathan Cameron
2021-08-04 16:18 ` [RFC PATCH 2/4] spdm: Introduce a library for DMTF SPDM Jonathan Cameron
2022-02-18 22:05 ` Dan Williams
2022-02-28 18:13 ` Box, David E
2022-03-01 9:59 ` Jonathan Cameron
2022-03-02 21:34 ` David E. Box
2021-08-04 16:18 ` [RFC PATCH 3/4] PCI/CMA: Initial support for Component Measurement and Authentication ECN Jonathan Cameron
2021-09-17 16:22 ` Jonathan Cameron
2021-08-04 16:18 ` [RFC PATCH 4/4] cxl/pci: Add really basic CMA authentication support Jonathan Cameron
2021-08-05 16:43 ` Jonathan Cameron [this message]
2021-08-31 12:55 ` [RFC PATCH 0/4] PCI/CMA and SPDM library Jonathan Cameron
2021-11-17 17:46 ` Chris Browy
2021-11-18 11:54 ` Jonathan Cameron
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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).