Skip to content

Commit

Permalink
Fix error code for unsupported_req error.
Browse files Browse the repository at this point in the history
Signed-off-by: Jiewen Yao <[email protected]>
  • Loading branch information
jyao1 committed Mar 25, 2024
1 parent d83ef43 commit d6a8003
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 28 deletions.
4 changes: 2 additions & 2 deletions library/spdm_requester_lib/libspdm_req_encap_certificate.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -31,7 +31,7 @@ libspdm_return_t libspdm_get_encap_response_certificate(void *spdm_context,
if (libspdm_get_connection_version(context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_encap_error_response(
context, SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
0, response_size, response);
SPDM_GET_CERTIFICATE, response_size, response);
}

if (spdm_request->header.spdm_version != libspdm_get_connection_version(context)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ libspdm_return_t libspdm_get_encap_response_challenge_auth(
if (libspdm_get_connection_version(context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_encap_error_response(
context, SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
0, response_size, response);
SPDM_CHALLENGE, response_size, response);
}

if (spdm_request->header.spdm_version != libspdm_get_connection_version(context)) {
Expand Down
4 changes: 2 additions & 2 deletions library/spdm_requester_lib/libspdm_req_encap_digests.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -40,7 +40,7 @@ libspdm_return_t libspdm_get_encap_response_digest(void *spdm_context,
if (libspdm_get_connection_version(context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_encap_error_response(
context, SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
0, response_size, response);
SPDM_GET_DIGESTS, response_size, response);
}

if (spdm_request->header.spdm_version != libspdm_get_connection_version(context)) {
Expand Down
4 changes: 2 additions & 2 deletions library/spdm_requester_lib/libspdm_req_encap_key_update.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -31,7 +31,7 @@ libspdm_return_t libspdm_get_encap_response_key_update(void *spdm_context,
if (libspdm_get_connection_version(context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_encap_error_response(
context, SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
0, response_size, response);
SPDM_KEY_UPDATE, response_size, response);
}

if (spdm_request->header.spdm_version != libspdm_get_connection_version(context)) {
Expand Down
5 changes: 3 additions & 2 deletions library/spdm_responder_lib/libspdm_rsp_chunk_get.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -29,7 +29,8 @@ libspdm_return_t libspdm_get_response_chunk_get(

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_12) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_CHUNK_GET,
response_size, response);
}

Expand Down
5 changes: 3 additions & 2 deletions library/spdm_responder_lib/libspdm_rsp_chunk_send_ack.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -30,7 +30,8 @@ libspdm_return_t libspdm_get_response_chunk_send(libspdm_context_t *spdm_context

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_12) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_CHUNK_SEND,
response_size, response);
}

Expand Down
3 changes: 2 additions & 1 deletion library/spdm_responder_lib/libspdm_rsp_csr.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ libspdm_return_t libspdm_get_response_csr(libspdm_context_t *spdm_context,

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_12) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_GET_CSR,
response_size, response);
}

Expand Down
8 changes: 5 additions & 3 deletions library/spdm_responder_lib/libspdm_rsp_encap_response.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -225,7 +225,8 @@ libspdm_return_t libspdm_get_response_encapsulated_request(

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_GET_ENCAPSULATED_REQUEST,
response_size, response);
}

Expand Down Expand Up @@ -306,7 +307,8 @@ libspdm_return_t libspdm_get_response_encapsulated_response_ack(

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_DELIVER_ENCAPSULATED_RESPONSE,
response_size, response);
}

Expand Down
5 changes: 3 additions & 2 deletions library/spdm_responder_lib/libspdm_rsp_end_session.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand All @@ -21,7 +21,8 @@ libspdm_return_t libspdm_get_response_end_session(libspdm_context_t *spdm_contex

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_END_SESSION,
response_size, response);
}

Expand Down
5 changes: 3 additions & 2 deletions library/spdm_responder_lib/libspdm_rsp_finish.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -383,7 +383,8 @@ libspdm_return_t libspdm_get_response_finish(libspdm_context_t *spdm_context, si

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_FINISH,
response_size, response);
}

Expand Down
5 changes: 3 additions & 2 deletions library/spdm_responder_lib/libspdm_rsp_heartbeat.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand All @@ -24,7 +24,8 @@ libspdm_return_t libspdm_get_response_heartbeat(libspdm_context_t *spdm_context,

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_HEARTBEAT,
response_size, response);
}

Expand Down
3 changes: 2 additions & 1 deletion library/spdm_responder_lib/libspdm_rsp_key_exchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ libspdm_return_t libspdm_get_response_key_exchange(libspdm_context_t *spdm_conte

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_KEY_EXCHANGE,
response_size, response);
}

Expand Down
5 changes: 3 additions & 2 deletions library/spdm_responder_lib/libspdm_rsp_key_update.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -46,7 +46,8 @@ libspdm_return_t libspdm_get_response_key_update(libspdm_context_t *spdm_context

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_KEY_UPDATE,
response_size, response);
}

Expand Down
3 changes: 2 additions & 1 deletion library/spdm_responder_lib/libspdm_rsp_psk_exchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ libspdm_return_t libspdm_get_response_psk_exchange(libspdm_context_t *spdm_conte

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_PSK_EXCHANGE,
response_size, response);
}

Expand Down
5 changes: 3 additions & 2 deletions library/spdm_responder_lib/libspdm_rsp_psk_finish.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -89,7 +89,8 @@ libspdm_return_t libspdm_get_response_psk_finish(libspdm_context_t *spdm_context

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_11) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_PSK_FINISH,
response_size, response);
}

Expand Down
3 changes: 2 additions & 1 deletion library/spdm_responder_lib/libspdm_rsp_set_certificate.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ libspdm_return_t libspdm_get_response_set_certificate(libspdm_context_t *spdm_co

if (libspdm_get_connection_version(spdm_context) < SPDM_MESSAGE_VERSION_12) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, 0,
SPDM_ERROR_CODE_UNSUPPORTED_REQUEST,
SPDM_SET_CERTIFICATE,
response_size, response);
}

Expand Down

0 comments on commit d6a8003

Please sign in to comment.