Skip to content

Commit

Permalink
Document maximum size of MeasurementRecordLength
Browse files Browse the repository at this point in the history
Fix #2469.

Signed-off-by: Steven Bellock <[email protected]>
  • Loading branch information
steven-bellock committed Jan 21, 2024
1 parent 01a8c0c commit 0fdbfbf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/hal/library/responder/measlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
* On input, indicates the size in bytes of the destination buffer.
* On output, indicates the total size in bytes of all device measurement
* blocks in the buffer. This field should only be modified if "measurement_index" is non-zero.
* The maximum size is (2^24) - 1 bytes.
**/
extern libspdm_return_t libspdm_measurement_collection(
spdm_version_number_t spdm_version,
Expand Down
2 changes: 2 additions & 0 deletions library/spdm_responder_lib/libspdm_rsp_measurements.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ libspdm_return_t libspdm_get_response_measurements(libspdm_context_t *spdm_conte
measurements,
&measurements_size);

/* MeasurementRecordLength is 3 bytes. */
LIBSPDM_ASSERT(measurements_size < (size_t)(1 << 24));
LIBSPDM_ASSERT(measurements_size <= meas_opaque_buffer_size);

if (LIBSPDM_STATUS_IS_ERROR(status)) {
Expand Down

0 comments on commit 0fdbfbf

Please sign in to comment.