Skip to content

Add libspdm_parse_measurement_transaction_data function - #3595

Open
pboyd04 wants to merge 1 commit into
DMTF:mainfrom
pboyd04:ParseMeasurements
Open

Add libspdm_parse_measurement_transaction_data function#3595
pboyd04 wants to merge 1 commit into
DMTF:mainfrom
pboyd04:ParseMeasurements

Conversation

@pboyd04

@pboyd04 pboyd04 commented Apr 10, 2026

Copy link
Copy Markdown

Fixes #3566

Signed-off-by: Patrick Boyd <Patrick_Boyd@Dell.com>
@pboyd04
pboyd04 force-pushed the ParseMeasurements branch from 225b9c4 to 889b731 Compare April 10, 2026 18:57
#include "internal/libspdm_requester_lib.h"

/* Forward declaration - resolved at link time from the integrator's malloc implementation. */
extern void *allocate_pool(size_t size);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Core libspdm libraries do not dynamically allocate memory. If memory is needed then it is provided by the API caller. See, for example, libspdm_get_certificate().

@ayj ayj left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question on how libspdm_parse_measurements_response should handle presence of signature.

@ayj ayj left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the parser validate signature field presence or expected size? (Lines 237-241)

In libspdm_parse_measurements_response:

237:     if (signature_requested) {
238:         /* Signature is the last field. We do not need to know its size
239:          * since this must be the final response in the transcript. */
240:         *next_offset_out = data_size;
241:     }

While this helper only parses the transaction log structure and does not cryptographically verify the signature, if the input buffer is truncated right before the signature field (ptr == data_size at line 237), the function currently returns LIBSPDM_STATUS_SUCCESS.

  • Should we add a check here to verify that the remaining buffer is non-empty (ptr < data_size) to ensure structural correctness?
  • Or, since the VCA phase is walked at the start of the buffer, should we extract the negotiated measurement signature algorithm from the ALGORITHMS response to strictly validate that data_size - ptr == expected_signature_size?

@jyao1

jyao1 commented Jul 27, 2026

Copy link
Copy Markdown
Member

@pboyd04. allocate_pool() is NOT allowed in currently libspdm core library. Please fix it according to the feedback.

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.

Need a method to decode the SPDM transaction log output from the SPDMGetSignedMeasurements Action in Redfish.

4 participants