Skip to content

Commit

Permalink
Use correct message size when logging to transcript
Browse files Browse the repository at this point in the history
Fix #2610.

Signed-off-by: Steven Bellock <[email protected]>
  • Loading branch information
steven-bellock authored and jyao1 committed Mar 7, 2024
1 parent 9bc6963 commit 309e79d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
9 changes: 5 additions & 4 deletions library/spdm_responder_lib/libspdm_rsp_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
**/
#include "internal/libspdm_responder_lib.h"
Expand Down Expand Up @@ -150,10 +150,11 @@ libspdm_return_t libspdm_get_response_certificate(libspdm_context_t *spdm_contex
(const uint8_t *)spdm_context->local_context
.local_cert_chain_provision[slot_id] + offset, length);

/* Cache*/

if (session_info == NULL) {
status = libspdm_append_message_b(spdm_context, spdm_request, request_size);
/* Log to transcript. */
const size_t spdm_request_size = sizeof(spdm_get_certificate_request_t);

status = libspdm_append_message_b(spdm_context, spdm_request, spdm_request_size);
if (LIBSPDM_STATUS_IS_ERROR(status)) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSPECIFIED, 0,
Expand Down
13 changes: 6 additions & 7 deletions library/spdm_responder_lib/libspdm_rsp_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 @@ -160,19 +160,18 @@ libspdm_return_t libspdm_get_response_digests(libspdm_context_t *spdm_context, s
}
}

/* Cache*/

if (session_info == NULL) {
status = libspdm_append_message_b(spdm_context, spdm_request,
request_size);
/* Log to transcript. */
const size_t spdm_request_size = sizeof(spdm_get_digest_request_t);

status = libspdm_append_message_b(spdm_context, spdm_request, spdm_request_size);
if (LIBSPDM_STATUS_IS_ERROR(status)) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSPECIFIED, 0,
response_size, response);
}

status = libspdm_append_message_b(spdm_context, spdm_response,
*response_size);
status = libspdm_append_message_b(spdm_context, spdm_response, *response_size);
if (LIBSPDM_STATUS_IS_ERROR(status)) {
return libspdm_generate_error_response(spdm_context,
SPDM_ERROR_CODE_UNSPECIFIED, 0,
Expand Down

0 comments on commit 309e79d

Please sign in to comment.