Repository navigation
Check each slot's chain with its certificate model - #4376
Merged
Merged
Conversation
Fix DMTF#4374. libspdm_verify_peer_cert_chain_buffer_integrity() checks a Responder's certificate chain with the AliasCert model when the Responder sets ALIAS_CERT_CAP, and with the DeviceCert model otherwise, whatever the slot. When the connection uses multiple asymmetric keys, DIGESTS and CERTIFICATE give a certificate model for each slot, and the Requester records it and compares the two, but does not check the chain with it. DSP0274 1.4.1 says of ALIAS_CERT_CAP in Table 15: "When set in combination with MULTI_KEY_CAP being 01b or 10b, the certificate model in each slot can vary and should be evaluated individually." So a Responder with ALIAS_CERT_CAP cannot have a DeviceCert chain in any slot: the chain's leaf certificate carries the hardware identity OID, which the AliasCert model forbids, and GET_CERTIFICATE returns LIBSPDM_STATUS_VERIF_FAIL. When multi_key_conn_rsp is true and the slot's certificate model is known, check the chain with that model. Otherwise nothing changes: without multiple keys every slot uses the model ALIAS_CERT_CAP gives, as paragraph 370 of DSP0274 1.4.1 requires, and the Responder still does not determine the Requester's model. The function takes the slot ID for this, and its callers pass it. req_get_certificate_case30's sub case 2 reported the AliasCert model without ALIAS_CERT_CAP, which DSP0274 1.4.1 forbids, for a DeviceCert chain; it passed only because the model was not used. It now sets ALIAS_CERT_CAP and sends the AliasCert chain, then takes a DeviceCert chain from slot 1 with the bit still set. Test 85 checks the function with each model. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Chung-Wei Lan <zwwe1f@gmail.com>
This was referenced Nov 27, 2026
steven-bellock
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #4374.
libspdm_verify_peer_cert_chain_buffer_integrity()takes the slot ID. On the Requester, whenmulti_key_conn_rspis true and the slot's certificate model is known, it checks the chain with that model, whichDIGESTSandCERTIFICATEgive and the Requester records inpeer_cert_info[slot_id]before the check. Otherwise nothing changes: without multiple keys every slot uses the model ofALIAS_CERT_CAP(DSP0274 1.4.1, paragraph 370), and the Responder still does not determine the Requester's model. Its three callers pass the slot:libspdm_get_certificate(), the encapsulatedGET_CERTIFICATE, and the sample verification callback.The model can also be GenericCert, in slots 1 to 7. Such a chain is now checked with the GenericCert model, as
SET_CERTIFICATEalready checks one:libspdm_x509_common_certificate_check()lets a few fields of its leaf certificate be empty, and, as with DeviceCert, lets that certificate carry the hardware identity OID. Before, it was checked with the model ofALIAS_CERT_CAP. DSP0274 1.4.1 leaves the contents of GenericCert certificates, other than the key pair and related information in the leaf certificate, outside its scope (paragraph 130). Checked by adding the calls to case 85 locally: a DeviceCert chain in a GenericCert slot passes, withALIAS_CERT_CAPset and with it clear. Case 85 as sent has no GenericCert step.req_get_certificate_case30's sub case 2 had the Responder report the AliasCert model withoutALIAS_CERT_CAP, and send the DeviceCert chain. It passed because the model was not used, and fails with this change, at the leaf certificate's hardware identity OID. DSP0274 1.4.1 forbids the AliasCert model withoutALIAS_CERT_CAP, so the sub case now sets the bit and sends the AliasCert chain, and then, with the bit still set, gets a DeviceCert chain from slot 1, which is the case this fixes. Whether the Requester should refuse the AliasCert model withoutALIAS_CERT_CAPis left as it is.Tested on Linux, GCC, at
mainb3f7d2e, Mbed TLS Debug and OpenSSL Release:test_spdm_requester(984 tests) andtest_spdm_responder(736 with Mbed TLS, 737 with OpenSSL) pass before and after;test_spdm_commonpasses 103 before and 104 after, with the new case 85.main's library, case 85 fails, and case 30 fails at its slot 1 step only, with "Hardware identity OID present in alias leaf certificate".test_spdm_samplefails before and after at the same two cases, becausedice_cert/dice_root_cert.deris not in the repository; so the change to the sample callback is built, not run.script/format_nix.sh --checkpasses, and the build has no warning.With spdm-emu
0ffa9e0, built as its workflows build it, andALIAS_CERTadded to the responder's--cap(slot 0 holds the AliasCert chain, slot 4 a DeviceCert chain), default flow:main80020001after slot 4'sCERTIFICATECERTIFICATEpasses, andSET_CERTIFICATEis answeredERROR(Unspecified)The
SET_CERTIFICATEfailure is spdm-emu's, fixed in DMTF/spdm-emu#560. With it, P-384 completes: 2,272 messages, exit 0, the message sequence of the flow withoutALIAS_CERT. ML-DSA and SLH-DSA then stop in the samplelibspdm_update_local_cert_chain(), #4375. WithoutALIAS_CERT, P-384 and ML-DSA-87 give the same messages before and after.