libspdm icon indicating copy to clipboard operation
libspdm copied to clipboard

spdm1.3: rsp_csr: handling `csr_tracking_tag = 0` case

Open twilfredo opened this issue 1 year ago • 2 comments

From the 1.3 SPDM spec:

[758] If the device requires a reset to complete the GET_CSR request, the device shall respond with an ERROR message of ErrorCode=ResetRequired with Bit[2:0] of the Error Data field set to a Responder-assigned CSRTrackingTag in the range of 1 to 7 , inclusive

This implies that CSRTrackingTag takes on values [1, 7] as set by the responder. So in a case where there is a request with this field (param2) set to 0, would imply (?) that the requester is not following up on a previous CSR (?).

[758] ... the Requester sends a GET_CSR request with Bit[5:3] in Param2 set to the CSRTrackingTag that the Responder provided in the corresponding ERROR response, which signals to the Responder to send the CSR response associated with the previous request

  1. Is this understanding correct?
  2. If so, in the following case,

https://github.com/DMTF/libspdm/blob/9d562f4ba0cdf234fb654d34c12a457ee585be0d/library/spdm_responder_lib/libspdm_rsp_csr.c#L201

Should we not invoke libspdm_gen_csr() instead of libspdm_gen_csr_ex() if csr_tracking_tag == 0 ? So we can process the csr generation normally without depending on an implementation of libspdm_gen_csr_ex()?

twilfredo avatar Jan 30 '24 02:01 twilfredo

Is this understanding correct?

Yes.

Should we not invoke libspdm_gen_csr() instead of libspdm_gen_csr_ex() if csr_tracking_tag == 0 ?

No. How would libspdm_gen_csr return a tracking tag to libspdm if one is needed?

However there is a bug in libspdm_gen_csr_ex. There is no parameter for the KeyPairID field. I'll file a separate issue for that.

steven-bellock avatar Jan 30 '24 14:01 steven-bellock

Is this understanding correct?

Yes.

Should we not invoke libspdm_gen_csr() instead of libspdm_gen_csr_ex() if csr_tracking_tag == 0 ?

No. How would libspdm_gen_csr return a tracking tag to libspdm if one is needed?

Okay that makes sense, I assume that is why the default behavior for version 1.3 is to return an error when LIBSPDM_ENABLE_CAPABILITY_CSR_CAP_EX disabled, to avoid this ambiguity? Thanks for clearing that up :)

However there is a bug in libspdm_gen_csr_ex. There is no parameter for the KeyPairID field. I'll file a separate issue for that.

twilfredo avatar Jan 30 '24 23:01 twilfredo