Skip to content

Use the session's peer slot for the FINISH signature - #4313

Merged
jyao1 merged 1 commit into
DMTF:mainfrom
Jhongwe1:finish-signature-peer-slot
Nov 11, 2026
Merged

jyao1 merged 1 commit into
DMTF:mainfrom
Jhongwe1:finish-signature-peer-slot

Conversation

@Jhongwe1

Copy link
Copy Markdown
Contributor

Fix #4312.

With LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT, libspdm_generate_finish_req_signature() looked up the Responder's certificate chain with its slot_id parameter, which is req_slot_id_param, the Requester's own slot. This takes it from session_info->peer_used_cert_chain_slot_id, as libspdm_verify_finish_rsp_hmac() and libspdm_generate_finish_req_hmac() in the same file do since #3435. slot_id is set to the Requester's slot again before its own chain is read, as before, so the key pair the Requester signs with does not change.

Tested in spdm-emu 0e9d60c, whose libspdm, 6cb52f2, has the libspdm_req_finish.c of main, 839bc24: mbedtls, Release, the Requester built with LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT=1, spdm-emu's default flow, which opens a second KEY_EXCHANGE session on slot 4 with mutual authentication.

Responder before after
built without RECORD_TRANSCRIPT_DATA_SUPPORT (twice) slot 4's FINISH answered ERROR(DecryptError), 0x8001000f FINISH_RSP, both sessions open
built with it the same the same as above
without it, --slot_id 4 on the Requester slot 4's FINISH, the first, answered ERROR(DecryptError) FINISH_RSP

libspdm at 839bc24, Linux, GCC, OpenSSL, Release: every test_* program gives the same exit status and the same cmocka summary with and without the change, in the default configuration and with LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT=1 (test_spdm_sample fails the same two cases in each, as without it), and script/format_nix.sh --check on a clean export is clean.

Fix DMTF#4312.

With LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT,
libspdm_generate_finish_req_signature() looked up the Responder's
certificate chain for the transcript it signs with its slot_id
parameter, which libspdm_send_receive_finish() sets to
req_slot_id_param, the Requester's own slot. In a session on any
other Responder slot the signed transcript held the wrong chain, and
the Responder answered FINISH with ERROR(DecryptError).

Take the slot from session_info->peer_used_cert_chain_slot_id, as
libspdm_verify_finish_rsp_hmac() and libspdm_generate_finish_req_hmac()
do since DMTF#3435. slot_id is set to the Requester's slot again before
its own chain is read, so the key pair it signs with is unchanged.

Fixes: 13db511 ("Add key_pair_id param for signing HAL API for multi-key.")
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Chung-Wei Lan <zwwe1f@gmail.com>
@Jhongwe1
Jhongwe1 force-pushed the finish-signature-peer-slot branch from d65fe0e to 6495195 Compare November 11, 2026 17:52
@jyao1
jyao1 merged commit b7c415a into DMTF:main Nov 11, 2026
56 checks passed
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.

RECORD_TRANSCRIPT_DATA_SUPPORT: FINISH signature uses the Requester's slot for the Responder chain

3 participants