Skip to content

Commit

Permalink
Assign correct key pair number for test.
Browse files Browse the repository at this point in the history
Signed-off-by: Jiewen Yao <[email protected]>
  • Loading branch information
jyao1 committed Dec 3, 2024
1 parent 95bac14 commit 900ea17
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "spdm_unit_fuzzing.h"
#include "toolchain_harness.h"
#include "internal/libspdm_responder_lib.h"
#include "spdm_device_secret_lib_internal.h"

#if LIBSPDM_ENABLE_CAPABILITY_SET_KEY_PAIR_INFO_CAP

Expand All @@ -33,7 +34,7 @@ void libspdm_test_responder_set_key_pair_info_ack(void **State)
m_libspdm_use_asym_algo;
spdm_context->local_context.capability.flags |=
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_SET_KEY_PAIR_INFO_CAP;
spdm_context->local_context.total_key_pairs = 16;
spdm_context->local_context.total_key_pairs = libspdm_read_total_key_pairs();

response_size = sizeof(response);
libspdm_get_response_set_key_pair_info_ack(spdm_context,
Expand Down
10 changes: 5 additions & 5 deletions unit_test/test_spdm_responder/key_pair_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void libspdm_test_responder_key_pair_info_case1(void **state)
m_libspdm_use_asym_algo;
spdm_context->local_context.capability.flags |=
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_GET_KEY_PAIR_INFO_CAP;
spdm_context->local_context.total_key_pairs = 16;
spdm_context->local_context.total_key_pairs = libspdm_read_total_key_pairs();

key_pair_id = 4;
public_key_info_len = sizeof(public_key_info_ecp256);
Expand Down Expand Up @@ -96,7 +96,7 @@ void libspdm_test_responder_key_pair_info_case2(void **state)
key_pair_id = 0;
m_libspdm_get_key_pair_info_request1.key_pair_id = key_pair_id;

spdm_context->local_context.total_key_pairs = 1;
spdm_context->local_context.total_key_pairs = libspdm_read_total_key_pairs();

response_size = sizeof(response);

Expand Down Expand Up @@ -136,9 +136,9 @@ void libspdm_test_responder_key_pair_info_case3(void **state)
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_GET_KEY_PAIR_INFO_CAP;

/* key_pair_id > total_key_pairs*/
key_pair_id = 2;
key_pair_id = libspdm_read_total_key_pairs() + 1;
m_libspdm_get_key_pair_info_request1.key_pair_id = key_pair_id;
spdm_context->local_context.total_key_pairs = 1;
spdm_context->local_context.total_key_pairs = libspdm_read_total_key_pairs();

response_size = sizeof(response);

Expand Down Expand Up @@ -181,7 +181,7 @@ void libspdm_test_responder_key_pair_info_case4(void **state)
key_pair_id = 1;
m_libspdm_get_key_pair_info_request1.key_pair_id = key_pair_id;

spdm_context->local_context.total_key_pairs = key_pair_id;
spdm_context->local_context.total_key_pairs = libspdm_read_total_key_pairs();

response_size = sizeof(response);

Expand Down
6 changes: 3 additions & 3 deletions unit_test/test_spdm_responder/set_key_pair_info_ack.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void libspdm_test_responder_set_key_pair_info_ack_case1(void **state)
m_libspdm_use_asym_algo;
spdm_context->local_context.capability.flags |=
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_SET_KEY_PAIR_INFO_CAP;
spdm_context->local_context.total_key_pairs = 16;
spdm_context->local_context.total_key_pairs = libspdm_read_total_key_pairs();
key_pair_id = 4;

response_size = sizeof(response);
Expand Down Expand Up @@ -161,7 +161,7 @@ void libspdm_test_responder_set_key_pair_info_ack_case2(void **state)
m_libspdm_use_asym_algo;
spdm_context->local_context.capability.flags |=
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_SET_KEY_PAIR_INFO_CAP;
spdm_context->local_context.total_key_pairs = 16;
spdm_context->local_context.total_key_pairs = libspdm_read_total_key_pairs();
key_pair_id = 4;

/*set responder need reset*/
Expand Down Expand Up @@ -318,7 +318,7 @@ void libspdm_test_responder_set_key_pair_info_ack_case3(void **state)
m_libspdm_use_asym_algo;
spdm_context->local_context.capability.flags |=
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_SET_KEY_PAIR_INFO_CAP;
spdm_context->local_context.total_key_pairs = 16;
spdm_context->local_context.total_key_pairs = libspdm_read_total_key_pairs();
key_pair_id = 4;

/*set responder need reset*/
Expand Down

0 comments on commit 900ea17

Please sign in to comment.