LCOV - code coverage report
Current view: top level - unit_test/test_spdm_requester - negotiate_algorithms.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 50.4 % 1259 634
Test Date: 2026-02-22 08:11:49 Functions: 100.0 % 39 39

            Line data    Source code
       1              : /**
       2              :  *  Copyright Notice:
       3              :  *  Copyright 2021-2026 DMTF. All rights reserved.
       4              :  *  License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
       5              :  **/
       6              : 
       7              : #include "spdm_unit_test.h"
       8              : #include "internal/libspdm_requester_lib.h"
       9              : 
      10              : #pragma pack(1)
      11              : typedef struct {
      12              :     spdm_message_header_t header;
      13              :     uint16_t length;
      14              :     uint8_t measurement_specification_sel;
      15              :     uint8_t other_params_selection;
      16              :     uint32_t measurement_hash_algo;
      17              :     uint32_t base_asym_sel;
      18              :     uint32_t base_hash_sel;
      19              :     uint8_t reserved2[11];
      20              :     uint8_t mel_specification_sel;
      21              :     uint8_t ext_asym_sel_count;
      22              :     uint8_t ext_hash_sel_count;
      23              :     uint16_t reserved3;
      24              :     spdm_negotiate_algorithms_common_struct_table_t struct_table[4];
      25              : } libspdm_algorithms_response_spdm11_t;
      26              : #pragma pack()
      27              : 
      28              : static size_t m_libspdm_local_buffer_size;
      29              : static uint8_t m_libspdm_local_buffer[LIBSPDM_MAX_MESSAGE_VCA_BUFFER_SIZE];
      30              : 
      31              : static uint8_t m_connection_other_params_support;
      32              : 
      33              : static uint8_t m_mel_specification_sel;
      34              : 
      35              : static uint8_t m_measurement_specification_sel;
      36              : 
      37           29 : static libspdm_return_t send_message(
      38              :     void *spdm_context, size_t request_size, const void *request, uint64_t timeout)
      39              : {
      40              :     libspdm_test_context_t *spdm_test_context;
      41              : 
      42           29 :     spdm_test_context = libspdm_get_test_context();
      43           29 :     switch (spdm_test_context->case_id) {
      44            0 :     case 0x1:
      45            0 :         return LIBSPDM_STATUS_SEND_FAIL;
      46            1 :     case 0x2:
      47            1 :         return LIBSPDM_STATUS_SUCCESS;
      48            8 :     case 0x3:
      49            8 :         return LIBSPDM_STATUS_SUCCESS;
      50            0 :     case 0x4:
      51            0 :         return LIBSPDM_STATUS_SUCCESS;
      52            0 :     case 0x5:
      53            0 :         return LIBSPDM_STATUS_SUCCESS;
      54            2 :     case 0x6:
      55            2 :         return LIBSPDM_STATUS_SUCCESS;
      56            0 :     case 0x7:
      57            0 :         return LIBSPDM_STATUS_SUCCESS;
      58            0 :     case 0x8:
      59            0 :         return LIBSPDM_STATUS_SUCCESS;
      60            0 :     case 0x9:
      61            0 :         return LIBSPDM_STATUS_SUCCESS;
      62            0 :     case 0xA:
      63            0 :         return LIBSPDM_STATUS_SUCCESS;
      64            0 :     case 0xB:
      65            0 :         return LIBSPDM_STATUS_SUCCESS;
      66            0 :     case 0xC:
      67            0 :         return LIBSPDM_STATUS_SUCCESS;
      68            0 :     case 0xD:
      69            0 :         return LIBSPDM_STATUS_SUCCESS;
      70            0 :     case 0xE:
      71            0 :         return LIBSPDM_STATUS_SUCCESS;
      72            0 :     case 0xF:
      73            0 :         return LIBSPDM_STATUS_SUCCESS;
      74            0 :     case 0x10:
      75            0 :         return LIBSPDM_STATUS_SUCCESS;
      76            0 :     case 0x11:
      77            0 :         return LIBSPDM_STATUS_SUCCESS;
      78            0 :     case 0x12:
      79            0 :         return LIBSPDM_STATUS_SUCCESS;
      80            0 :     case 0x13:
      81            0 :         return LIBSPDM_STATUS_SUCCESS;
      82            0 :     case 0x14:
      83            0 :         return LIBSPDM_STATUS_SUCCESS;
      84            0 :     case 0x15:
      85            0 :         return LIBSPDM_STATUS_SUCCESS;
      86            0 :     case 0x16:
      87            0 :         return LIBSPDM_STATUS_SUCCESS;
      88            1 :     case 0x17:
      89            1 :         return LIBSPDM_STATUS_SUCCESS;
      90            0 :     case 0x18:
      91            0 :         return LIBSPDM_STATUS_SUCCESS;
      92            0 :     case 0x19:
      93            0 :         return LIBSPDM_STATUS_SUCCESS;
      94            0 :     case 0x1A:
      95            0 :         return LIBSPDM_STATUS_SUCCESS;
      96            0 :     case 0x1B:
      97            0 :         return LIBSPDM_STATUS_SUCCESS;
      98            0 :     case 0x1C:
      99            0 :         return LIBSPDM_STATUS_SUCCESS;
     100            0 :     case 0x1D:
     101            0 :         return LIBSPDM_STATUS_SUCCESS;
     102            0 :     case 0x1E:
     103            0 :         return LIBSPDM_STATUS_SUCCESS;
     104            0 :     case 0x1F:
     105            0 :         return LIBSPDM_STATUS_SUCCESS;
     106            1 :     case 0x20: {
     107            1 :         const uint8_t *ptr = (const uint8_t *)request;
     108              : 
     109            1 :         m_libspdm_local_buffer_size = 0;
     110            1 :         libspdm_copy_mem(m_libspdm_local_buffer, sizeof(m_libspdm_local_buffer),
     111            1 :                          &ptr[1], request_size - 1);
     112            1 :         m_libspdm_local_buffer_size += (request_size - 1);
     113              :     }
     114            1 :         return LIBSPDM_STATUS_SUCCESS;
     115            2 :     case 0x21: {
     116              :         const spdm_negotiate_algorithms_request_t *spdm_request;
     117            2 :         spdm_request =
     118              :             (const spdm_negotiate_algorithms_request_t *)((const uint8_t *)request +
     119              :                                                           sizeof(libspdm_test_message_header_t));
     120              : 
     121            2 :         assert_int_equal (spdm_request->header.spdm_version, SPDM_MESSAGE_VERSION_12);
     122            2 :         assert_int_equal (spdm_request->header.request_response_code, SPDM_NEGOTIATE_ALGORITHMS);
     123            2 :         assert_int_equal (spdm_request->other_params_support, SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_1);
     124              :     }
     125            2 :         return LIBSPDM_STATUS_SUCCESS;
     126           14 :     case 0x22:
     127              :     case 0x23:
     128              :     case 0x24:
     129           14 :         return LIBSPDM_STATUS_SUCCESS;
     130            0 :     default:
     131            0 :         return LIBSPDM_STATUS_SEND_FAIL;
     132              :     }
     133              : }
     134              : 
     135           29 : static libspdm_return_t receive_message(
     136              :     void *spdm_context, size_t *response_size, void **response, uint64_t timeout)
     137              : {
     138              :     libspdm_test_context_t *spdm_test_context;
     139              : 
     140           29 :     spdm_test_context = libspdm_get_test_context();
     141           29 :     switch (spdm_test_context->case_id) {
     142            0 :     case 0x1:
     143            0 :         return LIBSPDM_STATUS_RECEIVE_FAIL;
     144              : 
     145            1 :     case 0x2: {
     146              :         spdm_algorithms_response_t *spdm_response;
     147              :         size_t spdm_response_size;
     148              :         size_t transport_header_size;
     149              : 
     150            1 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     151            1 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     152            1 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     153              : 
     154            1 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     155            1 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     156            1 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     157            1 :         spdm_response->header.param1 = 0;
     158            1 :         spdm_response->header.param2 = 0;
     159            1 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     160            1 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     161            1 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     162            1 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     163            1 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     164            1 :         spdm_response->ext_asym_sel_count = 0;
     165            1 :         spdm_response->ext_hash_sel_count = 0;
     166              : 
     167            1 :         libspdm_transport_test_encode_message(spdm_context, NULL, false,
     168              :                                               false, spdm_response_size,
     169              :                                               spdm_response,
     170              :                                               response_size, response);
     171              :     }
     172            1 :         return LIBSPDM_STATUS_SUCCESS;
     173              : 
     174            8 :     case 0x3: {
     175              :         spdm_algorithms_response_t *spdm_response;
     176              :         size_t spdm_response_size;
     177              :         size_t transport_header_size;
     178              : 
     179            8 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     180            8 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     181            8 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     182              : 
     183            8 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     184            8 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     185            8 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     186            8 :         spdm_response->header.param1 = 0;
     187            8 :         spdm_response->header.param2 = 0;
     188            8 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     189            8 :         spdm_response->measurement_specification_sel = m_measurement_specification_sel;
     190            8 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     191            8 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     192            8 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     193            8 :         spdm_response->ext_asym_sel_count = 0;
     194            8 :         spdm_response->ext_hash_sel_count = 0;
     195              : 
     196            8 :         libspdm_transport_test_encode_message(spdm_context, NULL, false,
     197              :                                               false, spdm_response_size,
     198              :                                               spdm_response,
     199              :                                               response_size, response);
     200              :     }
     201            8 :         return LIBSPDM_STATUS_SUCCESS;
     202              : 
     203            0 :     case 0x4: {
     204              :         spdm_error_response_t *spdm_response;
     205              :         size_t spdm_response_size;
     206              :         size_t transport_header_size;
     207              : 
     208            0 :         spdm_response_size = sizeof(spdm_error_response_t);
     209            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     210            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     211              : 
     212            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     213            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     214            0 :         spdm_response->header.request_response_code = SPDM_ERROR;
     215            0 :         spdm_response->header.param1 = SPDM_ERROR_CODE_INVALID_REQUEST;
     216            0 :         spdm_response->header.param2 = 0;
     217              : 
     218            0 :         libspdm_transport_test_encode_message(spdm_context, NULL, false,
     219              :                                               false, spdm_response_size,
     220              :                                               spdm_response,
     221              :                                               response_size, response);
     222              :     }
     223            0 :         return LIBSPDM_STATUS_SUCCESS;
     224              : 
     225            0 :     case 0x5: {
     226              :         spdm_error_response_t *spdm_response;
     227              :         size_t spdm_response_size;
     228              :         size_t transport_header_size;
     229              : 
     230            0 :         spdm_response_size = sizeof(spdm_error_response_t);
     231            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     232            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     233              : 
     234            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     235            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     236            0 :         spdm_response->header.request_response_code = SPDM_ERROR;
     237            0 :         spdm_response->header.param1 = SPDM_ERROR_CODE_BUSY;
     238            0 :         spdm_response->header.param2 = 0;
     239              : 
     240            0 :         libspdm_transport_test_encode_message(spdm_context, NULL, false,
     241              :                                               false, spdm_response_size,
     242              :                                               spdm_response,
     243              :                                               response_size, response);
     244              :     }
     245            0 :         return LIBSPDM_STATUS_SUCCESS;
     246              : 
     247            2 :     case 0x6: {
     248              :         static size_t sub_index1 = 0;
     249            2 :         if (sub_index1 == 0) {
     250              :             spdm_error_response_t *spdm_response;
     251              :             size_t spdm_response_size;
     252              :             size_t transport_header_size;
     253              : 
     254            1 :             spdm_response_size = sizeof(spdm_error_response_t);
     255            1 :             transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     256            1 :             spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     257              : 
     258            1 :             libspdm_zero_mem(spdm_response, spdm_response_size);
     259            1 :             spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     260            1 :             spdm_response->header.request_response_code = SPDM_ERROR;
     261            1 :             spdm_response->header.param1 = SPDM_ERROR_CODE_BUSY;
     262            1 :             spdm_response->header.param2 = 0;
     263              : 
     264            1 :             libspdm_transport_test_encode_message(
     265              :                 spdm_context, NULL, false, false,
     266              :                 spdm_response_size, spdm_response,
     267              :                 response_size, response);
     268            1 :         } else if (sub_index1 == 1) {
     269              :             spdm_algorithms_response_t *spdm_response;
     270              :             size_t spdm_response_size;
     271              :             size_t transport_header_size;
     272              : 
     273            1 :             spdm_response_size = sizeof(spdm_algorithms_response_t);
     274            1 :             transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     275            1 :             spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     276              : 
     277            1 :             libspdm_zero_mem(spdm_response, spdm_response_size);
     278            1 :             spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     279            1 :             spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     280            1 :             spdm_response->header.param1 = 0;
     281            1 :             spdm_response->header.param2 = 0;
     282            1 :             spdm_response->length = sizeof(spdm_algorithms_response_t);
     283            1 :             spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     284            1 :             spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     285            1 :             spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     286            1 :             spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     287            1 :             spdm_response->ext_asym_sel_count = 0;
     288            1 :             spdm_response->ext_hash_sel_count = 0;
     289              : 
     290            1 :             libspdm_transport_test_encode_message(
     291              :                 spdm_context, NULL, false, false,
     292              :                 spdm_response_size, spdm_response,
     293              :                 response_size, response);
     294              :         }
     295            2 :         sub_index1++;
     296              :     }
     297            2 :         return LIBSPDM_STATUS_SUCCESS;
     298              : 
     299            0 :     case 0x7: {
     300              :         spdm_error_response_t *spdm_response;
     301              :         size_t spdm_response_size;
     302              :         size_t transport_header_size;
     303              : 
     304            0 :         spdm_response_size = sizeof(spdm_error_response_t);
     305            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     306            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     307              : 
     308            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     309            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     310            0 :         spdm_response->header.request_response_code = SPDM_ERROR;
     311            0 :         spdm_response->header.param1 = SPDM_ERROR_CODE_REQUEST_RESYNCH;
     312            0 :         spdm_response->header.param2 = 0;
     313              : 
     314            0 :         libspdm_transport_test_encode_message(spdm_context, NULL, false,
     315              :                                               false, spdm_response_size,
     316              :                                               spdm_response,
     317              :                                               response_size, response);
     318              :     }
     319            0 :         return LIBSPDM_STATUS_SUCCESS;
     320              : 
     321            0 :     case 0x8: {
     322              :         spdm_error_response_data_response_not_ready_t *spdm_response;
     323              :         size_t spdm_response_size;
     324              :         size_t transport_header_size;
     325              : 
     326            0 :         spdm_response_size = sizeof(spdm_error_response_data_response_not_ready_t);
     327            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     328            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     329              : 
     330            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     331            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     332            0 :         spdm_response->header.request_response_code = SPDM_ERROR;
     333            0 :         spdm_response->header.param1 = SPDM_ERROR_CODE_RESPONSE_NOT_READY;
     334            0 :         spdm_response->header.param2 = 0;
     335            0 :         spdm_response->extend_error_data.rd_exponent = 1;
     336            0 :         spdm_response->extend_error_data.rd_tm = 2;
     337            0 :         spdm_response->extend_error_data.request_code = SPDM_NEGOTIATE_ALGORITHMS;
     338            0 :         spdm_response->extend_error_data.token = 0;
     339              : 
     340            0 :         libspdm_transport_test_encode_message(spdm_context, NULL, false,
     341              :                                               false, spdm_response_size,
     342              :                                               spdm_response,
     343              :                                               response_size, response);
     344              :     }
     345            0 :         return LIBSPDM_STATUS_SUCCESS;
     346              : 
     347            0 :     case 0x9:
     348            0 :         return LIBSPDM_STATUS_SUCCESS;
     349              : 
     350            0 :     case 0xA: {
     351              :         spdm_algorithms_response_t *spdm_response;
     352              :         size_t spdm_response_size;
     353              :         size_t transport_header_size;
     354              : 
     355            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     356            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     357            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     358              : 
     359            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     360            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     361            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     362            0 :         spdm_response->header.param1 = 0;
     363            0 :         spdm_response->header.param2 = 0;
     364            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     365            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     366            0 :         spdm_response->measurement_hash_algo = 0;
     367            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     368            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     369            0 :         spdm_response->ext_asym_sel_count = 0;
     370            0 :         spdm_response->ext_hash_sel_count = 0;
     371              : 
     372            0 :         libspdm_transport_test_encode_message(spdm_context, NULL, false,
     373              :                                               false, spdm_response_size,
     374              :                                               spdm_response,
     375              :                                               response_size, response);
     376              :     }
     377            0 :         return LIBSPDM_STATUS_SUCCESS;
     378              : 
     379            0 :     case 0xB: {
     380              :         spdm_algorithms_response_t *spdm_response;
     381              :         size_t spdm_response_size;
     382              :         size_t transport_header_size;
     383              : 
     384            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     385            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     386            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     387              : 
     388            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     389            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     390            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     391            0 :         spdm_response->header.param1 = 0;
     392            0 :         spdm_response->header.param2 = 0;
     393            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     394            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     395            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     396            0 :         spdm_response->base_asym_sel = 0;
     397            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     398            0 :         spdm_response->ext_asym_sel_count = 0;
     399            0 :         spdm_response->ext_hash_sel_count = 0;
     400              : 
     401            0 :         libspdm_transport_test_encode_message(spdm_context, NULL, false,
     402              :                                               false, spdm_response_size,
     403              :                                               spdm_response,
     404              :                                               response_size, response);
     405              :     }
     406            0 :         return LIBSPDM_STATUS_SUCCESS;
     407              : 
     408            0 :     case 0xC: {
     409              :         spdm_algorithms_response_t *spdm_response;
     410              :         size_t spdm_response_size;
     411              :         size_t transport_header_size;
     412              : 
     413            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     414            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     415            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     416              : 
     417            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     418            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     419            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     420            0 :         spdm_response->header.param1 = 0;
     421            0 :         spdm_response->header.param2 = 0;
     422            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     423            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     424            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     425            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     426            0 :         spdm_response->base_hash_sel = 0;
     427            0 :         spdm_response->ext_asym_sel_count = 0;
     428            0 :         spdm_response->ext_hash_sel_count = 0;
     429              : 
     430            0 :         libspdm_transport_test_encode_message(spdm_context, NULL, false,
     431              :                                               false, spdm_response_size,
     432              :                                               spdm_response,
     433              :                                               response_size, response);
     434              :     }
     435            0 :         return LIBSPDM_STATUS_SUCCESS;
     436              : 
     437            0 :     case 0xD:
     438              :     {
     439              :         spdm_algorithms_response_t *spdm_response;
     440              :         size_t spdm_response_size;
     441              :         size_t transport_header_size;
     442              : 
     443            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     444            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     445            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     446              : 
     447            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     448            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     449            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     450            0 :         spdm_response->header.param1 = 0;
     451            0 :         spdm_response->header.param2 = 0;
     452            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     453            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     454            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     455            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     456            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     457            0 :         spdm_response->ext_asym_sel_count = 0;
     458            0 :         spdm_response->ext_hash_sel_count = 0;
     459              : 
     460            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     461              :                                                sizeof(spdm_message_header_t), spdm_response,
     462              :                                                response_size, response);
     463              :     }
     464            0 :         return LIBSPDM_STATUS_SUCCESS;
     465              : 
     466            0 :     case 0xE:
     467              :     {
     468              :         spdm_algorithms_response_t *spdm_response;
     469              :         size_t spdm_response_size;
     470              :         size_t transport_header_size;
     471              : 
     472            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     473            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     474            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     475              : 
     476            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     477            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     478            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     479            0 :         spdm_response->header.param1 = 0;
     480            0 :         spdm_response->header.param2 = 0;
     481            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     482            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     483            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     484            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     485            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     486              : 
     487              : 
     488            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     489              :                                                sizeof(spdm_algorithms_response_t)/2, spdm_response,
     490              :                                                response_size, response);
     491              :     }
     492            0 :         return LIBSPDM_STATUS_SUCCESS;
     493              : 
     494            0 :     case 0xF:
     495              :     {
     496              :         spdm_algorithms_response_t *spdm_response;
     497              :         size_t spdm_response_size;
     498              :         size_t transport_header_size;
     499              : 
     500            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     501            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     502            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     503              : 
     504            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     505            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     506            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     507            0 :         spdm_response->header.param1 = 0;
     508            0 :         spdm_response->header.param2 = 0;
     509            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     510            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     511            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     512            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     513            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     514            0 :         spdm_response->ext_asym_sel_count = 2;
     515            0 :         spdm_response->ext_hash_sel_count = 0;
     516              : 
     517            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     518              :                                                spdm_response_size,
     519              :                                                spdm_response, response_size, response);
     520              :     }
     521            0 :         return LIBSPDM_STATUS_SUCCESS;
     522              : 
     523            0 :     case 0x10:
     524              :     {
     525              :         spdm_algorithms_response_t *spdm_response;
     526              :         size_t spdm_response_size;
     527              :         size_t transport_header_size;
     528              : 
     529            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     530            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     531            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     532              : 
     533            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     534            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     535            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     536            0 :         spdm_response->header.param1 = 0;
     537            0 :         spdm_response->header.param2 = 0;
     538            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     539            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     540            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     541            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     542            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     543            0 :         spdm_response->ext_asym_sel_count = 0;
     544            0 :         spdm_response->ext_hash_sel_count = 2;
     545              : 
     546            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     547              :                                                spdm_response_size,
     548              :                                                spdm_response, response_size, response);
     549              :     }
     550            0 :         return LIBSPDM_STATUS_SUCCESS;
     551              : 
     552            0 :     case 0x11:
     553              :     {
     554              :         spdm_algorithms_response_t *spdm_response;
     555              :         size_t spdm_response_size;
     556              :         size_t transport_header_size;
     557              : 
     558            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     559            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     560            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     561              : 
     562            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     563            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     564            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     565            0 :         spdm_response->header.param1 = 0;
     566            0 :         spdm_response->header.param2 = 0;
     567            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     568            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     569            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     570            0 :         spdm_response->base_asym_sel = SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P521;
     571            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     572            0 :         spdm_response->ext_asym_sel_count = 0;
     573            0 :         spdm_response->ext_hash_sel_count = 0;
     574              : 
     575            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     576              :                                                spdm_response_size,
     577              :                                                spdm_response, response_size, response);
     578              :     }
     579            0 :         return LIBSPDM_STATUS_SUCCESS;
     580              : 
     581            0 :     case 0x12:
     582              :     {
     583              :         spdm_algorithms_response_t *spdm_response;
     584              :         size_t spdm_response_size;
     585              :         size_t transport_header_size;
     586              : 
     587            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     588            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     589            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     590              : 
     591            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     592            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     593            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     594            0 :         spdm_response->header.param1 = 0;
     595            0 :         spdm_response->header.param2 = 0;
     596            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     597            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     598            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     599            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     600            0 :         spdm_response->base_hash_sel = SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_512;
     601            0 :         spdm_response->ext_asym_sel_count = 0;
     602            0 :         spdm_response->ext_hash_sel_count = 0;
     603              : 
     604            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     605              :                                                spdm_response_size,
     606              :                                                spdm_response, response_size, response);
     607              :     }
     608            0 :         return LIBSPDM_STATUS_SUCCESS;
     609              : 
     610            0 :     case 0x13:
     611              :     {
     612              :         spdm_algorithms_response_t *spdm_response;
     613              :         size_t spdm_response_size;
     614              :         size_t transport_header_size;
     615              : 
     616            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     617            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     618            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     619              : 
     620            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     621            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     622            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     623            0 :         spdm_response->header.param1 = 0;
     624            0 :         spdm_response->header.param2 = 0;
     625            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     626            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     627            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo|
     628              :                                                SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_512;
     629            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     630            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     631            0 :         spdm_response->ext_asym_sel_count = 0;
     632            0 :         spdm_response->ext_hash_sel_count = 0;
     633              : 
     634            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     635              :                                                spdm_response_size,
     636              :                                                spdm_response, response_size, response);
     637              :     }
     638            0 :         return LIBSPDM_STATUS_SUCCESS;
     639              : 
     640            0 :     case 0x14:
     641              :     {
     642              :         spdm_algorithms_response_t *spdm_response;
     643              :         size_t spdm_response_size;
     644              :         size_t transport_header_size;
     645              : 
     646            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     647            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     648            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     649              : 
     650            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     651            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     652            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     653            0 :         spdm_response->header.param1 = 0;
     654            0 :         spdm_response->header.param2 = 0;
     655            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     656            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     657            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     658            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo|
     659              :                                        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P521;
     660            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     661            0 :         spdm_response->ext_asym_sel_count = 0;
     662            0 :         spdm_response->ext_hash_sel_count = 0;
     663              : 
     664            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     665              :                                                spdm_response_size,
     666              :                                                spdm_response, response_size, response);
     667              :     }
     668            0 :         return LIBSPDM_STATUS_SUCCESS;
     669              : 
     670            0 :     case 0x15:
     671              :     {
     672              :         spdm_algorithms_response_t *spdm_response;
     673              :         size_t spdm_response_size;
     674              :         size_t transport_header_size;
     675              : 
     676            0 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
     677            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     678            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     679              : 
     680            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     681            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
     682            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     683            0 :         spdm_response->header.param1 = 0;
     684            0 :         spdm_response->header.param2 = 0;
     685            0 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
     686            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     687            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     688            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     689            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo|
     690              :                                        SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_512;
     691            0 :         spdm_response->ext_asym_sel_count = 0;
     692            0 :         spdm_response->ext_hash_sel_count = 0;
     693              : 
     694            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     695              :                                                spdm_response_size,
     696              :                                                spdm_response, response_size, response);
     697              :     }
     698            0 :         return LIBSPDM_STATUS_SUCCESS;
     699              : 
     700            0 :     case 0x16:
     701              :     {
     702              :         libspdm_algorithms_response_spdm11_t *spdm_response;
     703              :         size_t spdm_response_size;
     704              :         size_t transport_header_size;
     705              : 
     706            0 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
     707            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     708            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     709              : 
     710            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     711            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_11;
     712            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     713            0 :         spdm_response->header.param1 = 4;
     714            0 :         spdm_response->header.param2 = 0;
     715            0 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
     716            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     717            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     718            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     719            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     720            0 :         spdm_response->ext_asym_sel_count = 0;
     721            0 :         spdm_response->ext_hash_sel_count = 0;
     722            0 :         spdm_response->struct_table[0].alg_type =
     723              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
     724            0 :         spdm_response->struct_table[0].alg_count = 0x20;
     725            0 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
     726            0 :         spdm_response->struct_table[1].alg_type =
     727              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
     728            0 :         spdm_response->struct_table[1].alg_count = 0x20;
     729            0 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
     730            0 :         spdm_response->struct_table[2].alg_type =
     731              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
     732            0 :         spdm_response->struct_table[2].alg_count = 0x20;
     733            0 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
     734            0 :         spdm_response->struct_table[3].alg_type =
     735              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
     736            0 :         spdm_response->struct_table[3].alg_count = 0x20;
     737            0 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
     738              : 
     739            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     740              :                                                spdm_response_size,
     741              :                                                spdm_response, response_size, response);
     742              :     }
     743            0 :         return LIBSPDM_STATUS_SUCCESS;
     744              : 
     745            1 :     case 0x17:
     746              :     {
     747              :         libspdm_algorithms_response_spdm11_t *spdm_response;
     748              :         size_t spdm_response_size;
     749              :         size_t transport_header_size;
     750              : 
     751            1 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
     752            1 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     753            1 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     754              : 
     755            1 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     756            1 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_11;
     757            1 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     758            1 :         spdm_response->header.param1 = 4;
     759            1 :         spdm_response->header.param2 = 0;
     760            1 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
     761            1 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     762            1 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     763            1 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     764            1 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     765            1 :         spdm_response->ext_asym_sel_count = 0;
     766            1 :         spdm_response->ext_hash_sel_count = 0;
     767            1 :         spdm_response->struct_table[0].alg_type =
     768              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
     769            1 :         spdm_response->struct_table[0].alg_count = 0x20;
     770            1 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
     771            1 :         spdm_response->struct_table[1].alg_type =
     772              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
     773            1 :         spdm_response->struct_table[1].alg_count = 0x20;
     774            1 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
     775            1 :         spdm_response->struct_table[2].alg_type =
     776              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
     777            1 :         spdm_response->struct_table[2].alg_count = 0x20;
     778            1 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
     779            1 :         spdm_response->struct_table[3].alg_type =
     780              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
     781            1 :         spdm_response->struct_table[3].alg_count = 0x20;
     782            1 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
     783              : 
     784            1 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     785              :                                                spdm_response_size,
     786              :                                                spdm_response, response_size, response);
     787              :     }
     788            1 :         return LIBSPDM_STATUS_SUCCESS;
     789              : 
     790            0 :     case 0x18:
     791              :     {
     792              :         libspdm_algorithms_response_spdm11_t *spdm_response;
     793              :         size_t spdm_response_size;
     794              :         size_t transport_header_size;
     795              : 
     796            0 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
     797            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     798            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     799              : 
     800            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     801            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_11;
     802            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     803            0 :         spdm_response->header.param1 = 4;
     804            0 :         spdm_response->header.param2 = 0;
     805            0 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
     806            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     807            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     808            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     809            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     810            0 :         spdm_response->ext_asym_sel_count = 0;
     811            0 :         spdm_response->ext_hash_sel_count = 0;
     812            0 :         spdm_response->struct_table[0].alg_type =
     813              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
     814            0 :         spdm_response->struct_table[0].alg_count = 0x20;
     815            0 :         spdm_response->struct_table[0].alg_supported = SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_521_R1;
     816            0 :         spdm_response->struct_table[1].alg_type =
     817              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
     818            0 :         spdm_response->struct_table[1].alg_count = 0x20;
     819            0 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
     820            0 :         spdm_response->struct_table[2].alg_type =
     821              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
     822            0 :         spdm_response->struct_table[2].alg_count = 0x20;
     823            0 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
     824            0 :         spdm_response->struct_table[3].alg_type =
     825              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
     826            0 :         spdm_response->struct_table[3].alg_count = 0x20;
     827            0 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
     828              : 
     829            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     830              :                                                spdm_response_size,
     831              :                                                spdm_response, response_size, response);
     832              :     }
     833            0 :         return LIBSPDM_STATUS_SUCCESS;
     834              : 
     835            0 :     case 0x19:
     836              :     {
     837              :         libspdm_algorithms_response_spdm11_t *spdm_response;
     838              :         size_t spdm_response_size;
     839              :         size_t transport_header_size;
     840              : 
     841            0 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
     842            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     843            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     844              : 
     845            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     846            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_11;
     847            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     848            0 :         spdm_response->header.param1 = 4;
     849            0 :         spdm_response->header.param2 = 0;
     850            0 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
     851            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     852            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     853            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     854            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     855            0 :         spdm_response->ext_asym_sel_count = 0;
     856            0 :         spdm_response->ext_hash_sel_count = 0;
     857            0 :         spdm_response->struct_table[0].alg_type =
     858              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
     859            0 :         spdm_response->struct_table[0].alg_count = 0x20;
     860            0 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
     861            0 :         spdm_response->struct_table[1].alg_type =
     862              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
     863            0 :         spdm_response->struct_table[1].alg_count = 0x20;
     864            0 :         spdm_response->struct_table[1].alg_supported =
     865              :             SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_CHACHA20_POLY1305;
     866            0 :         spdm_response->struct_table[2].alg_type =
     867              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
     868            0 :         spdm_response->struct_table[2].alg_count = 0x20;
     869            0 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
     870            0 :         spdm_response->struct_table[3].alg_type =
     871              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
     872            0 :         spdm_response->struct_table[3].alg_count = 0x20;
     873            0 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
     874              : 
     875            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     876              :                                                spdm_response_size,
     877              :                                                spdm_response, response_size, response);
     878              :     }
     879            0 :         return LIBSPDM_STATUS_SUCCESS;
     880              : 
     881            0 :     case 0x1A:
     882              :     {
     883              :         libspdm_algorithms_response_spdm11_t *spdm_response;
     884              :         size_t spdm_response_size;
     885              :         size_t transport_header_size;
     886              : 
     887            0 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
     888            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     889            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     890              : 
     891            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     892            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_11;
     893            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     894            0 :         spdm_response->header.param1 = 4;
     895            0 :         spdm_response->header.param2 = 0;
     896            0 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
     897            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     898            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     899            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     900            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     901            0 :         spdm_response->ext_asym_sel_count = 0;
     902            0 :         spdm_response->ext_hash_sel_count = 0;
     903            0 :         spdm_response->struct_table[0].alg_type =
     904              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
     905            0 :         spdm_response->struct_table[0].alg_count = 0x20;
     906            0 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
     907            0 :         spdm_response->struct_table[1].alg_type =
     908              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
     909            0 :         spdm_response->struct_table[1].alg_count = 0x20;
     910            0 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
     911            0 :         spdm_response->struct_table[2].alg_type =
     912              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
     913            0 :         spdm_response->struct_table[2].alg_count = 0x20;
     914            0 :         spdm_response->struct_table[2].alg_supported =
     915              :             SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P521;
     916            0 :         spdm_response->struct_table[3].alg_type =
     917              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
     918            0 :         spdm_response->struct_table[3].alg_count = 0x20;
     919            0 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
     920              : 
     921            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     922              :                                                spdm_response_size,
     923              :                                                spdm_response, response_size, response);
     924              :     }
     925            0 :         return LIBSPDM_STATUS_SUCCESS;
     926              : 
     927            0 :     case 0x1B:
     928              :     {
     929              :         libspdm_algorithms_response_spdm11_t *spdm_response;
     930              :         size_t spdm_response_size;
     931              :         size_t transport_header_size;
     932              : 
     933            0 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
     934            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     935            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     936              : 
     937            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     938            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_11;
     939            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     940            0 :         spdm_response->header.param1 = 4;
     941            0 :         spdm_response->header.param2 = 0;
     942            0 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
     943            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     944            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     945            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     946            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     947            0 :         spdm_response->ext_asym_sel_count = 0;
     948            0 :         spdm_response->ext_hash_sel_count = 0;
     949            0 :         spdm_response->struct_table[0].alg_type =
     950              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
     951            0 :         spdm_response->struct_table[0].alg_count = 0x20;
     952            0 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
     953            0 :         spdm_response->struct_table[1].alg_type =
     954              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
     955            0 :         spdm_response->struct_table[1].alg_count = 0x20;
     956            0 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
     957            0 :         spdm_response->struct_table[2].alg_type =
     958              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
     959            0 :         spdm_response->struct_table[2].alg_count = 0x20;
     960            0 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
     961            0 :         spdm_response->struct_table[3].alg_type =
     962              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
     963            0 :         spdm_response->struct_table[3].alg_count = 0x20;
     964            0 :         spdm_response->struct_table[3].alg_supported = 0x00000020;
     965              : 
     966            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
     967              :                                                spdm_response_size,
     968              :                                                spdm_response, response_size, response);
     969              :     }
     970            0 :         return LIBSPDM_STATUS_SUCCESS;
     971              : 
     972            0 :     case 0x1C:
     973              :     {
     974              :         libspdm_algorithms_response_spdm11_t *spdm_response;
     975              :         size_t spdm_response_size;
     976              :         size_t transport_header_size;
     977              : 
     978            0 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
     979            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
     980            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
     981              : 
     982            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
     983            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_11;
     984            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
     985            0 :         spdm_response->header.param1 = 4;
     986            0 :         spdm_response->header.param2 = 0;
     987            0 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
     988            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
     989            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
     990            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
     991            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
     992            0 :         spdm_response->ext_asym_sel_count = 0;
     993            0 :         spdm_response->ext_hash_sel_count = 0;
     994            0 :         spdm_response->struct_table[0].alg_type =
     995              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
     996            0 :         spdm_response->struct_table[0].alg_count = 0x20;
     997            0 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo |
     998              :                                                        SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_521_R1;
     999            0 :         spdm_response->struct_table[1].alg_type =
    1000              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
    1001            0 :         spdm_response->struct_table[1].alg_count = 0x20;
    1002            0 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
    1003            0 :         spdm_response->struct_table[2].alg_type =
    1004              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
    1005            0 :         spdm_response->struct_table[2].alg_count = 0x20;
    1006            0 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
    1007            0 :         spdm_response->struct_table[3].alg_type =
    1008              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
    1009            0 :         spdm_response->struct_table[3].alg_count = 0x20;
    1010            0 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
    1011              : 
    1012            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
    1013              :                                                spdm_response_size,
    1014              :                                                spdm_response, response_size, response);
    1015              :     }
    1016            0 :         return LIBSPDM_STATUS_SUCCESS;
    1017              : 
    1018            0 :     case 0x1D:
    1019              :     {
    1020              :         libspdm_algorithms_response_spdm11_t *spdm_response;
    1021              :         size_t spdm_response_size;
    1022              :         size_t transport_header_size;
    1023              : 
    1024            0 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
    1025            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
    1026            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
    1027              : 
    1028            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
    1029            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_11;
    1030            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
    1031            0 :         spdm_response->header.param1 = 4;
    1032            0 :         spdm_response->header.param2 = 0;
    1033            0 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
    1034            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1035            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
    1036            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
    1037            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
    1038            0 :         spdm_response->ext_asym_sel_count = 0;
    1039            0 :         spdm_response->ext_hash_sel_count = 0;
    1040            0 :         spdm_response->struct_table[0].alg_type =
    1041              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
    1042            0 :         spdm_response->struct_table[0].alg_count = 0x20;
    1043            0 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
    1044            0 :         spdm_response->struct_table[1].alg_type =
    1045              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
    1046            0 :         spdm_response->struct_table[1].alg_count = 0x20;
    1047            0 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo |
    1048              :                                                        SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_CHACHA20_POLY1305;
    1049            0 :         spdm_response->struct_table[2].alg_type =
    1050              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
    1051            0 :         spdm_response->struct_table[2].alg_count = 0x20;
    1052            0 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
    1053            0 :         spdm_response->struct_table[3].alg_type =
    1054              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
    1055            0 :         spdm_response->struct_table[3].alg_count = 0x20;
    1056            0 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
    1057              : 
    1058            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
    1059              :                                                spdm_response_size,
    1060              :                                                spdm_response, response_size, response);
    1061              :     }
    1062            0 :         return LIBSPDM_STATUS_SUCCESS;
    1063              : 
    1064            0 :     case 0x1E:
    1065              :     {
    1066              :         libspdm_algorithms_response_spdm11_t *spdm_response;
    1067              :         size_t spdm_response_size;
    1068              :         size_t transport_header_size;
    1069              : 
    1070            0 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
    1071            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
    1072            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
    1073              : 
    1074            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
    1075            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_11;
    1076            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
    1077            0 :         spdm_response->header.param1 = 4;
    1078            0 :         spdm_response->header.param2 = 0;
    1079            0 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
    1080            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1081            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
    1082            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
    1083            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
    1084            0 :         spdm_response->ext_asym_sel_count = 0;
    1085            0 :         spdm_response->ext_hash_sel_count = 0;
    1086            0 :         spdm_response->struct_table[0].alg_type =
    1087              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
    1088            0 :         spdm_response->struct_table[0].alg_count = 0x20;
    1089            0 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
    1090            0 :         spdm_response->struct_table[1].alg_type =
    1091              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
    1092            0 :         spdm_response->struct_table[1].alg_count = 0x20;
    1093            0 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
    1094            0 :         spdm_response->struct_table[2].alg_type =
    1095              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
    1096            0 :         spdm_response->struct_table[2].alg_count = 0x20;
    1097            0 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo |
    1098              :                                                        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P521;
    1099            0 :         spdm_response->struct_table[3].alg_type =
    1100              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
    1101            0 :         spdm_response->struct_table[3].alg_count = 0x20;
    1102            0 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
    1103              : 
    1104            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
    1105              :                                                spdm_response_size,
    1106              :                                                spdm_response, response_size, response);
    1107              :     }
    1108            0 :         return LIBSPDM_STATUS_SUCCESS;
    1109              : 
    1110            0 :     case 0x1F:
    1111              :     {
    1112              :         libspdm_algorithms_response_spdm11_t *spdm_response;
    1113              :         size_t spdm_response_size;
    1114              :         size_t transport_header_size;
    1115              : 
    1116            0 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
    1117            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
    1118            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
    1119              : 
    1120            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
    1121            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_11;
    1122            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
    1123            0 :         spdm_response->header.param1 = 4;
    1124            0 :         spdm_response->header.param2 = 0;
    1125            0 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
    1126            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1127            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
    1128            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
    1129            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
    1130            0 :         spdm_response->ext_asym_sel_count = 0;
    1131            0 :         spdm_response->ext_hash_sel_count = 0;
    1132            0 :         spdm_response->struct_table[0].alg_type =
    1133              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
    1134            0 :         spdm_response->struct_table[0].alg_count = 0x20;
    1135            0 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
    1136            0 :         spdm_response->struct_table[1].alg_type =
    1137              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
    1138            0 :         spdm_response->struct_table[1].alg_count = 0x20;
    1139            0 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
    1140            0 :         spdm_response->struct_table[2].alg_type =
    1141              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
    1142            0 :         spdm_response->struct_table[2].alg_count = 0x20;
    1143            0 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
    1144            0 :         spdm_response->struct_table[3].alg_type =
    1145              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
    1146            0 :         spdm_response->struct_table[3].alg_count = 0x20;
    1147            0 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo | 0x00000020;
    1148              : 
    1149            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
    1150              :                                                spdm_response_size,
    1151              :                                                spdm_response, response_size, response);
    1152              :     }
    1153            0 :         return LIBSPDM_STATUS_SUCCESS;
    1154              : 
    1155            1 :     case 0x20:
    1156              :     {
    1157              :         libspdm_algorithms_response_spdm11_t *spdm_response;
    1158              :         size_t spdm_response_size;
    1159              :         size_t transport_header_size;
    1160              : 
    1161            1 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
    1162            1 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
    1163            1 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
    1164              : 
    1165            1 :         libspdm_zero_mem(spdm_response, spdm_response_size);
    1166            1 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_11;
    1167            1 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
    1168            1 :         spdm_response->header.param1 = 4;
    1169            1 :         spdm_response->header.param2 = 0;
    1170            1 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
    1171            1 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1172            1 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
    1173            1 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
    1174            1 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
    1175            1 :         spdm_response->ext_asym_sel_count = 0;
    1176            1 :         spdm_response->ext_hash_sel_count = 0;
    1177            1 :         spdm_response->struct_table[0].alg_type =
    1178              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
    1179            1 :         spdm_response->struct_table[0].alg_count = 0x20;
    1180            1 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
    1181            1 :         spdm_response->struct_table[1].alg_type =
    1182              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
    1183            1 :         spdm_response->struct_table[1].alg_count = 0x20;
    1184            1 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
    1185            1 :         spdm_response->struct_table[2].alg_type =
    1186              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
    1187            1 :         spdm_response->struct_table[2].alg_count = 0x20;
    1188            1 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
    1189            1 :         spdm_response->struct_table[3].alg_type =
    1190              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
    1191            1 :         spdm_response->struct_table[3].alg_count = 0x20;
    1192            1 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
    1193              : 
    1194            1 :         libspdm_copy_mem(&m_libspdm_local_buffer[m_libspdm_local_buffer_size],
    1195              :                          sizeof(m_libspdm_local_buffer) - m_libspdm_local_buffer_size,
    1196              :                          (uint8_t *)spdm_response, spdm_response_size);
    1197            1 :         m_libspdm_local_buffer_size += spdm_response_size;
    1198              : 
    1199            1 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
    1200              :                                                spdm_response_size,
    1201              :                                                spdm_response, response_size, response);
    1202              :     }
    1203            1 :         return LIBSPDM_STATUS_SUCCESS;
    1204              : 
    1205            2 :     case 0x21:
    1206              :     {
    1207              :         libspdm_algorithms_response_spdm11_t *spdm_response;
    1208              :         size_t spdm_response_size;
    1209              :         size_t transport_header_size;
    1210              : 
    1211            2 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
    1212            2 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
    1213            2 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
    1214              : 
    1215            2 :         libspdm_zero_mem(spdm_response, spdm_response_size);
    1216            2 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_12;
    1217            2 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
    1218            2 :         spdm_response->header.param1 = 4;
    1219            2 :         spdm_response->header.param2 = 0;
    1220            2 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
    1221            2 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1222            2 :         spdm_response->other_params_selection = SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_1;
    1223            2 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
    1224            2 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
    1225            2 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
    1226            2 :         spdm_response->ext_asym_sel_count = 0;
    1227            2 :         spdm_response->ext_hash_sel_count = 0;
    1228            2 :         spdm_response->struct_table[0].alg_type =
    1229              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
    1230            2 :         spdm_response->struct_table[0].alg_count = 0x20;
    1231            2 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
    1232            2 :         spdm_response->struct_table[1].alg_type =
    1233              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
    1234            2 :         spdm_response->struct_table[1].alg_count = 0x20;
    1235            2 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
    1236            2 :         spdm_response->struct_table[2].alg_type =
    1237              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
    1238            2 :         spdm_response->struct_table[2].alg_count = 0x20;
    1239            2 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
    1240            2 :         spdm_response->struct_table[3].alg_type =
    1241              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
    1242            2 :         spdm_response->struct_table[3].alg_count = 0x20;
    1243            2 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
    1244              : 
    1245            2 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
    1246              :                                                spdm_response_size,
    1247              :                                                spdm_response, response_size, response);
    1248              :     }
    1249            2 :         return LIBSPDM_STATUS_SUCCESS;
    1250              : 
    1251            0 :     case 0x22:
    1252              :     {
    1253              :         libspdm_algorithms_response_spdm11_t *spdm_response;
    1254              :         size_t spdm_response_size;
    1255              :         size_t transport_header_size;
    1256              : 
    1257            0 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
    1258            0 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
    1259            0 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
    1260              : 
    1261            0 :         libspdm_zero_mem(spdm_response, spdm_response_size);
    1262            0 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_12;
    1263            0 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
    1264            0 :         spdm_response->header.param1 = 4;
    1265            0 :         spdm_response->header.param2 = 0;
    1266            0 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
    1267            0 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1268            0 :         spdm_response->other_params_selection = 0;
    1269            0 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
    1270            0 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
    1271            0 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
    1272            0 :         spdm_response->ext_asym_sel_count = 0;
    1273            0 :         spdm_response->ext_hash_sel_count = 0;
    1274            0 :         spdm_response->struct_table[0].alg_type =
    1275              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
    1276            0 :         spdm_response->struct_table[0].alg_count = 0x20;
    1277            0 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
    1278            0 :         spdm_response->struct_table[1].alg_type =
    1279              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
    1280            0 :         spdm_response->struct_table[1].alg_count = 0x20;
    1281            0 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
    1282            0 :         spdm_response->struct_table[2].alg_type =
    1283              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
    1284            0 :         spdm_response->struct_table[2].alg_count = 0x20;
    1285            0 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
    1286            0 :         spdm_response->struct_table[3].alg_type =
    1287              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
    1288            0 :         spdm_response->struct_table[3].alg_count = 0x20;
    1289            0 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
    1290              : 
    1291            0 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
    1292              :                                                spdm_response_size,
    1293              :                                                spdm_response, response_size, response);
    1294              :     }
    1295            0 :         return LIBSPDM_STATUS_SUCCESS;
    1296              : 
    1297            6 :     case 0x23:
    1298              :     {
    1299              :         spdm_algorithms_response_t *spdm_response;
    1300              :         size_t spdm_response_size;
    1301              :         size_t transport_header_size;
    1302              : 
    1303            6 :         spdm_response_size = sizeof(spdm_algorithms_response_t);
    1304            6 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
    1305            6 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
    1306              : 
    1307            6 :         libspdm_zero_mem(spdm_response, spdm_response_size);
    1308            6 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_13;
    1309            6 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
    1310            6 :         spdm_response->header.param1 = 0;
    1311            6 :         spdm_response->header.param2 = 0;
    1312            6 :         spdm_response->length = sizeof(spdm_algorithms_response_t);
    1313            6 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1314            6 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
    1315            6 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
    1316            6 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
    1317            6 :         spdm_response->ext_asym_sel_count = 0;
    1318            6 :         spdm_response->ext_hash_sel_count = 0;
    1319            6 :         spdm_response->other_params_selection = m_connection_other_params_support;
    1320              : 
    1321            6 :         libspdm_transport_test_encode_message(spdm_context, NULL, false,
    1322              :                                               false, spdm_response_size,
    1323              :                                               spdm_response,
    1324              :                                               response_size, response);
    1325              :     }
    1326            6 :         return LIBSPDM_STATUS_SUCCESS;
    1327            8 :     case 0x24:
    1328              :     {
    1329              :         libspdm_algorithms_response_spdm11_t *spdm_response;
    1330              :         size_t spdm_response_size;
    1331              :         size_t transport_header_size;
    1332              : 
    1333            8 :         spdm_response_size = sizeof(libspdm_algorithms_response_spdm11_t);
    1334            8 :         transport_header_size = LIBSPDM_TEST_TRANSPORT_HEADER_SIZE;
    1335            8 :         spdm_response = (void *)((uint8_t *)*response + transport_header_size);
    1336              : 
    1337            8 :         libspdm_zero_mem(spdm_response, spdm_response_size);
    1338            8 :         spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_13;
    1339            8 :         spdm_response->header.request_response_code = SPDM_ALGORITHMS;
    1340            8 :         spdm_response->header.param1 = 4;
    1341            8 :         spdm_response->header.param2 = 0;
    1342            8 :         spdm_response->length = sizeof(libspdm_algorithms_response_spdm11_t);
    1343            8 :         spdm_response->measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1344            8 :         spdm_response->measurement_hash_algo = m_libspdm_use_measurement_hash_algo;
    1345            8 :         spdm_response->base_asym_sel = m_libspdm_use_asym_algo;
    1346            8 :         spdm_response->base_hash_sel = m_libspdm_use_hash_algo;
    1347            8 :         spdm_response->ext_asym_sel_count = 0;
    1348            8 :         spdm_response->ext_hash_sel_count = 0;
    1349            8 :         spdm_response->mel_specification_sel = m_mel_specification_sel;
    1350            8 :         spdm_response->other_params_selection = SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_1;
    1351              : 
    1352            8 :         spdm_response->struct_table[0].alg_type =
    1353              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
    1354            8 :         spdm_response->struct_table[0].alg_count = 0x20;
    1355            8 :         spdm_response->struct_table[0].alg_supported = m_libspdm_use_dhe_algo;
    1356            8 :         spdm_response->struct_table[1].alg_type =
    1357              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
    1358            8 :         spdm_response->struct_table[1].alg_count = 0x20;
    1359            8 :         spdm_response->struct_table[1].alg_supported = m_libspdm_use_aead_algo;
    1360            8 :         spdm_response->struct_table[2].alg_type =
    1361              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
    1362            8 :         spdm_response->struct_table[2].alg_count = 0x20;
    1363            8 :         spdm_response->struct_table[2].alg_supported = m_libspdm_use_req_asym_algo;
    1364            8 :         spdm_response->struct_table[3].alg_type =
    1365              :             SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
    1366            8 :         spdm_response->struct_table[3].alg_count = 0x20;
    1367            8 :         spdm_response->struct_table[3].alg_supported = m_libspdm_use_key_schedule_algo;
    1368              : 
    1369            8 :         libspdm_transport_test_encode_message (spdm_context, NULL, false, false,
    1370              :                                                spdm_response_size,
    1371              :                                                spdm_response, response_size, response);
    1372              : 
    1373              :     }
    1374            8 :         return LIBSPDM_STATUS_SUCCESS;
    1375            0 :     default:
    1376            0 :         return LIBSPDM_STATUS_RECEIVE_FAIL;
    1377              :     }
    1378              : }
    1379              : 
    1380            1 : static void req_negotiate_algorithms_case1(void **state)
    1381              : {
    1382            1 : }
    1383              : 
    1384            1 : static void req_negotiate_algorithms_case2(void **state)
    1385              : {
    1386              :     libspdm_return_t status;
    1387              :     libspdm_test_context_t *spdm_test_context;
    1388              :     libspdm_context_t *spdm_context;
    1389              : 
    1390            1 :     spdm_test_context = *state;
    1391            1 :     spdm_context = spdm_test_context->spdm_context;
    1392            1 :     spdm_test_context->case_id = 0x2;
    1393            1 :     spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_10 <<
    1394              :                                             SPDM_VERSION_NUMBER_SHIFT_BIT;
    1395            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1396            1 :     spdm_context->local_context.algorithm.measurement_hash_algo =
    1397              :         m_libspdm_use_measurement_hash_algo;
    1398            1 :     spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
    1399            1 :     spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
    1400            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1401            1 :     spdm_context->local_context.algorithm.measurement_spec = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1402              : 
    1403            1 :     libspdm_reset_message_a(spdm_context);
    1404              : 
    1405            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1406            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    1407              : #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT
    1408              :     assert_int_equal(spdm_context->transcript.message_a.buffer_size,
    1409              :                      sizeof(spdm_negotiate_algorithms_request_t) +
    1410              :                      sizeof(spdm_algorithms_response_t));
    1411              : #endif
    1412            1 : }
    1413              : 
    1414              : /**
    1415              :  * Case 3:
    1416              :  * +---------------+--------------------------+--------------------------+-----------------------------------+
    1417              :  * | MEAS_CAP | MeasurementSpecification   | MeasurementSpecificationSel |          Expected result          |
    1418              :  * |          | NEGOTIATE_ALGORITHMS       |       ALGORITHMS            |                                   |
    1419              :  * +----------+----------------------------+-----------------------------+-----------------------------------+
    1420              :  * | set      | DMTFmeasSpec               | DMTFmeasSpec                | LIBSPDM_STATUS_SUCCESS            |
    1421              :  *  ---------------------------------------------------------------------------------------------------------+
    1422              :  * | set      | DMTFmeasSpec               | 0                           | LIBSPDM_STATUS_INVALID_MSG_FIELD  |
    1423              :  *  ----------------------------------------------------------------------------------------------------------
    1424              :  * | set      | 0                          | DMTFmeasSpec                | LIBSPDM_STATUS_INVALID_MSG_FIELD  |
    1425              :  *  ---------------------------------------------------------------------------------------------------------+
    1426              :  * | set      | 0                          | 0                           | LIBSPDM_STATUS_SUCCESS            |
    1427              :  *  ----------------------------------------------------------------------------------------------------------
    1428              :  * | Not set  | DMTFmeasSpec               | DMTFmeasSpec                | LIBSPDM_STATUS_INVALID_MSG_FIELD  |
    1429              :  *  ---------------------------------------------------------------------------------------------------------+
    1430              :  * | Not set  | DMTFmeasSpec               | 0                           | LIBSPDM_STATUS_SUCCESS            |
    1431              :  *  ----------------------------------------------------------------------------------------------------------
    1432              :  * | Not set  | 0                          | DMTFmeasSpec                | LIBSPDM_STATUS_INVALID_MSG_FIELD  |
    1433              :  *  ---------------------------------------------------------------------------------------------------------+
    1434              :  * | Not set  | 0                          | 0                           | LIBSPDM_STATUS_SUCCESS            |
    1435              :  *  ----------------------------------------------------------------------------------------------------------
    1436              :  **/
    1437            1 : static void req_negotiate_algorithms_case3(void **state)
    1438              : {
    1439              :     libspdm_return_t status;
    1440              :     libspdm_test_context_t *spdm_test_context;
    1441              :     libspdm_context_t *spdm_context;
    1442            1 :     spdm_test_context = *state;
    1443            1 :     spdm_context = spdm_test_context->spdm_context;
    1444            1 :     spdm_test_context->case_id = 0x3;
    1445            1 :     spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_10 <<
    1446              :                                             SPDM_VERSION_NUMBER_SHIFT_BIT;
    1447            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1448            1 :     spdm_context->local_context.algorithm.measurement_hash_algo =
    1449              :         m_libspdm_use_measurement_hash_algo;
    1450            1 :     spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
    1451            1 :     spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
    1452            1 :     spdm_context->connection_info.capability.flags = 0;
    1453              : 
    1454              :     /* Sub Case 1: MEAS_CAP set 1, measurement_spec_sel and measurement_spec set SPDM_MEASUREMENT_SPECIFICATION_DMTF*/
    1455            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1456            1 :     libspdm_reset_message_a(spdm_context);
    1457            1 :     m_measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1458            1 :     spdm_context->local_context.algorithm.measurement_spec = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1459            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1460            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1461            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    1462              : 
    1463              :     /* Sub Case 2: MEAS_CAP set 1, measurement_spec_sel set 0 , measurement_spec set SPDM_MEASUREMENT_SPECIFICATION_DMTF*/
    1464            1 :     libspdm_reset_message_a(spdm_context);
    1465            1 :     m_measurement_specification_sel = 0;
    1466            1 :     spdm_context->local_context.algorithm.measurement_spec = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1467            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1468            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1469            1 :     assert_int_equal(status, LIBSPDM_STATUS_INVALID_MSG_FIELD);
    1470              : 
    1471              :     /* Sub Case 3: MEAS_CAP set 1, measurement_spec_sel set SPDM_MEASUREMENT_SPECIFICATION_DMTF , measurement_spec set 0*/
    1472            1 :     libspdm_reset_message_a(spdm_context);
    1473            1 :     m_measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1474            1 :     spdm_context->local_context.algorithm.measurement_spec = 0;
    1475            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1476            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1477            1 :     assert_int_equal(status, LIBSPDM_STATUS_INVALID_MSG_FIELD);
    1478              : 
    1479              :     /* Sub Case 4: MEAS_CAP set 1,measurement_spec_sel set 0 , measurement_spec set 0*/
    1480            1 :     libspdm_reset_message_a(spdm_context);
    1481            1 :     m_measurement_specification_sel = 0;
    1482            1 :     spdm_context->local_context.algorithm.measurement_spec = 0;
    1483            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1484            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1485            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    1486              : 
    1487              :     /* Sub Case 5:MEAS_CAP set 0, measurement_spec_sel and measurement_spec set SPDM_MEASUREMENT_SPECIFICATION_DMTF*/
    1488            1 :     spdm_context->connection_info.capability.flags = 0;
    1489            1 :     libspdm_reset_message_a(spdm_context);
    1490            1 :     m_measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1491            1 :     spdm_context->local_context.algorithm.measurement_spec = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1492            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1493            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1494            1 :     assert_int_equal(status, LIBSPDM_STATUS_INVALID_MSG_FIELD);
    1495              : 
    1496              :     /* Sub Case 6: MEAS_CAP set 0, measurement_spec_sel set 0 , measurement_spec set SPDM_MEASUREMENT_SPECIFICATION_DMTF*/
    1497            1 :     libspdm_reset_message_a(spdm_context);
    1498            1 :     m_measurement_specification_sel = 0;
    1499            1 :     spdm_context->local_context.algorithm.measurement_spec = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1500            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1501            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1502            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    1503              : 
    1504              :     /* Sub Case 7: MEAS_CAP set 0,measurement_spec_sel set SPDM_MEASUREMENT_SPECIFICATION_DMTF , measurement_spec set 0*/
    1505            1 :     libspdm_reset_message_a(spdm_context);
    1506            1 :     m_measurement_specification_sel = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1507            1 :     spdm_context->local_context.algorithm.measurement_spec = 0;
    1508            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1509            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1510            1 :     assert_int_equal(status, LIBSPDM_STATUS_INVALID_MSG_FIELD);
    1511              : 
    1512              :     /* Sub Case 8: MEAS_CAP set 0,measurement_spec_sel set 0 , measurement_spec set 0*/
    1513            1 :     libspdm_reset_message_a(spdm_context);
    1514            1 :     m_measurement_specification_sel = 0;
    1515            1 :     spdm_context->local_context.algorithm.measurement_spec = 0;
    1516            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1517            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1518            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    1519            1 : }
    1520              : 
    1521            1 : static void req_negotiate_algorithms_case4(void **state)
    1522              : {
    1523            1 : }
    1524              : 
    1525            1 : static void req_negotiate_algorithms_case5(void **state)
    1526              : {
    1527            1 : }
    1528              : 
    1529            1 : static void req_negotiate_algorithms_case6(void **state)
    1530              : {
    1531              :     libspdm_return_t status;
    1532              :     libspdm_test_context_t *spdm_test_context;
    1533              :     libspdm_context_t *spdm_context;
    1534              : 
    1535            1 :     spdm_test_context = *state;
    1536            1 :     spdm_context = spdm_test_context->spdm_context;
    1537            1 :     spdm_test_context->case_id = 0x6;
    1538            1 :     spdm_context->retry_times = 3;
    1539            1 :     spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_10 <<
    1540              :                                             SPDM_VERSION_NUMBER_SHIFT_BIT;
    1541            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1542            1 :     spdm_context->local_context.algorithm.measurement_hash_algo =
    1543              :         m_libspdm_use_measurement_hash_algo;
    1544            1 :     spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
    1545            1 :     spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
    1546            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1547            1 :     spdm_context->local_context.algorithm.measurement_spec = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1548            1 :     libspdm_reset_message_a(spdm_context);
    1549              : 
    1550            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1551            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    1552              : #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT
    1553              :     assert_int_equal(spdm_context->transcript.message_a.buffer_size,
    1554              :                      sizeof(spdm_negotiate_algorithms_request_t) +
    1555              :                      sizeof(spdm_algorithms_response_t));
    1556              : #endif
    1557            1 : }
    1558              : 
    1559            1 : static void req_negotiate_algorithms_case7(void **state)
    1560              : {
    1561            1 : }
    1562              : 
    1563            1 : static void req_negotiate_algorithms_case8(void **state)
    1564              : {
    1565            1 : }
    1566              : 
    1567            1 : static void req_negotiate_algorithms_case9(void **state)
    1568              : {
    1569            1 : }
    1570              : 
    1571            1 : static void req_negotiate_algorithms_case10(void **state)
    1572              : {
    1573            1 : }
    1574              : 
    1575            1 : static void req_negotiate_algorithms_case11(void **state)
    1576              : {
    1577            1 : }
    1578              : 
    1579            1 : static void req_negotiate_algorithms_case12(void **state)
    1580              : {
    1581            1 : }
    1582              : 
    1583            1 : static void req_negotiate_algorithms_case13(void **state)
    1584              : {
    1585              : 
    1586            1 : }
    1587              : 
    1588            1 : static void req_negotiate_algorithms_case14(void **state)
    1589              : {
    1590            1 : }
    1591              : 
    1592            1 : static void req_negotiate_algorithms_case15(void **state)
    1593              : {
    1594            1 : }
    1595              : 
    1596            1 : static void req_negotiate_algorithms_case16(void **state)
    1597              : {
    1598            1 : }
    1599              : 
    1600            1 : static void req_negotiate_algorithms_case17(void **state)
    1601              : {
    1602            1 : }
    1603              : 
    1604            1 : static void req_negotiate_algorithms_case18(void **state)
    1605              : {
    1606            1 : }
    1607              : 
    1608            1 : static void req_negotiate_algorithms_case19(void **state)
    1609              : {
    1610            1 : }
    1611              : 
    1612            1 : static void req_negotiate_algorithms_case20(void **state)
    1613              : {
    1614            1 : }
    1615              : 
    1616            1 : static void req_negotiate_algorithms_case21(void **state)
    1617              : {
    1618            1 : }
    1619              : 
    1620            1 : static void req_negotiate_algorithms_case22(void **state)
    1621              : {
    1622            1 : }
    1623              : 
    1624            1 : static void req_negotiate_algorithms_case23(void **state)
    1625              : {
    1626              :     libspdm_return_t status;
    1627              :     libspdm_test_context_t *spdm_test_context;
    1628              :     libspdm_context_t *spdm_context;
    1629              : 
    1630            1 :     spdm_test_context = *state;
    1631            1 :     spdm_context = spdm_test_context->spdm_context;
    1632            1 :     spdm_test_context->case_id = 0x17;
    1633              : 
    1634            1 :     spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 <<
    1635              :                                             SPDM_VERSION_NUMBER_SHIFT_BIT;
    1636            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1637            1 :     spdm_context->local_context.algorithm.measurement_hash_algo =
    1638              :         m_libspdm_use_measurement_hash_algo;
    1639            1 :     spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
    1640            1 :     spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
    1641            1 :     libspdm_reset_message_a(spdm_context);
    1642            1 :     spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
    1643            1 :     spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
    1644            1 :     spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
    1645            1 :     spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
    1646            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1647            1 :     spdm_context->local_context.algorithm.measurement_spec = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1648              : 
    1649            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP;
    1650            1 :     spdm_context->connection_info.capability.flags |=
    1651              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP;
    1652              : 
    1653            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP;
    1654            1 :     spdm_context->connection_info.capability.flags |=
    1655              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP;
    1656              : 
    1657            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP;
    1658            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP;
    1659              : 
    1660            1 :     spdm_context->local_context.capability.flags |=
    1661              :         SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP;
    1662            1 :     spdm_context->connection_info.capability.flags |=
    1663              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP;
    1664              : 
    1665            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP;
    1666            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP;
    1667              : 
    1668            1 :     status = libspdm_negotiate_algorithms (spdm_context);
    1669            1 :     assert_int_equal (status, LIBSPDM_STATUS_SUCCESS);
    1670              : #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT
    1671              :     assert_int_equal (spdm_context->transcript.message_a.buffer_size,
    1672              :                       sizeof(spdm_negotiate_algorithms_request_t) + 4*
    1673              :                       sizeof(spdm_negotiate_algorithms_common_struct_table_t) +
    1674              :                       sizeof(libspdm_algorithms_response_spdm11_t));
    1675              : #endif
    1676            1 : }
    1677              : 
    1678            1 : static void req_negotiate_algorithms_case24(void **state)
    1679              : {
    1680            1 : }
    1681              : 
    1682            1 : static void req_negotiate_algorithms_case25(void **state)
    1683              : {
    1684            1 : }
    1685              : 
    1686            1 : static void req_negotiate_algorithms_case26(void **state)
    1687              : {
    1688            1 : }
    1689              : 
    1690            1 : static void req_negotiate_algorithms_case27(void **state)
    1691              : {
    1692            1 : }
    1693              : 
    1694            1 : static void req_negotiate_algorithms_case28(void **state)
    1695              : {
    1696            1 : }
    1697              : 
    1698            1 : static void req_negotiate_algorithms_case29(void **state)
    1699              : {
    1700            1 : }
    1701              : 
    1702            1 : static void req_negotiate_algorithms_case30(void **state)
    1703              : {
    1704            1 : }
    1705              : 
    1706            1 : static void req_negotiate_algorithms_case31(void **state)
    1707              : {
    1708            1 : }
    1709              : 
    1710            1 : static void req_negotiate_algorithms_case32(void **state) {
    1711              :     libspdm_return_t status;
    1712              :     libspdm_test_context_t *spdm_test_context;
    1713              :     libspdm_context_t *spdm_context;
    1714              : #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT
    1715              :     size_t arbitrary_size;
    1716              : #endif
    1717              : 
    1718            1 :     spdm_test_context = *state;
    1719            1 :     spdm_context = spdm_test_context->spdm_context;
    1720            1 :     spdm_test_context->case_id = 0x20;
    1721              : 
    1722            1 :     spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 <<
    1723              :                                             SPDM_VERSION_NUMBER_SHIFT_BIT;
    1724            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1725            1 :     spdm_context->local_context.algorithm.measurement_hash_algo =
    1726              :         m_libspdm_use_measurement_hash_algo;
    1727            1 :     spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
    1728            1 :     spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
    1729            1 :     libspdm_reset_message_a(spdm_context);
    1730            1 :     spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
    1731            1 :     spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
    1732            1 :     spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
    1733            1 :     spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
    1734            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1735            1 :     spdm_context->local_context.algorithm.measurement_spec = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1736              : 
    1737            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP;
    1738            1 :     spdm_context->connection_info.capability.flags |=
    1739              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP;
    1740              : 
    1741            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP;
    1742            1 :     spdm_context->connection_info.capability.flags |=
    1743              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP;
    1744              : 
    1745            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP;
    1746            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP;
    1747              : 
    1748            1 :     spdm_context->local_context.capability.flags |=
    1749              :         SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP;
    1750            1 :     spdm_context->connection_info.capability.flags |=
    1751              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP;
    1752              : 
    1753            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP;
    1754            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP;
    1755              : 
    1756              : #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT
    1757              :     /*filling A with arbitrary data*/
    1758              :     arbitrary_size = 10;
    1759              :     libspdm_set_mem(spdm_context->transcript.message_a.buffer, arbitrary_size, (uint8_t) 0xFF);
    1760              :     spdm_context->transcript.message_a.buffer_size = arbitrary_size;
    1761              : #endif
    1762              : 
    1763            1 :     status = libspdm_negotiate_algorithms (spdm_context);
    1764            1 :     assert_int_equal (status, LIBSPDM_STATUS_SUCCESS);
    1765              : #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT
    1766              :     assert_int_equal (spdm_context->transcript.message_a.buffer_size,
    1767              :                       arbitrary_size + m_libspdm_local_buffer_size);
    1768              :     LIBSPDM_DEBUG((LIBSPDM_DEBUG_INFO, "m_libspdm_local_buffer (0x%x):\n",
    1769              :                    m_libspdm_local_buffer_size));
    1770              :     libspdm_dump_hex(m_libspdm_local_buffer, m_libspdm_local_buffer_size);
    1771              :     assert_memory_equal(spdm_context->transcript.message_a.buffer + arbitrary_size,
    1772              :                         m_libspdm_local_buffer, m_libspdm_local_buffer_size);
    1773              : #endif
    1774            1 : }
    1775              : 
    1776            1 : static void req_negotiate_algorithms_case33(void **state) {
    1777              :     libspdm_return_t status;
    1778              :     libspdm_test_context_t    *spdm_test_context;
    1779              :     libspdm_context_t  *spdm_context;
    1780              : 
    1781            1 :     spdm_test_context = *state;
    1782            1 :     spdm_context = spdm_test_context->spdm_context;
    1783            1 :     spdm_test_context->case_id = 0x21;
    1784              : 
    1785            1 :     spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_12 <<
    1786              :                                             SPDM_VERSION_NUMBER_SHIFT_BIT;
    1787            1 :     spdm_context->local_context.algorithm.measurement_hash_algo =
    1788              :         m_libspdm_use_measurement_hash_algo;
    1789            1 :     spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
    1790            1 :     spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
    1791            1 :     libspdm_reset_message_a(spdm_context);
    1792            1 :     spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
    1793            1 :     spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
    1794            1 :     spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
    1795            1 :     spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
    1796            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP;
    1797            1 :     spdm_context->connection_info.capability.flags |=
    1798              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP;
    1799              : 
    1800            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP;
    1801            1 :     spdm_context->connection_info.capability.flags |=
    1802              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP;
    1803              : 
    1804            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP;
    1805            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP;
    1806              : 
    1807            1 :     spdm_context->local_context.capability.flags |=
    1808              :         SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP;
    1809            1 :     spdm_context->connection_info.capability.flags |=
    1810              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP;
    1811              : 
    1812            1 :     spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP;
    1813            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP;
    1814            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1815            1 :     spdm_context->local_context.algorithm.measurement_spec = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1816              : 
    1817              :     /* Sub Case 1: other_params_support set OpaqueDataFmt1 */
    1818            1 :     spdm_context->local_context.algorithm.other_params_support =
    1819              :         SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_1;
    1820            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1821            1 :     libspdm_reset_message_a(spdm_context);
    1822              : 
    1823            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1824            1 :     assert_int_equal (status, LIBSPDM_STATUS_SUCCESS);
    1825            1 :     assert_int_equal(spdm_context->connection_info.algorithm.other_params_support,
    1826              :                      SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_1);
    1827              : 
    1828              :     /* Sub Case 2: Populate reserved field for version 1.2, field values marked as Reserved shall be written as zero ( 0 )*/
    1829            1 :     spdm_context->local_context.algorithm.other_params_support =
    1830              :         SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_1 |
    1831              :         SPDM_ALGORITHMS_MULTI_KEY_CONN;
    1832            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1833            1 :     libspdm_reset_message_a(spdm_context);
    1834              : 
    1835            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1836            1 :     assert_int_equal (status, LIBSPDM_STATUS_SUCCESS);
    1837            1 :     assert_int_equal(spdm_context->connection_info.algorithm.other_params_support,
    1838              :                      SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_1);
    1839              : #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT
    1840              :     assert_int_equal (spdm_context->transcript.message_a.buffer_size,
    1841              :                       sizeof(spdm_negotiate_algorithms_request_t) + 4*
    1842              :                       sizeof(spdm_negotiate_algorithms_common_struct_table_t) +
    1843              :                       sizeof(libspdm_algorithms_response_spdm11_t));
    1844              : #endif
    1845            1 : }
    1846              : 
    1847              : 
    1848            1 : static void req_negotiate_algorithms_case34(void **state)
    1849              : {
    1850            1 : }
    1851              : 
    1852              : /**
    1853              :  * Test 35: MULTI_KEY_CONN_REQ and MULTI_KEY_CONN_RSP value calculation
    1854              :  * +---------------+--------------------------+--------------------+
    1855              :  * | MULTI_KEY_CAP | RequesterMultiKeyConnSel | MULTI_KEY_CONN_REQ |
    1856              :  * +---------------+--------------------------+--------------------+
    1857              :  * | 00b           | 0                        | false              |
    1858              :  *  ----------------------------------------------------------------
    1859              :  * | 00b           | 1                        | invalid            |
    1860              :  *  ----------------------------------------------------------------
    1861              :  * | 01b           | 0                        | invalid            |
    1862              :  *  ----------------------------------------------------------------
    1863              :  * | 01b           | 1                        | true               |
    1864              :  *  ----------------------------------------------------------------
    1865              :  * | 10b           | 0                        | false              |
    1866              :  *  ----------------------------------------------------------------
    1867              :  * | 10b           | 1                        | true               |
    1868              :  * +---------------+--------------------------+--------------------+
    1869              :  * | MULTI_KEY_CAP | ResponderMultiKeyConn    | MULTI_KEY_CONN_RSP |
    1870              :  * +---------------+--------------------------+--------------------+
    1871              :  * | 00b           | 0                        | false              |
    1872              :  *  ----------------------------------------------------------------
    1873              :  * | 00b           | 1                        | invalid            |
    1874              :  *  ----------------------------------------------------------------
    1875              :  * | 01b           | 0                        | invalid            |
    1876              :  *  ----------------------------------------------------------------
    1877              :  * | 01b           | 1                        | true               |
    1878              :  *  ----------------------------------------------------------------
    1879              :  * | 10b           | 0                        | false              |
    1880              :  *  ----------------------------------------------------------------
    1881              :  * | 10b           | 1                        | true               |
    1882              :  *  ----------------------------------------------------------------
    1883              :  **/
    1884            1 : static void req_negotiate_algorithms_case35(void **state)
    1885              : {
    1886              :     libspdm_return_t status;
    1887              :     libspdm_test_context_t *spdm_test_context;
    1888              :     libspdm_context_t *spdm_context;
    1889              : 
    1890            1 :     spdm_test_context = *state;
    1891            1 :     spdm_context = spdm_test_context->spdm_context;
    1892            1 :     spdm_test_context->case_id = 0x23;
    1893            1 :     spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_13 <<
    1894              :                                             SPDM_VERSION_NUMBER_SHIFT_BIT;
    1895            1 :     spdm_context->local_context.algorithm.measurement_hash_algo =
    1896              :         m_libspdm_use_measurement_hash_algo;
    1897            1 :     spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
    1898            1 :     spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
    1899              : 
    1900            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1901            1 :     spdm_context->local_context.algorithm.measurement_spec = SPDM_MEASUREMENT_SPECIFICATION_DMTF;
    1902            1 :     libspdm_reset_message_a(spdm_context);
    1903              : 
    1904            1 :     spdm_context->connection_info.capability.flags = 0;
    1905            1 :     spdm_context->local_context.capability.flags = 0;
    1906            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1907            1 :     spdm_context->local_context.algorithm.other_params_support = 0;
    1908            1 :     m_connection_other_params_support = 0;
    1909              : 
    1910            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1911            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    1912            1 :     assert_int_equal(spdm_context->connection_info.multi_key_conn_rsp, false);
    1913            1 :     assert_int_equal(spdm_context->connection_info.multi_key_conn_req, false);
    1914              : 
    1915            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1916            1 :     libspdm_reset_message_a(spdm_context);
    1917              : 
    1918            1 :     spdm_context->connection_info.capability.flags = 0;
    1919            1 :     spdm_context->local_context.capability.flags = 0;
    1920            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1921            1 :     spdm_context->local_context.algorithm.other_params_support = SPDM_ALGORITHMS_MULTI_KEY_CONN;
    1922            1 :     m_connection_other_params_support = SPDM_ALGORITHMS_MULTI_KEY_CONN;
    1923              : 
    1924            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1925              :     /* MULTI_KEY_CONN_REQ and MULTI_KEY_CONN_RSP invalid */
    1926            1 :     assert_int_equal(status, LIBSPDM_STATUS_NEGOTIATION_FAIL);
    1927              : 
    1928            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1929            1 :     libspdm_reset_message_a(spdm_context);
    1930              : 
    1931            1 :     spdm_context->connection_info.capability.flags =
    1932              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP_ONLY;
    1933            1 :     spdm_context->local_context.capability.flags =
    1934              :         SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_ONLY;
    1935            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1936            1 :     spdm_context->local_context.algorithm.other_params_support = 0;
    1937            1 :     m_connection_other_params_support = 0;
    1938              : 
    1939            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1940              :     /* MULTI_KEY_CONN_REQ and MULTI_KEY_CONN_RSP invalid */
    1941            1 :     assert_int_equal(status, LIBSPDM_STATUS_NEGOTIATION_FAIL);
    1942              : 
    1943            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1944            1 :     libspdm_reset_message_a(spdm_context);
    1945              : 
    1946            1 :     spdm_context->connection_info.capability.flags =
    1947              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP_ONLY;
    1948            1 :     spdm_context->local_context.capability.flags =
    1949              :         SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_ONLY;
    1950            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1951            1 :     spdm_context->local_context.algorithm.other_params_support = SPDM_ALGORITHMS_MULTI_KEY_CONN;
    1952            1 :     m_connection_other_params_support = SPDM_ALGORITHMS_MULTI_KEY_CONN;
    1953              : 
    1954            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1955            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    1956            1 :     assert_int_equal(spdm_context->connection_info.multi_key_conn_rsp, true);
    1957            1 :     assert_int_equal(spdm_context->connection_info.multi_key_conn_req, true);
    1958              : 
    1959            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1960            1 :     libspdm_reset_message_a(spdm_context);
    1961              : 
    1962            1 :     spdm_context->connection_info.capability.flags =
    1963              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP_NEG;
    1964            1 :     spdm_context->local_context.capability.flags =
    1965              :         SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_NEG;
    1966            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1967            1 :     spdm_context->local_context.algorithm.other_params_support = 0;
    1968            1 :     m_connection_other_params_support = 0;
    1969              : 
    1970            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1971            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    1972            1 :     assert_int_equal(spdm_context->connection_info.multi_key_conn_rsp, false);
    1973            1 :     assert_int_equal(spdm_context->connection_info.multi_key_conn_req, false);
    1974              : 
    1975            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    1976            1 :     libspdm_reset_message_a(spdm_context);
    1977              : 
    1978            1 :     spdm_context->connection_info.capability.flags =
    1979              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP_NEG;
    1980            1 :     spdm_context->local_context.capability.flags =
    1981              :         SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_NEG;
    1982            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
    1983            1 :     spdm_context->local_context.algorithm.other_params_support = SPDM_ALGORITHMS_MULTI_KEY_CONN;
    1984            1 :     m_connection_other_params_support = SPDM_ALGORITHMS_MULTI_KEY_CONN;
    1985              : 
    1986            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    1987            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    1988            1 :     assert_int_equal(spdm_context->connection_info.multi_key_conn_rsp, true);
    1989            1 :     assert_int_equal(spdm_context->connection_info.multi_key_conn_req, true);
    1990            1 : }
    1991              : 
    1992              : /**
    1993              :  * Test 36: ALGORITHMS message received with MEL
    1994              :  * +---------------+--------------------------+--------------------------+-----------------------------------+
    1995              :  * | MEAS_CAP |       MELspecification     |     MELspecificationSel     |          Expected result          |
    1996              :  * |          |     NEGOTIATE_ALGORITHMS   |         ALGORITHMS          |                                   |
    1997              :  * +----------+----------------------------+-----------------------------+-----------------------------------+
    1998              :  * | set      | DMTFmeasSpec               | DMTFmeasSpec                | LIBSPDM_STATUS_SUCCESS            |
    1999              :  *  ---------------------------------------------------------------------------------------------------------+
    2000              :  * | set      | DMTFmeasSpec               | 0                           | LIBSPDM_STATUS_INVALID_MSG_FIELD  |
    2001              :  *  ----------------------------------------------------------------------------------------------------------
    2002              :  * | set      | 0                          | DMTFmeasSpec                | LIBSPDM_STATUS_INVALID_MSG_FIELD  |
    2003              :  *  ---------------------------------------------------------------------------------------------------------+
    2004              :  * | set      | 0                          | 0                           | LIBSPDM_STATUS_SUCCESS            |
    2005              :  *  ----------------------------------------------------------------------------------------------------------
    2006              :  * | Not set  | DMTFmeasSpec               | DMTFmeasSpec                | LIBSPDM_STATUS_INVALID_MSG_FIELD  |
    2007              :  *  ---------------------------------------------------------------------------------------------------------+
    2008              :  * | Not set  | DMTFmeasSpec               | 0                           | LIBSPDM_STATUS_SUCCESS            |
    2009              :  *  ----------------------------------------------------------------------------------------------------------
    2010              :  * | Not set  | 0                          | DMTFmeasSpec                | LIBSPDM_STATUS_INVALID_MSG_FIELD  |
    2011              :  *  ---------------------------------------------------------------------------------------------------------+
    2012              :  * | Not set  | 0                          | 0                           | LIBSPDM_STATUS_SUCCESS            |
    2013              :  *  ----------------------------------------------------------------------------------------------------------
    2014              :  **/
    2015            1 : static void req_negotiate_algorithms_case36(void **state)
    2016              : {
    2017              :     libspdm_return_t status;
    2018              :     libspdm_test_context_t *spdm_test_context;
    2019              :     libspdm_context_t *spdm_context;
    2020              :     uint32_t local_capability_flags;
    2021              :     uint32_t connection_capability_flags;
    2022              : 
    2023            1 :     spdm_test_context = *state;
    2024            1 :     spdm_context = spdm_test_context->spdm_context;
    2025            1 :     spdm_test_context->case_id = 0x24;
    2026            1 :     spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_13 <<
    2027              :                                             SPDM_VERSION_NUMBER_SHIFT_BIT;
    2028            1 :     spdm_context->local_context.algorithm.measurement_hash_algo =
    2029              :         m_libspdm_use_measurement_hash_algo;
    2030            1 :     spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
    2031            1 :     spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
    2032            1 :     spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
    2033            1 :     spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
    2034            1 :     spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
    2035            1 :     spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
    2036            1 :     spdm_context->local_context.algorithm.other_params_support = 0;
    2037              : 
    2038            1 :     local_capability_flags = SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP |
    2039              :                              SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP|
    2040              :                              SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP|
    2041              :                              SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP|
    2042              :                              SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP;
    2043            1 :     connection_capability_flags =
    2044              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP |
    2045              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP |
    2046              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP |
    2047              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP |
    2048              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP |
    2049              :         SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP;
    2050              : 
    2051            1 :     spdm_context->connection_info.capability.flags = connection_capability_flags;
    2052            1 :     spdm_context->local_context.capability.flags = local_capability_flags;
    2053              : 
    2054              :     /* Sub Case 1: MEL_CAP set 1, mel_specification_sel and mel_specification set SPDM_MEL_SPECIFICATION_DMTF*/
    2055            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEL_CAP;
    2056            1 :     libspdm_reset_message_a(spdm_context);
    2057            1 :     m_mel_specification_sel = SPDM_MEL_SPECIFICATION_DMTF;
    2058            1 :     spdm_context->local_context.algorithm.mel_spec = SPDM_MEL_SPECIFICATION_DMTF;
    2059            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    2060            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    2061            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    2062              : 
    2063              :     /* Sub Case 2: MEL_CAP set 1, mel_specification_sel set 0 , mel_specification set SPDM_MEL_SPECIFICATION_DMTF*/
    2064            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEL_CAP;
    2065            1 :     libspdm_reset_message_a(spdm_context);
    2066            1 :     m_mel_specification_sel = 0;
    2067            1 :     spdm_context->local_context.algorithm.mel_spec = SPDM_MEL_SPECIFICATION_DMTF;
    2068            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    2069            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    2070            1 :     assert_int_equal(status, LIBSPDM_STATUS_INVALID_MSG_FIELD);
    2071              : 
    2072              :     /* Sub Case 3: MEL_CAP set 1, mel_specification_sel set SPDM_MEL_SPECIFICATION_DMTF , mel_specification set 0*/
    2073            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEL_CAP;
    2074            1 :     libspdm_reset_message_a(spdm_context);
    2075            1 :     m_mel_specification_sel = SPDM_MEL_SPECIFICATION_DMTF;
    2076            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    2077            1 :     spdm_context->local_context.algorithm.mel_spec = 0;
    2078            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    2079            1 :     assert_int_equal(status, LIBSPDM_STATUS_INVALID_MSG_FIELD);
    2080              : 
    2081              :     /* Sub Case 4: MEL_CAP set 1,mel_specification_sel set 0 , mel_specification set 0*/
    2082            1 :     spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEL_CAP;
    2083            1 :     libspdm_reset_message_a(spdm_context);
    2084            1 :     m_mel_specification_sel = 0;
    2085            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    2086            1 :     spdm_context->local_context.algorithm.mel_spec = 0;
    2087            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    2088            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    2089              : 
    2090              :     /* Sub Case 5:MEL_CAP set 0, mel_specification_sel and mel_specification set SPDM_MEL_SPECIFICATION_DMTF*/
    2091            1 :     spdm_context->connection_info.capability.flags = connection_capability_flags;
    2092            1 :     libspdm_reset_message_a(spdm_context);
    2093            1 :     m_mel_specification_sel = SPDM_MEL_SPECIFICATION_DMTF;
    2094            1 :     spdm_context->local_context.algorithm.mel_spec = SPDM_MEL_SPECIFICATION_DMTF;
    2095            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    2096            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    2097            1 :     assert_int_equal(status, LIBSPDM_STATUS_INVALID_MSG_FIELD);
    2098              : 
    2099              :     /* Sub Case 6: MEL_CAP set 0, mel_specification_sel set 0 , mel_specification set SPDM_MEL_SPECIFICATION_DMTF*/
    2100            1 :     spdm_context->connection_info.capability.flags = connection_capability_flags;
    2101            1 :     libspdm_reset_message_a(spdm_context);
    2102            1 :     m_mel_specification_sel = 0;
    2103            1 :     spdm_context->local_context.algorithm.mel_spec = SPDM_MEL_SPECIFICATION_DMTF;
    2104            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    2105            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    2106            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    2107              : 
    2108              :     /* Sub Case 7: MEL_CAP set 0,mel_specification_sel set SPDM_MEL_SPECIFICATION_DMTF , mel_specification set 0*/
    2109            1 :     spdm_context->connection_info.capability.flags = connection_capability_flags;
    2110            1 :     libspdm_reset_message_a(spdm_context);
    2111            1 :     m_mel_specification_sel = SPDM_MEL_SPECIFICATION_DMTF;
    2112            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    2113            1 :     spdm_context->local_context.algorithm.mel_spec = 0;
    2114            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    2115            1 :     assert_int_equal(status, LIBSPDM_STATUS_INVALID_MSG_FIELD);
    2116              : 
    2117              :     /* Sub Case 8: MEL_CAP set 0,mel_specification_sel set 0 , mel_specification set 0*/
    2118            1 :     spdm_context->connection_info.capability.flags = connection_capability_flags;
    2119            1 :     libspdm_reset_message_a(spdm_context);
    2120            1 :     m_mel_specification_sel = 0;
    2121            1 :     spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
    2122            1 :     spdm_context->local_context.algorithm.mel_spec = 0;
    2123            1 :     status = libspdm_negotiate_algorithms(spdm_context);
    2124            1 :     assert_int_equal(status, LIBSPDM_STATUS_SUCCESS);
    2125            1 : }
    2126              : 
    2127            1 : int libspdm_req_negotiate_algorithms_test(void)
    2128              : {
    2129            1 :     const struct CMUnitTest test_cases[] = {
    2130              :         cmocka_unit_test(req_negotiate_algorithms_case1),
    2131              :         cmocka_unit_test(req_negotiate_algorithms_case2),
    2132              :         cmocka_unit_test(req_negotiate_algorithms_case3),
    2133              :         cmocka_unit_test(req_negotiate_algorithms_case4),
    2134              :         cmocka_unit_test(req_negotiate_algorithms_case5),
    2135              :         cmocka_unit_test(req_negotiate_algorithms_case6),
    2136              :         cmocka_unit_test(req_negotiate_algorithms_case7),
    2137              :         cmocka_unit_test(req_negotiate_algorithms_case8),
    2138              :         cmocka_unit_test(req_negotiate_algorithms_case9),
    2139              :         cmocka_unit_test(req_negotiate_algorithms_case10),
    2140              :         cmocka_unit_test(req_negotiate_algorithms_case11),
    2141              :         cmocka_unit_test(req_negotiate_algorithms_case12),
    2142              :         cmocka_unit_test(req_negotiate_algorithms_case13),
    2143              :         cmocka_unit_test(req_negotiate_algorithms_case14),
    2144              :         cmocka_unit_test(req_negotiate_algorithms_case15),
    2145              :         cmocka_unit_test(req_negotiate_algorithms_case16),
    2146              :         cmocka_unit_test(req_negotiate_algorithms_case17),
    2147              :         cmocka_unit_test(req_negotiate_algorithms_case18),
    2148              :         cmocka_unit_test(req_negotiate_algorithms_case19),
    2149              :         cmocka_unit_test(req_negotiate_algorithms_case20),
    2150              :         cmocka_unit_test(req_negotiate_algorithms_case21),
    2151              :         cmocka_unit_test(req_negotiate_algorithms_case22),
    2152              :         cmocka_unit_test(req_negotiate_algorithms_case23),
    2153              :         cmocka_unit_test(req_negotiate_algorithms_case24),
    2154              :         cmocka_unit_test(req_negotiate_algorithms_case25),
    2155              :         cmocka_unit_test(req_negotiate_algorithms_case26),
    2156              :         cmocka_unit_test(req_negotiate_algorithms_case27),
    2157              :         cmocka_unit_test(req_negotiate_algorithms_case28),
    2158              :         cmocka_unit_test(req_negotiate_algorithms_case29),
    2159              :         cmocka_unit_test(req_negotiate_algorithms_case30),
    2160              :         cmocka_unit_test(req_negotiate_algorithms_case31),
    2161              :         cmocka_unit_test(req_negotiate_algorithms_case32),
    2162              :         cmocka_unit_test(req_negotiate_algorithms_case33),
    2163              :         cmocka_unit_test(req_negotiate_algorithms_case34),
    2164              :         cmocka_unit_test(req_negotiate_algorithms_case35),
    2165              :         cmocka_unit_test(req_negotiate_algorithms_case36),
    2166              :     };
    2167              : 
    2168            1 :     libspdm_test_context_t test_context = {
    2169              :         LIBSPDM_TEST_CONTEXT_VERSION,
    2170              :         true,
    2171              :         send_message,
    2172              :         receive_message,
    2173              :     };
    2174              : 
    2175            1 :     libspdm_setup_test_context(&test_context);
    2176              : 
    2177            1 :     return cmocka_run_group_tests(test_cases,
    2178              :                                   libspdm_unit_test_group_setup,
    2179              :                                   libspdm_unit_test_group_teardown);
    2180              : }
        

Generated by: LCOV version 2.0-1