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 authored and jyao1 committed Jan 24, 2024
1 parent 33ed7e3 commit dc021c0
Show file tree
Hide file tree
Showing 3 changed files with 4 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 SPDM_MAX_MEASUREMENT_RECORD_LENGTH (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 include/industry_standard/spdm.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#define SPDM_MAX_SLOT_COUNT 8
#define SPDM_MAX_OPAQUE_DATA_SIZE 1024
#define SPDM_MAX_CSR_TRACKING_TAG 7
/* MeasurementRecordLength is 3 bytes. */
#define SPDM_MAX_MEASUREMENT_RECORD_LENGTH 0xFFFFFF

#define SPDM_NONCE_SIZE 32
#define SPDM_RANDOM_DATA_SIZE 32
Expand Down
1 change: 1 addition & 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,7 @@ libspdm_return_t libspdm_get_response_measurements(libspdm_context_t *spdm_conte
measurements,
&measurements_size);

LIBSPDM_ASSERT(measurements_size <= SPDM_MAX_MEASUREMENT_RECORD_LENGTH);
LIBSPDM_ASSERT(measurements_size <= meas_opaque_buffer_size);

if (LIBSPDM_STATUS_IS_ERROR(status)) {
Expand Down

0 comments on commit dc021c0

Please sign in to comment.