Skip to content

Commit

Permalink
define MAX_SPDM_MSG_SIZE in test, after it is removed in libspdm.
Browse files Browse the repository at this point in the history
Signed-off-by: Jiewen Yao <[email protected]>
  • Loading branch information
jyao1 committed Apr 12, 2023
1 parent a62ddd9 commit 3a31939
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion unit_test/fuzzing/spdm_unit_fuzzing_common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ size_t libspdm_unit_test_group_setup(void **State)

libspdm_init_context(spdm_context);
spdm_test_context->scratch_buffer_size =
libspdm_get_sizeof_required_scratch_buffer(spdm_context);
libspdm_get_sizeof_required_scratch_buffer(spdm_context, LIBSPDM_MAX_SPDM_MSG_SIZE);
spdm_test_context->scratch_buffer = (void *)malloc(spdm_test_context->scratch_buffer_size);

libspdm_register_device_io_func(spdm_context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ typedef struct {
#define LIBSPDM_MAX_SENDER_RECEIVER_BUFFER_SIZE LIBSPDM_RECEIVER_BUFFER_SIZE
#endif

/* Maximum size of a large SPDM message.
* If chunk is unsupported, it must be same as DATA_TRANSFER_SIZE.
* If chunk is supported, it must be larger than DATA_TRANSFER_SIZE.
* It matches MaxSPDMmsgSize in SPDM specification. */
#ifndef LIBSPDM_MAX_SPDM_MSG_SIZE
#define LIBSPDM_MAX_SPDM_MSG_SIZE 0x1200
#endif

extern uint8_t m_libspdm_use_measurement_spec;
extern uint32_t m_libspdm_use_measurement_hash_algo;
extern uint32_t m_libspdm_use_hash_algo;
Expand Down
2 changes: 1 addition & 1 deletion unit_test/spdm_unit_test_common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int libspdm_unit_test_group_setup(void **state)

libspdm_init_context(spdm_context);
spdm_test_context->scratch_buffer_size =
libspdm_get_sizeof_required_scratch_buffer(spdm_context);
libspdm_get_sizeof_required_scratch_buffer(spdm_context, LIBSPDM_MAX_SPDM_MSG_SIZE);
spdm_test_context->scratch_buffer = (void *)malloc(spdm_test_context->scratch_buffer_size);

libspdm_register_device_io_func(spdm_context,
Expand Down
8 changes: 8 additions & 0 deletions unit_test/spdm_unit_test_common/spdm_unit_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ typedef struct {
#define LIBSPDM_MAX_SENDER_RECEIVER_BUFFER_SIZE LIBSPDM_RECEIVER_BUFFER_SIZE
#endif

/* Maximum size of a large SPDM message.
* If chunk is unsupported, it must be same as DATA_TRANSFER_SIZE.
* If chunk is supported, it must be larger than DATA_TRANSFER_SIZE.
* It matches MaxSPDMmsgSize in SPDM specification. */
#ifndef LIBSPDM_MAX_SPDM_MSG_SIZE
#define LIBSPDM_MAX_SPDM_MSG_SIZE 0x1200
#endif

extern uint8_t m_libspdm_use_measurement_spec;
extern uint32_t m_libspdm_use_measurement_hash_algo;
extern uint32_t m_libspdm_use_hash_algo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
#define LIBSPDM_MAX_SENDER_RECEIVER_BUFFER_SIZE LIBSPDM_RECEIVER_BUFFER_SIZE
#endif

/* Maximum size of a large SPDM message.
* If chunk is unsupported, it must be same as DATA_TRANSFER_SIZE.
* If chunk is supported, it must be larger than DATA_TRANSFER_SIZE.
* It matches MaxSPDMmsgSize in SPDM specification. */
#ifndef LIBSPDM_MAX_SPDM_MSG_SIZE
#define LIBSPDM_MAX_SPDM_MSG_SIZE 0x1200
#endif

#if LIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP
#define LIBSPDM_SCRATCH_BUFFER_SECURE_MESSAGE_CAPACITY (LIBSPDM_MAX_SPDM_MSG_SIZE + \
LIBSPDM_TRANSPORT_ADDITIONAL_SIZE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
#define LIBSPDM_MAX_SENDER_RECEIVER_BUFFER_SIZE LIBSPDM_RECEIVER_BUFFER_SIZE
#endif

/* Maximum size of a large SPDM message.
* If chunk is unsupported, it must be same as DATA_TRANSFER_SIZE.
* If chunk is supported, it must be larger than DATA_TRANSFER_SIZE.
* It matches MaxSPDMmsgSize in SPDM specification. */
#ifndef LIBSPDM_MAX_SPDM_MSG_SIZE
#define LIBSPDM_MAX_SPDM_MSG_SIZE 0x1200
#endif

#if LIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP
#define LIBSPDM_SCRATCH_BUFFER_SECURE_MESSAGE_CAPACITY (LIBSPDM_MAX_SPDM_MSG_SIZE + \
LIBSPDM_TRANSPORT_ADDITIONAL_SIZE)
Expand Down

0 comments on commit 3a31939

Please sign in to comment.