Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document maximum size of MeasurementRecordLength #2530

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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