@@ -145,6 +145,8 @@ static libspdm_return_t libspdm_requester_get_capabilities_test_send_message(
145
145
return LIBSPDM_STATUS_SUCCESS ;
146
146
case 0x23 :
147
147
return LIBSPDM_STATUS_SUCCESS ;
148
+ case 0x24 :
149
+ return LIBSPDM_STATUS_SUCCESS ;
148
150
default :
149
151
return LIBSPDM_STATUS_SEND_FAIL ;
150
152
}
@@ -417,7 +419,8 @@ static libspdm_return_t libspdm_requester_get_capabilities_test_receive_message(
417
419
size_t spdm_response_size ;
418
420
size_t transport_header_size ;
419
421
420
- spdm_response_size = sizeof (spdm_capabilities_response_t );
422
+ spdm_response_size = sizeof (spdm_capabilities_response_t ) -
423
+ sizeof (spdm_supported_algorithms_block_t );
421
424
transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE ;
422
425
spdm_response = (void * )((uint8_t * )* response + transport_header_size );
423
426
@@ -913,7 +916,8 @@ static libspdm_return_t libspdm_requester_get_capabilities_test_receive_message(
913
916
size_t spdm_response_size ;
914
917
size_t transport_header_size ;
915
918
916
- spdm_response_size = sizeof (spdm_capabilities_response_t );
919
+ spdm_response_size = sizeof (spdm_capabilities_response_t ) -
920
+ sizeof (spdm_supported_algorithms_block_t );
917
921
transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE ;
918
922
spdm_response = (void * )((uint8_t * )* response + transport_header_size );
919
923
@@ -926,6 +930,7 @@ static libspdm_return_t libspdm_requester_get_capabilities_test_receive_message(
926
930
spdm_response -> flags = LIBSPDM_DEFAULT_CAPABILITY_RESPONSE_FLAG_VERSION_11 ;
927
931
928
932
spdm_response_size = sizeof (spdm_capabilities_response_t ) -
933
+ sizeof (spdm_supported_algorithms_block_t )-
929
934
sizeof (spdm_response -> data_transfer_size ) -
930
935
sizeof (spdm_response -> max_spdm_msg_size );
931
936
@@ -1008,6 +1013,59 @@ static libspdm_return_t libspdm_requester_get_capabilities_test_receive_message(
1008
1013
spdm_response -> flags = LIBSPDM_DEFAULT_CAPABILITY_RESPONSE_FLAG_VERSION_13 ;
1009
1014
spdm_response -> data_transfer_size = LIBSPDM_DATA_TRANSFER_SIZE ;
1010
1015
spdm_response -> max_spdm_msg_size = LIBSPDM_MAX_SPDM_MSG_SIZE ;
1016
+ libspdm_transport_test_encode_message (spdm_context , NULL , false,
1017
+ false, spdm_response_size ,
1018
+ spdm_response ,
1019
+ response_size , response );
1020
+ }
1021
+ return LIBSPDM_STATUS_SUCCESS ;
1022
+ case 0x24 : {
1023
+ spdm_capabilities_response_t * spdm_response ;
1024
+ size_t spdm_response_size ;
1025
+ size_t transport_header_size ;
1026
+
1027
+ spdm_response_size = sizeof (spdm_capabilities_response_t );
1028
+ transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE ;
1029
+ spdm_response = (void * )((uint8_t * )* response + transport_header_size );
1030
+
1031
+ libspdm_zero_mem (spdm_response , spdm_response_size );
1032
+ spdm_response -> header .spdm_version = SPDM_MESSAGE_VERSION_13 ;
1033
+ spdm_response -> header .request_response_code = SPDM_CAPABILITIES ;
1034
+ spdm_response -> header .param1 = 0 ;
1035
+ spdm_response -> header .param2 = 0 ;
1036
+ spdm_response -> ct_exponent = 0 ;
1037
+ spdm_response -> flags = LIBSPDM_DEFAULT_CAPABILITY_RESPONSE_FLAG_VERSION_13 ;
1038
+ spdm_response -> data_transfer_size = LIBSPDM_DATA_TRANSFER_SIZE ;
1039
+ spdm_response -> max_spdm_msg_size = LIBSPDM_MAX_SPDM_MSG_SIZE ;
1040
+
1041
+ spdm_response -> supported_algorithms .param1 = 4 ;
1042
+ spdm_response -> supported_algorithms .param2 = 0 ;
1043
+ spdm_response -> supported_algorithms .length = sizeof (spdm_supported_algorithms_block_t );
1044
+ spdm_response -> supported_algorithms .measurement_specification = SPDM_MEASUREMENT_SPECIFICATION_DMTF ;
1045
+ spdm_response -> supported_algorithms .other_params_support = 0 ;
1046
+ spdm_response -> supported_algorithms .base_asym_algo = m_libspdm_use_asym_algo ;
1047
+ spdm_response -> supported_algorithms .base_hash_algo = m_libspdm_use_hash_algo ;
1048
+ spdm_response -> supported_algorithms .ext_asym_count = 0 ;
1049
+ spdm_response -> supported_algorithms .ext_hash_count = 0 ;
1050
+ spdm_response -> supported_algorithms .mel_specification = SPDM_MEL_SPECIFICATION_DMTF ;
1051
+
1052
+
1053
+ spdm_response -> supported_algorithms .struct_table [0 ].alg_type = SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE ;
1054
+ spdm_response -> supported_algorithms .struct_table [0 ].alg_count = 0x20 ;
1055
+ spdm_response -> supported_algorithms .struct_table [0 ].alg_supported = SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_256_R1 ;
1056
+
1057
+ spdm_response -> supported_algorithms .struct_table [1 ].alg_type = SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD ;
1058
+ spdm_response -> supported_algorithms .struct_table [1 ].alg_count = 0x20 ;
1059
+ spdm_response -> supported_algorithms .struct_table [1 ].alg_supported = SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AES_256_GCM ;;
1060
+
1061
+ spdm_response -> supported_algorithms .struct_table [2 ].alg_type = SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG ;
1062
+ spdm_response -> supported_algorithms .struct_table [2 ].alg_count = 0x20 ;
1063
+ spdm_response -> supported_algorithms .struct_table [2 ].alg_supported = SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_2048 ;
1064
+
1065
+ spdm_response -> supported_algorithms .struct_table [3 ].alg_type = SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE ;
1066
+ spdm_response -> supported_algorithms .struct_table [3 ].alg_count = 0x20 ;
1067
+ spdm_response -> supported_algorithms .struct_table [3 ].alg_supported = SPDM_ALGORITHMS_KEY_SCHEDULE_HMAC_HASH ;
1068
+
1011
1069
libspdm_transport_test_encode_message (spdm_context , NULL , false,
1012
1070
false, spdm_response_size ,
1013
1071
spdm_response ,
@@ -1405,6 +1463,46 @@ static void libspdm_test_requester_get_capabilities_case35(void **state)
1405
1463
SPDM_VERSION_NUMBER_SHIFT_BIT ;
1406
1464
spdm_context -> connection_info .connection_state = LIBSPDM_CONNECTION_STATE_AFTER_VERSION ;
1407
1465
spdm_context -> local_context .capability .ct_exponent = 0 ;
1466
+ spdm_context -> local_context .capability .param1 = 0 ;
1467
+
1468
+ status = libspdm_get_capabilities (spdm_context );
1469
+ assert_int_equal (status , LIBSPDM_STATUS_SUCCESS );
1470
+ assert_int_equal (spdm_context -> connection_info .capability .max_spdm_msg_size ,
1471
+ LIBSPDM_MAX_SPDM_MSG_SIZE );
1472
+ assert_int_equal (spdm_context -> connection_info .capability .data_transfer_size ,
1473
+ LIBSPDM_DATA_TRANSFER_SIZE );
1474
+ assert_int_equal (spdm_context -> connection_info .capability .ct_exponent , 0 );
1475
+ assert_int_equal (spdm_context -> connection_info .capability .flags ,
1476
+ LIBSPDM_DEFAULT_CAPABILITY_RESPONSE_FLAG_VERSION_13 );
1477
+ }
1478
+
1479
+ static void libspdm_test_requester_get_capabilities_case36 (void * * state )
1480
+ {
1481
+ libspdm_return_t status ;
1482
+ libspdm_test_context_t * spdm_test_context ;
1483
+ libspdm_context_t * spdm_context ;
1484
+
1485
+ spdm_test_context = * state ;
1486
+ spdm_context = spdm_test_context -> spdm_context ;
1487
+ spdm_test_context -> case_id = 0x24 ;
1488
+ spdm_context -> connection_info .version = SPDM_MESSAGE_VERSION_13 <<
1489
+ SPDM_VERSION_NUMBER_SHIFT_BIT ;
1490
+ spdm_context -> connection_info .connection_state = LIBSPDM_CONNECTION_STATE_AFTER_VERSION ;
1491
+ spdm_context -> local_context .capability .ct_exponent = 0 ;
1492
+
1493
+ spdm_context -> local_context .capability .param1 = 1 ;
1494
+
1495
+ spdm_context -> local_context .algorithm .param1 = 4 ;
1496
+ spdm_context -> local_context .algorithm .measurement_spec = SPDM_MEASUREMENT_SPECIFICATION_DMTF ;
1497
+ spdm_context -> local_context .algorithm .other_params_support = 0 ;
1498
+ spdm_context -> local_context .algorithm .base_asym_algo = m_libspdm_use_asym_algo ;
1499
+ spdm_context -> local_context .algorithm .base_hash_algo = m_libspdm_use_hash_algo ;
1500
+ spdm_context -> local_context .algorithm .mel_spec = SPDM_MEL_SPECIFICATION_DMTF ;
1501
+
1502
+ spdm_context -> local_context .algorithm .dhe_named_group = m_libspdm_use_dhe_algo ;
1503
+ spdm_context -> local_context .algorithm .aead_cipher_suite = m_libspdm_use_aead_algo ;
1504
+ spdm_context -> local_context .algorithm .req_base_asym_alg = m_libspdm_use_req_asym_algo ;
1505
+ spdm_context -> local_context .algorithm .key_schedule = m_libspdm_use_key_schedule_algo ;
1408
1506
1409
1507
status = libspdm_get_capabilities (spdm_context );
1410
1508
assert_int_equal (status , LIBSPDM_STATUS_SUCCESS );
@@ -1455,6 +1553,7 @@ int libspdm_requester_get_capabilities_test_main(void)
1455
1553
cmocka_unit_test (libspdm_test_requester_get_capabilities_case33 ),
1456
1554
/* cmocka_unit_test(libspdm_test_requester_get_capabilities_case34), */
1457
1555
cmocka_unit_test (libspdm_test_requester_get_capabilities_case35 ),
1556
+ cmocka_unit_test (libspdm_test_requester_get_capabilities_case36 ),
1458
1557
};
1459
1558
1460
1559
libspdm_test_context_t test_context = {
0 commit comments