Skip to content

Add a update local cert chain callback#3658

Open
alistair23 wants to merge 3 commits into
DMTF:mainfrom
alistair23:alistair/set-cert
Open

Add a update local cert chain callback#3658
alistair23 wants to merge 3 commits into
DMTF:mainfrom
alistair23:alistair/set-cert

Conversation

@alistair23

Copy link
Copy Markdown
Contributor

After a successful SET_CERTIFICATE (that doesn't require a reset) this
new callback is called. It's the implementations responsibility to
allocate memory to store the new certificate chain and update
LIBSPDM_DATA_LOCAL_PUBLIC_CERT_CHAIN to use the new chain.

After which the old certificate chain can be freed. Unfortunately we can't
handle this all in libspdm as it requires allocation, which is why the
HAL must handle this.

For DEVICE_CERT and GENERIC_CERT this is a simple. All that needs to be done
is memory allocated, the new certificate copied and the old certificate freed.

The ALIAS_CERT is similar, but required combining the new updated certificates
with the existing ones that aren't changed.

While we are at it we need to fix a bug with the current AliasCert certificate chains.
The SPDM spec states that in the AliasCert model "the Device Certificate
CA should contain the Hardware identity OID." This was previously
missing, let's ensure it's included and update the certificates to
include it.

Resolves: #873

Split the existing libspdm_verify_leaf_cert_spdm_extension() function
to include a new libspdm_contains_hardware_id_oid() function that can be
used elsewhere.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
The SPDM spec states that in the AliasCert model "the Device Certificate
CA should contain the Hardware identity OID." This was previously
missing, let's ensure it's included and update the certificates to
include it.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
After a successful SET_CERTIFICATE (that doesn't require a reset) this
new callback is called. It's the implementations responsability to
allocate memory to store the new certificate chain and update
`LIBSPDM_DATA_LOCAL_PUBLIC_CERT_CHAIN` to use the new chain.

After which the old certificate chain can be freed. Unfortunately we can't
handle this in libspdm as it might require allocation, which is why the
HAL must handle this.

For DEVICE_CERT and GENERIC_CERT this is a simple. All that needs to be done
is memory allocated, thenew certificate copied and the old certificate freed.

The ALIAS_CERT is similar, but required combining the new updated certificates
with the existing ones that aren't changed.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
[id_spdm_cert_oids]
field1 = SEQUENCE:id_spdm_cert_oid
[id_spdm_cert_oid]
field1 = OID:1.3.6.1.4.1.412.274.2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you generate the cert, would you please handle cert for slot 4 as well?

@jyao1

jyao1 commented Jun 22, 2026

Copy link
Copy Markdown
Member

Could you please split this one to 3 different PR?

  1. Update certs to add Hardware OID
  2. Split out hardware ID OID finding function
  3. Support local cert chain update.

I am OK to merge 1) soon. But we need more time to review 2) and 3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SET_CERTIFICATE] Save certificate into SPDM context

2 participants