-
Notifications
You must be signed in to change notification settings - Fork 131
Description
Update more detail for the issue, to make the original issue clearer.
Background
In 1.3 spec:
Table 14 — Flag fields definitions for the Responder
If CERT_INSTALL_RESET_CAP
set, Responder may return an ERROR
message of ErrorCode=ResetRequired
to complete a certificate provisioning request. If this bit is set, SET_CERT_CAP
shall be set and CSR_CAP
can be set.
Table 58 — Error code and error data
ResetRequired
: The device requires a reset to complete the requested operation. This ErrorCode
can be sent in response to the GET_DIGESTS
, GET_CERTIFICATE
, GET_CSR
or SET_CERTIFICATE
message.
Problem Statement
Problem A:
In responder, when CERT_INSTALL_RESET_CAP
is supported, need_reset
will be true
.
in 1.3 Spec
CERT_INSTALL_RESET_CAP
indicate the certificate provisioning request can returnResetRequired
, not mentioning set key pair request.
libspdm/library/spdm_responder_lib/libspdm_rsp_set_key_pair_info_ack.c
Lines 279 to 281 in 1c19b6d
need_reset = libspdm_is_capabilities_flag_supported( | |
spdm_context, false, 0, | |
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_INSTALL_RESET_CAP); |
There is chance to generate error response with ResetRequired
for SET_KEY_PAIR_INFO
request.
in 1.3 Spec,
SET_KEY_PAIR_INFO
was not listed in Table 58 — Error code and error data,ResetRequired
row.
libspdm/library/spdm_responder_lib/libspdm_rsp_set_key_pair_info_ack.c
Lines 300 to 304 in 1c19b6d
if (need_reset) { | |
return libspdm_generate_error_response(spdm_context, | |
SPDM_ERROR_CODE_RESET_REQUIRED, 0, | |
response_size, response); | |
} else { |
Checking SPDM spec 1.3.2, SET_KEY_PAIR_INFO
should not return ErrorCode=ResetRequired
Problem B:
In line 118-119, in requester, the ResetRequired
was handled only when last request was SET_CERTIFICATE
and GET_CSR
.
libspdm/library/spdm_requester_lib/libspdm_req_handle_error_response.c
Lines 117 to 132 in 1c19b6d
last_spdm_request = (void *)spdm_context->last_spdm_request; | |
if ((last_spdm_request->header.request_response_code == SPDM_SET_CERTIFICATE) || | |
(last_spdm_request->header.request_response_code == SPDM_GET_CSR)) { | |
if (error_code == SPDM_ERROR_CODE_RESET_REQUIRED) { | |
if ((libspdm_get_connection_version(spdm_context) >= SPDM_MESSAGE_VERSION_13) && | |
!libspdm_is_capabilities_flag_supported( | |
spdm_context, true, 0, | |
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_INSTALL_RESET_CAP)) { | |
return LIBSPDM_STATUS_ERROR_PEER; | |
} | |
/* CERT_INSTALL_RESET_CAP for a 1.2 Responder is not checked because it was not defined | |
* in SPDM 1.2.0. */ | |
return LIBSPDM_STATUS_RESET_REQUIRED_PEER; | |
} | |
} |
So even if responder returns ResetRequired
for SET_KEY_PAIR_INFO
, the requester will ignore the ResetRequired
error.