Add libspdm_parse_measurement_transaction_data function - #3595
Conversation
44c371f to
225b9c4
Compare
Signed-off-by: Patrick Boyd <Patrick_Boyd@Dell.com>
225b9c4 to
889b731
Compare
| #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); |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Question on how libspdm_parse_measurements_response should handle presence of signature.
ayj
left a comment
There was a problem hiding this comment.
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
ALGORITHMSresponse to strictly validate thatdata_size - ptr == expected_signature_size?
|
@pboyd04. allocate_pool() is NOT allowed in currently libspdm core library. Please fix it according to the feedback. |
Fixes #3566