libspdm_get_scratch_buffer_secure_message_capacity:
   17|  14.1k|uint32_t libspdm_get_scratch_buffer_secure_message_capacity(libspdm_context_t *spdm_context) {
   18|  14.1k|    return spdm_context->local_context.capability.max_spdm_msg_size +
   19|  14.1k|           spdm_context->local_context.capability.transport_header_size +
   20|  14.1k|           spdm_context->local_context.capability.transport_tail_size;
   21|  14.1k|}
libspdm_get_scratch_buffer_large_message_capacity:
   28|  14.1k|uint32_t libspdm_get_scratch_buffer_large_message_capacity(libspdm_context_t *spdm_context) {
   29|  14.1k|    return spdm_context->local_context.capability.max_spdm_msg_size;
   30|  14.1k|}
libspdm_get_scratch_buffer_sender_receiver_capacity:
   43|  14.1k|uint32_t libspdm_get_scratch_buffer_sender_receiver_capacity(libspdm_context_t *spdm_context) {
   44|  14.1k|    return spdm_context->local_context.capability.max_spdm_msg_size +
   45|  14.1k|           spdm_context->local_context.capability.transport_header_size +
   46|  14.1k|           spdm_context->local_context.capability.transport_tail_size;
   47|  14.1k|}
libspdm_get_scratch_buffer_large_sender_receiver_capacity:
   58|  14.1k|{
   59|  14.1k|    return spdm_context->local_context.capability.max_spdm_msg_size +
   60|  14.1k|           spdm_context->local_context.capability.transport_header_size +
   61|  14.1k|           spdm_context->local_context.capability.transport_tail_size;
   62|  14.1k|}
libspdm_get_scratch_buffer_last_spdm_request_offset:
   66|  4.71k|uint32_t libspdm_get_scratch_buffer_last_spdm_request_offset(libspdm_context_t *spdm_context) {
   67|  4.71k|    return 0 +
   68|  4.71k|#if LIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP
   69|  4.71k|           libspdm_get_scratch_buffer_secure_message_capacity(spdm_context) +
   70|  4.71k|           libspdm_get_scratch_buffer_large_message_capacity(spdm_context) +
   71|  4.71k|#endif
   72|  4.71k|           libspdm_get_scratch_buffer_sender_receiver_capacity(spdm_context) +
   73|  4.71k|#if LIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP
   74|  4.71k|           libspdm_get_scratch_buffer_large_sender_receiver_capacity(spdm_context) +
   75|  4.71k|#endif
   76|  4.71k|           0;
   77|  4.71k|}
libspdm_get_scratch_buffer_last_spdm_request_capacity:
   79|  9.43k|uint32_t libspdm_get_scratch_buffer_last_spdm_request_capacity(libspdm_context_t *spdm_context) {
   80|  9.43k|    return spdm_context->local_context.capability.max_spdm_msg_size;
   81|  9.43k|}
libspdm_get_scratch_buffer_cache_spdm_request_offset:
   85|  4.71k|uint32_t libspdm_get_scratch_buffer_cache_spdm_request_offset(libspdm_context_t *spdm_context) {
   86|  4.71k|    return 0 +
   87|  4.71k|#if LIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP
   88|  4.71k|           libspdm_get_scratch_buffer_secure_message_capacity(spdm_context) +
   89|  4.71k|           libspdm_get_scratch_buffer_large_message_capacity(spdm_context) +
   90|  4.71k|#endif
   91|  4.71k|           libspdm_get_scratch_buffer_sender_receiver_capacity(spdm_context) +
   92|  4.71k|#if LIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP
   93|  4.71k|           libspdm_get_scratch_buffer_large_sender_receiver_capacity(spdm_context) +
   94|  4.71k|#endif
   95|  4.71k|           libspdm_get_scratch_buffer_last_spdm_request_capacity(spdm_context) +
   96|  4.71k|           0;
   97|  4.71k|}
libspdm_get_scratch_buffer_cache_spdm_request_capacity:
   99|  4.71k|uint32_t libspdm_get_scratch_buffer_cache_spdm_request_capacity(libspdm_context_t *spdm_context) {
  100|  4.71k|    return spdm_context->local_context.capability.max_spdm_msg_size;
  101|  4.71k|}
libspdm_get_scratch_buffer_capacity:
  105|  4.71k|uint32_t libspdm_get_scratch_buffer_capacity(libspdm_context_t *spdm_context) {
  106|  4.71k|    return 0 +
  107|  4.71k|#if LIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP
  108|  4.71k|           libspdm_get_scratch_buffer_secure_message_capacity(spdm_context) +
  109|  4.71k|           libspdm_get_scratch_buffer_large_message_capacity(spdm_context) +
  110|  4.71k|#endif
  111|  4.71k|           libspdm_get_scratch_buffer_sender_receiver_capacity(spdm_context) +
  112|  4.71k|#if LIBSPDM_ENABLE_CAPABILITY_CHUNK_CAP
  113|  4.71k|           libspdm_get_scratch_buffer_large_sender_receiver_capacity(spdm_context) +
  114|  4.71k|#endif
  115|  4.71k|           libspdm_get_scratch_buffer_last_spdm_request_capacity(spdm_context) +
  116|  4.71k|#if LIBSPDM_RESPOND_IF_READY_SUPPORT
  117|  4.71k|           libspdm_get_scratch_buffer_cache_spdm_request_capacity(spdm_context) +
  118|  4.71k|#endif
  119|  4.71k|           0;
  120|  4.71k|}
libspdm_reset_message_a:
 1260|  6.28k|{
 1261|  6.28k|    libspdm_reset_managed_buffer(&spdm_context->transcript.message_a);
 1262|  6.28k|}
libspdm_reset_message_m:
 1355|    849|{
 1356|    849|    libspdm_session_info_t *spdm_session_info;
 1357|       |
 1358|    849|    spdm_session_info = session_info;
 1359|       |#if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT
 1360|       |    if (spdm_session_info == NULL) {
 1361|       |        libspdm_reset_managed_buffer(&spdm_context->transcript.message_m);
 1362|       |    } else {
 1363|       |        libspdm_reset_managed_buffer(&spdm_session_info->session_transcript.message_m);
 1364|       |    }
 1365|       |#else
 1366|    849|    if (spdm_session_info == NULL) {
  ------------------
  |  Branch (1366:9): [True: 849, False: 0]
  ------------------
 1367|    849|        if (spdm_context->transcript.digest_context_l1l2 != NULL) {
  ------------------
  |  Branch (1367:13): [True: 0, False: 849]
  ------------------
 1368|      0|            libspdm_hash_free (spdm_context->connection_info.algorithm.base_hash_algo,
 1369|      0|                               spdm_context->transcript.digest_context_l1l2);
 1370|      0|            spdm_context->transcript.digest_context_l1l2 = NULL;
 1371|      0|        }
 1372|    849|    } else {
 1373|      0|        if (spdm_session_info->session_transcript.digest_context_l1l2 != NULL) {
  ------------------
  |  Branch (1373:13): [True: 0, False: 0]
  ------------------
 1374|      0|            libspdm_hash_free (spdm_context->connection_info.algorithm.base_hash_algo,
 1375|      0|                               spdm_session_info->session_transcript.digest_context_l1l2);
 1376|      0|            spdm_session_info->session_transcript.digest_context_l1l2 = NULL;
 1377|      0|        }
 1378|      0|    }
 1379|    849|#endif
 1380|    849|}
libspdm_reset_message_buffer_via_request_code:
 1533|    849|{
 1534|    849|    libspdm_context_t *spdm_context;
 1535|       |
 1536|    849|    spdm_context = context;
 1537|       |    /**
 1538|       |     * Any request other than SPDM_GET_MEASUREMENTS resets L1/L2
 1539|       |     */
 1540|    849|    if (request_code != SPDM_GET_MEASUREMENTS) {
  ------------------
  |  |   70|    849|#define SPDM_GET_MEASUREMENTS 0xE0
  ------------------
  |  Branch (1540:9): [True: 849, False: 0]
  ------------------
 1541|    849|        libspdm_reset_message_m(spdm_context, session_info);
 1542|    849|    }
 1543|       |    /**
 1544|       |     * If the Requester issued GET_MEASUREMENTS or KEY_EXCHANGE or FINISH or PSK_EXCHANGE
 1545|       |     * or PSK_FINISH or KEY_UPDATE or HEARTBEAT or GET_ENCAPSULATED_REQUEST or DELIVER_ENCAPSULATED_RESPONSE
 1546|       |     * or END_SESSION request(s) or SPDM_GET_MEASUREMENT_EXTENSION_LOG and skipped CHALLENGE completion, M1 and M2 are reset to null.
 1547|       |     */
 1548|    849|    switch (request_code)
 1549|    849|    {
 1550|      0|    case SPDM_KEY_EXCHANGE:
  ------------------
  |  |   77|      0|#define SPDM_KEY_EXCHANGE 0xE4
  ------------------
  |  Branch (1550:5): [True: 0, False: 849]
  ------------------
 1551|      0|    case SPDM_GET_MEASUREMENTS:
  ------------------
  |  |   70|      0|#define SPDM_GET_MEASUREMENTS 0xE0
  ------------------
  |  Branch (1551:5): [True: 0, False: 849]
  ------------------
 1552|      0|    case SPDM_FINISH:
  ------------------
  |  |   78|      0|#define SPDM_FINISH 0xE5
  ------------------
  |  Branch (1552:5): [True: 0, False: 849]
  ------------------
 1553|      0|    case SPDM_PSK_EXCHANGE:
  ------------------
  |  |   79|      0|#define SPDM_PSK_EXCHANGE 0xE6
  ------------------
  |  Branch (1553:5): [True: 0, False: 849]
  ------------------
 1554|      0|    case SPDM_PSK_FINISH:
  ------------------
  |  |   80|      0|#define SPDM_PSK_FINISH 0xE7
  ------------------
  |  Branch (1554:5): [True: 0, False: 849]
  ------------------
 1555|      0|    case SPDM_KEY_UPDATE:
  ------------------
  |  |   82|      0|#define SPDM_KEY_UPDATE 0xE9
  ------------------
  |  Branch (1555:5): [True: 0, False: 849]
  ------------------
 1556|      0|    case SPDM_HEARTBEAT:
  ------------------
  |  |   81|      0|#define SPDM_HEARTBEAT 0xE8
  ------------------
  |  Branch (1556:5): [True: 0, False: 849]
  ------------------
 1557|      0|    case SPDM_GET_ENCAPSULATED_REQUEST:
  ------------------
  |  |   83|      0|#define SPDM_GET_ENCAPSULATED_REQUEST 0xEA
  ------------------
  |  Branch (1557:5): [True: 0, False: 849]
  ------------------
 1558|      0|    case SPDM_END_SESSION:
  ------------------
  |  |   85|      0|#define SPDM_END_SESSION 0xEC
  ------------------
  |  Branch (1558:5): [True: 0, False: 849]
  ------------------
 1559|      0|    case SPDM_GET_MEASUREMENT_EXTENSION_LOG:
  ------------------
  |  |   98|      0|#define SPDM_GET_MEASUREMENT_EXTENSION_LOG 0xEF
  ------------------
  |  Branch (1559:5): [True: 0, False: 849]
  ------------------
 1560|      0|        if (spdm_context->connection_info.connection_state <
  ------------------
  |  Branch (1560:13): [True: 0, False: 0]
  ------------------
 1561|      0|            LIBSPDM_CONNECTION_STATE_AUTHENTICATED) {
 1562|      0|            libspdm_reset_message_b(spdm_context);
 1563|      0|            libspdm_reset_message_c(spdm_context);
 1564|      0|            libspdm_reset_message_mut_b(spdm_context);
 1565|      0|            libspdm_reset_message_mut_c(spdm_context);
 1566|      0|        }
 1567|      0|        break;
 1568|      0|    case SPDM_DELIVER_ENCAPSULATED_RESPONSE:
  ------------------
  |  |   84|      0|#define SPDM_DELIVER_ENCAPSULATED_RESPONSE 0xEB
  ------------------
  |  Branch (1568:5): [True: 0, False: 849]
  ------------------
 1569|      0|        if (spdm_context->connection_info.connection_state <
  ------------------
  |  Branch (1569:13): [True: 0, False: 0]
  ------------------
 1570|      0|            LIBSPDM_CONNECTION_STATE_AUTHENTICATED) {
 1571|      0|            libspdm_reset_message_b(spdm_context);
 1572|      0|            libspdm_reset_message_c(spdm_context);
 1573|      0|        }
 1574|      0|        break;
 1575|      0|    case SPDM_GET_DIGESTS:
  ------------------
  |  |   66|      0|#define SPDM_GET_DIGESTS 0x81
  ------------------
  |  Branch (1575:5): [True: 0, False: 849]
  ------------------
 1576|      0|        libspdm_reset_message_b(spdm_context);
 1577|      0|        break;
 1578|      0|    case SPDM_GET_ENDPOINT_INFO:
  ------------------
  |  |   94|      0|#define SPDM_GET_ENDPOINT_INFO 0x87
  ------------------
  |  Branch (1578:5): [True: 0, False: 849]
  ------------------
 1579|      0|        libspdm_reset_message_e(spdm_context, session_info);
 1580|      0|        libspdm_reset_message_encap_e(spdm_context, session_info);
 1581|      0|        break;
 1582|    849|    default:
  ------------------
  |  Branch (1582:5): [True: 849, False: 0]
  ------------------
 1583|    849|        break;
 1584|    849|    }
 1585|    849|}
libspdm_append_message_a:
 1598|    588|{
 1599|    588|    return libspdm_append_managed_buffer(&spdm_context->transcript.message_a,
 1600|    588|                                         message, message_size);
 1601|    588|}
libspdm_get_connection_version:
 2632|  13.0k|{
 2633|  13.0k|    return (uint8_t)(spdm_context->connection_info.version >> SPDM_VERSION_NUMBER_SHIFT_BIT);
  ------------------
  |  |  140|  13.0k|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
 2634|  13.0k|}
libspdm_is_capabilities_flag_supported:
 2651|  10.1k|{
 2652|  10.1k|    uint32_t negotiated_requester_capabilities_flag;
 2653|  10.1k|    uint32_t negotiated_responder_capabilities_flag;
 2654|       |
 2655|  10.1k|    if (is_requester) {
  ------------------
  |  Branch (2655:9): [True: 0, False: 10.1k]
  ------------------
 2656|      0|        negotiated_requester_capabilities_flag = spdm_context->local_context.capability.flags;
 2657|      0|        negotiated_responder_capabilities_flag = spdm_context->connection_info.capability.flags;
 2658|  10.1k|    } else {
 2659|  10.1k|        negotiated_requester_capabilities_flag = spdm_context->connection_info.capability.flags;
 2660|  10.1k|        negotiated_responder_capabilities_flag = spdm_context->local_context.capability.flags;
 2661|  10.1k|    }
 2662|       |
 2663|  10.1k|    if (((requester_capabilities_flag == 0) ||
  ------------------
  |  Branch (2663:10): [True: 5.56k, False: 4.54k]
  ------------------
 2664|  10.1k|         ((negotiated_requester_capabilities_flag &
  ------------------
  |  Branch (2664:10): [True: 599, False: 3.94k]
  ------------------
 2665|  4.54k|           requester_capabilities_flag) != 0)) &&
 2666|  10.1k|        ((responder_capabilities_flag == 0) ||
  ------------------
  |  Branch (2666:10): [True: 0, False: 6.16k]
  ------------------
 2667|  6.16k|         ((negotiated_responder_capabilities_flag &
  ------------------
  |  Branch (2667:10): [True: 925, False: 5.23k]
  ------------------
 2668|  6.16k|           responder_capabilities_flag) != 0))) {
 2669|    925|        return true;
 2670|  9.17k|    } else {
 2671|  9.17k|        return false;
 2672|  9.17k|    }
 2673|  10.1k|}
libspdm_register_device_io_func:
 2720|  4.71k|{
 2721|  4.71k|    libspdm_context_t *context;
 2722|       |
 2723|  4.71k|    context = spdm_context;
 2724|  4.71k|    context->send_message = send_message;
 2725|  4.71k|    context->receive_message = receive_message;
 2726|  4.71k|}
libspdm_register_device_buffer_func:
 2779|  4.71k|{
 2780|  4.71k|    libspdm_context_t *context;
 2781|       |
 2782|  4.71k|    context = spdm_context;
 2783|  4.71k|    context->sender_buffer_size = sender_buffer_size;
 2784|  4.71k|    context->receiver_buffer_size = receiver_buffer_size;
 2785|  4.71k|    context->acquire_sender_buffer = acquire_sender_buffer;
 2786|  4.71k|    context->release_sender_buffer = release_sender_buffer;
 2787|  4.71k|    context->acquire_receiver_buffer = acquire_receiver_buffer;
 2788|  4.71k|    context->release_receiver_buffer = release_receiver_buffer;
 2789|       |
 2790|  4.71k|    LIBSPDM_ASSERT (sender_buffer_size >=
 2791|  4.71k|                    context->local_context.capability.transport_header_size +
 2792|  4.71k|                    context->local_context.capability.transport_tail_size);
 2793|  4.71k|    sender_buffer_size -= (context->local_context.capability.transport_header_size +
 2794|  4.71k|                           context->local_context.capability.transport_tail_size);
 2795|  4.71k|    LIBSPDM_ASSERT (sender_buffer_size >= SPDM_MIN_DATA_TRANSFER_SIZE_VERSION_12);
 2796|  4.71k|    context->local_context.capability.sender_data_transfer_size = sender_buffer_size;
 2797|       |
 2798|  4.71k|    LIBSPDM_ASSERT(receiver_buffer_size >=
 2799|  4.71k|                   context->local_context.capability.transport_header_size +
 2800|  4.71k|                   context->local_context.capability.transport_tail_size);
 2801|  4.71k|    receiver_buffer_size -= (context->local_context.capability.transport_header_size +
 2802|  4.71k|                             context->local_context.capability.transport_tail_size);
 2803|  4.71k|    LIBSPDM_ASSERT (receiver_buffer_size >= SPDM_MIN_DATA_TRANSFER_SIZE_VERSION_12);
 2804|  4.71k|    context->local_context.capability.data_transfer_size = receiver_buffer_size;
 2805|  4.71k|}
libspdm_register_transport_layer_func:
 2823|  4.71k|{
 2824|  4.71k|    libspdm_context_t *context;
 2825|       |
 2826|  4.71k|    context = spdm_context;
 2827|       |
 2828|       |    /* fix the data_transfer_size if it is set before */
 2829|  4.71k|    if ((context->local_context.capability.data_transfer_size != 0) &&
  ------------------
  |  Branch (2829:9): [True: 0, False: 4.71k]
  ------------------
 2830|  4.71k|        (context->local_context.capability.data_transfer_size ==
  ------------------
  |  Branch (2830:9): [True: 0, False: 0]
  ------------------
 2831|      0|         context->receiver_buffer_size)) {
 2832|      0|        context->local_context.capability.data_transfer_size =
 2833|      0|            (uint32_t)(context->receiver_buffer_size -
 2834|      0|                       (transport_header_size + transport_tail_size));
 2835|      0|    }
 2836|  4.71k|    if ((context->local_context.capability.sender_data_transfer_size != 0) &&
  ------------------
  |  Branch (2836:9): [True: 0, False: 4.71k]
  ------------------
 2837|  4.71k|        (context->local_context.capability.sender_data_transfer_size ==
  ------------------
  |  Branch (2837:9): [True: 0, False: 0]
  ------------------
 2838|      0|         context->sender_buffer_size)) {
 2839|      0|        context->local_context.capability.sender_data_transfer_size =
 2840|      0|            (uint32_t)(context->sender_buffer_size -
 2841|      0|                       (transport_header_size + transport_tail_size));
 2842|      0|    }
 2843|       |
 2844|  4.71k|    context->local_context.capability.max_spdm_msg_size = max_spdm_msg_size;
 2845|  4.71k|    context->local_context.capability.transport_header_size = transport_header_size;
 2846|  4.71k|    context->local_context.capability.transport_tail_size = transport_tail_size;
 2847|  4.71k|    context->transport_encode_message = transport_encode_message;
 2848|  4.71k|    context->transport_decode_message = transport_decode_message;
 2849|  4.71k|}
libspdm_get_sizeof_required_scratch_buffer:
 2886|  4.71k|{
 2887|  4.71k|    libspdm_context_t *context;
 2888|  4.71k|    size_t scratch_buffer_size;
 2889|       |
 2890|  4.71k|    context = spdm_context;
 2891|  4.71k|    LIBSPDM_ASSERT (context->local_context.capability.max_spdm_msg_size != 0);
 2892|       |
 2893|  4.71k|    scratch_buffer_size = libspdm_get_scratch_buffer_capacity(context);
 2894|  4.71k|    return scratch_buffer_size;
 2895|  4.71k|}
libspdm_set_scratch_buffer:
 2911|  4.71k|{
 2912|  4.71k|    libspdm_context_t *context;
 2913|       |
 2914|  4.71k|    context = spdm_context;
 2915|  4.71k|    LIBSPDM_ASSERT (context->local_context.capability.max_spdm_msg_size != 0);
 2916|  4.71k|    LIBSPDM_ASSERT (scratch_buffer_size >= libspdm_get_scratch_buffer_capacity(spdm_context));
 2917|  4.71k|    context->scratch_buffer = scratch_buffer;
 2918|  4.71k|    context->scratch_buffer_size = scratch_buffer_size;
 2919|  4.71k|    context->last_spdm_request = (uint8_t *)scratch_buffer +
 2920|  4.71k|                                 libspdm_get_scratch_buffer_last_spdm_request_offset(spdm_context);
 2921|  4.71k|#if LIBSPDM_RESPOND_IF_READY_SUPPORT
 2922|  4.71k|    context->cache_spdm_request = (uint8_t *)scratch_buffer +
 2923|  4.71k|                                  libspdm_get_scratch_buffer_cache_spdm_request_offset(spdm_context);
 2924|  4.71k|#endif
 2925|  4.71k|}
libspdm_init_context_with_secured_context:
 3240|  4.71k|{
 3241|  4.71k|    libspdm_context_t *context;
 3242|  4.71k|    size_t index;
 3243|       |
 3244|  4.71k|    LIBSPDM_ASSERT(spdm_context != NULL);
 3245|  4.71k|    LIBSPDM_ASSERT(secured_contexts != NULL);
 3246|  4.71k|    LIBSPDM_ASSERT(num_secured_contexts == LIBSPDM_MAX_SESSION_COUNT);
 3247|       |
 3248|  4.71k|    context = spdm_context;
 3249|  4.71k|    libspdm_zero_mem(context, sizeof(libspdm_context_t));
 3250|  4.71k|    context->version = LIBSPDM_CONTEXT_STRUCT_VERSION;
  ------------------
  |  |  527|  4.71k|#define LIBSPDM_CONTEXT_STRUCT_VERSION 0x3
  ------------------
 3251|  4.71k|    context->transcript.message_a.max_buffer_size =
 3252|  4.71k|        sizeof(context->transcript.message_a.buffer);
 3253|  4.71k|    context->transcript.message_d.max_buffer_size =
 3254|  4.71k|        sizeof(context->transcript.message_d.buffer);
 3255|       |#if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT
 3256|       |    context->transcript.message_b.max_buffer_size =
 3257|       |        sizeof(context->transcript.message_b.buffer);
 3258|       |    context->transcript.message_c.max_buffer_size =
 3259|       |        sizeof(context->transcript.message_c.buffer);
 3260|       |    context->transcript.message_mut_b.max_buffer_size =
 3261|       |        sizeof(context->transcript.message_mut_b.buffer);
 3262|       |    context->transcript.message_mut_c.max_buffer_size =
 3263|       |        sizeof(context->transcript.message_mut_c.buffer);
 3264|       |    context->transcript.message_m.max_buffer_size =
 3265|       |        sizeof(context->transcript.message_m.buffer);
 3266|       |    context->transcript.message_e.max_buffer_size =
 3267|       |        sizeof(context->transcript.message_e.buffer);
 3268|       |    context->transcript.message_encap_e.max_buffer_size =
 3269|       |        sizeof(context->transcript.message_encap_e.buffer);
 3270|       |#endif
 3271|  4.71k|    context->response_state = LIBSPDM_RESPONSE_STATE_NORMAL;
 3272|  4.71k|    context->local_context.version.spdm_version_count = SPDM_MAX_VERSION_COUNT;
  ------------------
  |  |   17|  4.71k|#define SPDM_MAX_VERSION_COUNT 4
  ------------------
 3273|  4.71k|    context->local_context.version.spdm_version[0] = SPDM_MESSAGE_VERSION_10 <<
  ------------------
  |  |  110|  4.71k|#define SPDM_MESSAGE_VERSION_10 0x10
  ------------------
 3274|  4.71k|                                                     SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|  4.71k|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
 3275|  4.71k|    context->local_context.version.spdm_version[1] = SPDM_MESSAGE_VERSION_11 <<
  ------------------
  |  |  111|  4.71k|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
 3276|  4.71k|                                                     SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|  4.71k|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
 3277|  4.71k|    context->local_context.version.spdm_version[2] = SPDM_MESSAGE_VERSION_12 <<
  ------------------
  |  |  112|  4.71k|#define SPDM_MESSAGE_VERSION_12 0x12
  ------------------
 3278|  4.71k|                                                     SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|  4.71k|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
 3279|  4.71k|    context->local_context.version.spdm_version[3] = SPDM_MESSAGE_VERSION_13 <<
  ------------------
  |  |  113|  4.71k|#define SPDM_MESSAGE_VERSION_13 0x13
  ------------------
 3280|  4.71k|                                                     SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|  4.71k|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
 3281|  4.71k|    context->local_context.secured_message_version.spdm_version_count =
 3282|  4.71k|        SECURED_SPDM_MAX_VERSION_COUNT;
  ------------------
  |  |   55|  4.71k|#define SECURED_SPDM_MAX_VERSION_COUNT 3
  ------------------
 3283|  4.71k|    context->local_context.secured_message_version.spdm_version[0] =
 3284|  4.71k|        SECURED_SPDM_VERSION_10 << SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |   57|  4.71k|#define SECURED_SPDM_VERSION_10 0x10
  ------------------
                      SECURED_SPDM_VERSION_10 << SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|  4.71k|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
 3285|  4.71k|    context->local_context.secured_message_version.spdm_version[1] =
 3286|  4.71k|        SECURED_SPDM_VERSION_11 << SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |   58|  4.71k|#define SECURED_SPDM_VERSION_11 0x11
  ------------------
                      SECURED_SPDM_VERSION_11 << SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|  4.71k|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
 3287|  4.71k|    context->local_context.secured_message_version.spdm_version[2] =
 3288|  4.71k|        SECURED_SPDM_VERSION_12 << SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |   59|  4.71k|#define SECURED_SPDM_VERSION_12 0x12
  ------------------
                      SECURED_SPDM_VERSION_12 << SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|  4.71k|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
 3289|  4.71k|    context->local_context.capability.st1 = SPDM_ST1_VALUE_US;
  ------------------
  |  | 1514|  4.71k|#define SPDM_ST1_VALUE_US 100000
  ------------------
 3290|       |
 3291|  4.71k|    context->mut_auth_cert_chain_buffer_size = 0;
 3292|       |
 3293|  4.71k|    context->max_spdm_session_sequence_number = LIBSPDM_MAX_SPDM_SESSION_SEQUENCE_NUMBER;
  ------------------
  |  |   39|  4.71k|#define LIBSPDM_MAX_SPDM_SESSION_SEQUENCE_NUMBER 0xFFFFFFFFFFFFFFFFull
  ------------------
 3294|       |
 3295|  4.71k|    context->latest_session_id = INVALID_SESSION_ID;
  ------------------
  |  |   28|  4.71k|#define INVALID_SESSION_ID 0
  ------------------
 3296|  4.71k|    context->last_spdm_request_session_id = INVALID_SESSION_ID;
  ------------------
  |  |   28|  4.71k|#define INVALID_SESSION_ID 0
  ------------------
 3297|  4.71k|    context->last_spdm_request_session_id_valid = false;
 3298|  4.71k|    context->last_spdm_request_size = 0;
 3299|       |
 3300|       |    /* To be updated in libspdm_register_device_buffer_func */
 3301|  4.71k|    context->local_context.capability.data_transfer_size = 0;
 3302|  4.71k|    context->local_context.capability.sender_data_transfer_size = 0;
 3303|  4.71k|    context->local_context.capability.max_spdm_msg_size = 0;
 3304|       |
 3305|  23.5k|    for (index = 0; index < num_secured_contexts; index++) {
  ------------------
  |  Branch (3305:21): [True: 18.8k, False: 4.71k]
  ------------------
 3306|  18.8k|        if (secured_contexts[index] == NULL) {
  ------------------
  |  Branch (3306:13): [True: 0, False: 18.8k]
  ------------------
 3307|      0|            return LIBSPDM_STATUS_INVALID_PARAMETER;
  ------------------
  |  |   73|      0|    LIBSPDM_STATUS_CONSTRUCT(LIBSPDM_SEVERITY_ERROR, LIBSPDM_SOURCE_CORE, 0x0001)
  |  |  ------------------
  |  |  |  |   55|      0|    ((libspdm_return_t)(((severity) << 28) | ((source) << 16) | (code)))
  |  |  ------------------
  ------------------
 3308|      0|        }
 3309|       |
 3310|  18.8k|        context->session_info[index].secured_message_context = secured_contexts[index];
 3311|  18.8k|        libspdm_secured_message_init_context(
 3312|  18.8k|            context->session_info[index].secured_message_context);
 3313|  18.8k|    }
 3314|       |
 3315|  4.71k|    return LIBSPDM_STATUS_SUCCESS;
  ------------------
  |  |   59|  4.71k|    LIBSPDM_STATUS_CONSTRUCT(LIBSPDM_SEVERITY_SUCCESS, LIBSPDM_SOURCE_SUCCESS, 0x0000)
  |  |  ------------------
  |  |  |  |   55|  4.71k|    ((libspdm_return_t)(((severity) << 28) | ((source) << 16) | (code)))
  |  |  ------------------
  ------------------
 3316|  4.71k|}
libspdm_init_context:
 3331|  4.71k|{
 3332|  4.71k|    libspdm_context_t *context;
 3333|  4.71k|    void *secured_context;
 3334|  4.71k|    void *secured_contexts[LIBSPDM_MAX_SESSION_COUNT];
 3335|  4.71k|    size_t secured_context_size;
 3336|  4.71k|    size_t index;
 3337|       |
 3338|  4.71k|    LIBSPDM_ASSERT(spdm_context != NULL);
 3339|       |
 3340|       |    /* libspdm_get_context_size() allocates space for all secured message
 3341|       |     * contexts. They are appended to the general SPDM context. */
 3342|  4.71k|    context = spdm_context;
 3343|  4.71k|    secured_context = (void *)((size_t)(context + 1));
 3344|  4.71k|    secured_context_size = libspdm_secured_message_get_context_size();
 3345|       |
 3346|  23.5k|    for (index = 0; index < LIBSPDM_MAX_SESSION_COUNT; index++)
  ------------------
  |  |  198|  23.5k|#define LIBSPDM_MAX_SESSION_COUNT 4
  ------------------
  |  Branch (3346:21): [True: 18.8k, False: 4.71k]
  ------------------
 3347|  18.8k|    {
 3348|  18.8k|        secured_contexts[index] = (uint8_t *)secured_context + secured_context_size * index;
 3349|  18.8k|    }
 3350|       |
 3351|  4.71k|    return libspdm_init_context_with_secured_context(spdm_context,
 3352|  4.71k|                                                     secured_contexts,
 3353|  4.71k|                                                     LIBSPDM_MAX_SESSION_COUNT);
  ------------------
  |  |  198|  4.71k|#define LIBSPDM_MAX_SESSION_COUNT 4
  ------------------
 3354|  4.71k|}
libspdm_get_context_size:
 3467|  4.71k|{
 3468|  4.71k|    size_t size;
 3469|       |
 3470|  4.71k|    size = sizeof(libspdm_context_t) +
 3471|  4.71k|           libspdm_secured_message_get_context_size() * LIBSPDM_MAX_SESSION_COUNT;
  ------------------
  |  |  198|  4.71k|#define LIBSPDM_MAX_SESSION_COUNT 4
  ------------------
 3472|  4.71k|    LIBSPDM_ASSERT (size == LIBSPDM_CONTEXT_SIZE_ALL);
 3473|  4.71k|    return size;
 3474|  4.71k|}

libspdm_append_managed_buffer:
  251|    588|{
  252|    588|    libspdm_managed_buffer_t *managed_buffer;
  253|       |
  254|    588|    LIBSPDM_ASSERT(buffer != NULL);
  255|       |
  256|    588|    if (buffer_size == 0) {
  ------------------
  |  Branch (256:9): [True: 0, False: 588]
  ------------------
  257|      0|        return LIBSPDM_STATUS_SUCCESS;
  ------------------
  |  |   59|      0|    LIBSPDM_STATUS_CONSTRUCT(LIBSPDM_SEVERITY_SUCCESS, LIBSPDM_SOURCE_SUCCESS, 0x0000)
  |  |  ------------------
  |  |  |  |   55|      0|    ((libspdm_return_t)(((severity) << 28) | ((source) << 16) | (code)))
  |  |  ------------------
  ------------------
  258|      0|    }
  259|       |
  260|    588|    managed_buffer = m_buffer;
  261|       |
  262|    588|    LIBSPDM_ASSERT(buffer_size != 0);
  263|    588|    LIBSPDM_ASSERT(managed_buffer->max_buffer_size >= managed_buffer->buffer_size);
  264|       |
  265|    588|    if (buffer_size > managed_buffer->max_buffer_size - managed_buffer->buffer_size) {
  ------------------
  |  Branch (265:9): [True: 0, False: 588]
  ------------------
  266|       |        /* Do not LIBSPDM_ASSERT here, because command processor will append message from external.*/
  267|      0|        LIBSPDM_DEBUG((LIBSPDM_DEBUG_ERROR,
  268|      0|                       "libspdm_append_managed_buffer 0x%x fail, rest 0x%x only\n",
  269|      0|                       (uint32_t)buffer_size,
  270|      0|                       (uint32_t)(managed_buffer->max_buffer_size - managed_buffer->buffer_size)));
  271|      0|        return LIBSPDM_STATUS_BUFFER_FULL;
  ------------------
  |  |  118|      0|    LIBSPDM_STATUS_CONSTRUCT(LIBSPDM_SEVERITY_ERROR, LIBSPDM_SOURCE_CORE, 0x000c)
  |  |  ------------------
  |  |  |  |   55|      0|    ((libspdm_return_t)(((severity) << 28) | ((source) << 16) | (code)))
  |  |  ------------------
  ------------------
  272|      0|    }
  273|    588|    LIBSPDM_ASSERT(buffer_size <= managed_buffer->max_buffer_size - managed_buffer->buffer_size);
  274|       |
  275|    588|    libspdm_copy_mem((uint8_t *)(managed_buffer + 1) + managed_buffer->buffer_size,
  276|    588|                     buffer_size, buffer, buffer_size);
  277|    588|    managed_buffer->buffer_size += buffer_size;
  278|       |
  279|    588|    return LIBSPDM_STATUS_SUCCESS;
  ------------------
  |  |   59|    588|    LIBSPDM_STATUS_CONSTRUCT(LIBSPDM_SEVERITY_SUCCESS, LIBSPDM_SOURCE_SUCCESS, 0x0000)
  |  |  ------------------
  |  |  |  |   55|    588|    ((libspdm_return_t)(((severity) << 28) | ((source) << 16) | (code)))
  |  |  ------------------
  ------------------
  280|    588|}
libspdm_reset_managed_buffer:
  283|  6.28k|{
  284|  6.28k|    libspdm_managed_buffer_t *managed_buffer;
  285|       |
  286|  6.28k|    managed_buffer = m_buffer;
  287|  6.28k|    managed_buffer->buffer_size = 0;
  288|       |
  289|  6.28k|    libspdm_zero_mem(managed_buffer + 1, managed_buffer->max_buffer_size);
  290|  6.28k|}

libspdm_get_aead_key_size:
   10|     88|{
   11|     88|    switch (aead_cipher_suite) {
   12|      0|    case SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AES_128_GCM:
  ------------------
  |  |  417|      0|#define SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AES_128_GCM 0x00000001
  ------------------
  |  Branch (12:5): [True: 0, False: 88]
  ------------------
   13|      0|#if LIBSPDM_AEAD_AES_128_GCM_SUPPORT
   14|      0|        return 16;
   15|       |#else
   16|       |        return 0;
   17|       |#endif
   18|     27|    case SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AES_256_GCM:
  ------------------
  |  |  418|     27|#define SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AES_256_GCM 0x00000002
  ------------------
  |  Branch (18:5): [True: 27, False: 61]
  ------------------
   19|     27|#if LIBSPDM_AEAD_AES_256_GCM_SUPPORT
   20|     27|        return 32;
   21|       |#else
   22|       |        return 0;
   23|       |#endif
   24|      0|    case SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_CHACHA20_POLY1305:
  ------------------
  |  |  419|      0|#define SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_CHACHA20_POLY1305 0x00000004
  ------------------
  |  Branch (24:5): [True: 0, False: 88]
  ------------------
   25|      0|#if LIBSPDM_AEAD_CHACHA20_POLY1305_SUPPORT
   26|      0|        return 32;
   27|       |#else
   28|       |        return 0;
   29|       |#endif
   30|      0|    case SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AEAD_SM4_GCM:
  ------------------
  |  |  422|      0|#define SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AEAD_SM4_GCM 0x00000008
  ------------------
  |  Branch (30:5): [True: 0, False: 88]
  ------------------
   31|       |#if LIBSPDM_AEAD_SM4_128_GCM_SUPPORT
   32|       |        return 16;
   33|       |#else
   34|      0|        return 0;
   35|      0|#endif
   36|     61|    default:
  ------------------
  |  Branch (36:5): [True: 61, False: 27]
  ------------------
   37|     61|        return 0;
   38|     88|    }
   39|     88|}

libspdm_get_asym_signature_size:
  180|    280|{
  181|    280|    switch (base_asym_algo) {
  182|     49|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_2048:
  ------------------
  |  |  371|     49|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_2048 0x00000001
  ------------------
  |  Branch (182:5): [True: 49, False: 231]
  ------------------
  183|     49|#if LIBSPDM_RSA_SSA_2048_SUPPORT
  184|     49|        return 256;
  185|       |#else
  186|       |        return 0;
  187|       |#endif
  188|      0|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_2048:
  ------------------
  |  |  372|      0|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_2048 0x00000002
  ------------------
  |  Branch (188:5): [True: 0, False: 280]
  ------------------
  189|      0|#if LIBSPDM_RSA_PSS_2048_SUPPORT
  190|      0|        return 256;
  191|       |#else
  192|       |        return 0;
  193|       |#endif
  194|      0|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_3072:
  ------------------
  |  |  373|      0|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_3072 0x00000004
  ------------------
  |  Branch (194:5): [True: 0, False: 280]
  ------------------
  195|      0|#if LIBSPDM_RSA_SSA_3072_SUPPORT
  196|      0|        return 384;
  197|       |#else
  198|       |        return 0;
  199|       |#endif
  200|      0|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_3072:
  ------------------
  |  |  374|      0|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_3072 0x00000008
  ------------------
  |  Branch (200:5): [True: 0, False: 280]
  ------------------
  201|      0|#if LIBSPDM_RSA_PSS_3072_SUPPORT
  202|      0|        return 384;
  203|       |#else
  204|       |        return 0;
  205|       |#endif
  206|      0|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_4096:
  ------------------
  |  |  376|      0|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_4096 0x00000020
  ------------------
  |  Branch (206:5): [True: 0, False: 280]
  ------------------
  207|      0|#if LIBSPDM_RSA_SSA_4096_SUPPORT
  208|      0|        return 512;
  209|       |#else
  210|       |        return 0;
  211|       |#endif
  212|      0|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_4096:
  ------------------
  |  |  377|      0|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_4096 0x00000040
  ------------------
  |  Branch (212:5): [True: 0, False: 280]
  ------------------
  213|      0|#if LIBSPDM_RSA_PSS_4096_SUPPORT
  214|      0|        return 512;
  215|       |#else
  216|       |        return 0;
  217|       |#endif
  218|     84|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P256:
  ------------------
  |  |  375|     84|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P256 0x00000010
  ------------------
  |  Branch (218:5): [True: 84, False: 196]
  ------------------
  219|     84|#if LIBSPDM_ECDSA_P256_SUPPORT
  220|     84|        return 32 * 2;
  221|       |#else
  222|       |        return 0;
  223|       |#endif
  224|      0|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P384:
  ------------------
  |  |  378|      0|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P384 0x00000080
  ------------------
  |  Branch (224:5): [True: 0, False: 280]
  ------------------
  225|      0|#if LIBSPDM_ECDSA_P384_SUPPORT
  226|      0|        return 48 * 2;
  227|       |#else
  228|       |        return 0;
  229|       |#endif
  230|      0|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P521:
  ------------------
  |  |  379|      0|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P521 0x00000100
  ------------------
  |  Branch (230:5): [True: 0, False: 280]
  ------------------
  231|      0|#if LIBSPDM_ECDSA_P521_SUPPORT
  232|      0|        return 66 * 2;
  233|       |#else
  234|       |        return 0;
  235|       |#endif
  236|      0|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_SM2_ECC_SM2_P256:
  ------------------
  |  |  384|      0|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_SM2_ECC_SM2_P256 0x00000200
  ------------------
  |  Branch (236:5): [True: 0, False: 280]
  ------------------
  237|       |#if LIBSPDM_SM2_DSA_P256_SUPPORT
  238|       |        return 32 * 2;
  239|       |#else
  240|      0|        return 0;
  241|      0|#endif
  242|      0|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_EDDSA_ED25519:
  ------------------
  |  |  385|      0|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_EDDSA_ED25519 0x00000400
  ------------------
  |  Branch (242:5): [True: 0, False: 280]
  ------------------
  243|       |#if LIBSPDM_EDDSA_ED25519_SUPPORT
  244|       |        return 32 * 2;
  245|       |#else
  246|      0|        return 0;
  247|      0|#endif
  248|      0|    case SPDM_ALGORITHMS_BASE_ASYM_ALGO_EDDSA_ED448:
  ------------------
  |  |  386|      0|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_EDDSA_ED448 0x00000800
  ------------------
  |  Branch (248:5): [True: 0, False: 280]
  ------------------
  249|       |#if LIBSPDM_EDDSA_ED448_SUPPORT
  250|       |        return 57 * 2;
  251|       |#else
  252|      0|        return 0;
  253|      0|#endif
  254|    147|    default:
  ------------------
  |  Branch (254:5): [True: 147, False: 133]
  ------------------
  255|    147|        return 0;
  256|    280|    }
  257|    280|}
libspdm_get_req_asym_signature_size:
 1376|    149|{
 1377|    149|    return libspdm_get_asym_signature_size(req_base_asym_alg);
 1378|    149|}

libspdm_get_dhe_pub_key_size:
   17|     68|{
   18|     68|    switch (dhe_named_group) {
   19|      0|    case SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_2048:
  ------------------
  |  |  406|      0|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_2048 0x00000001
  ------------------
  |  Branch (19:5): [True: 0, False: 68]
  ------------------
   20|      0|#if LIBSPDM_FFDHE_2048_SUPPORT
   21|      0|        return 256;
   22|       |#else
   23|       |        return 0;
   24|       |#endif
   25|      0|    case SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_3072:
  ------------------
  |  |  407|      0|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_3072 0x00000002
  ------------------
  |  Branch (25:5): [True: 0, False: 68]
  ------------------
   26|      0|#if LIBSPDM_FFDHE_3072_SUPPORT
   27|      0|        return 384;
   28|       |#else
   29|       |        return 0;
   30|       |#endif
   31|      0|    case SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_4096:
  ------------------
  |  |  408|      0|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_4096 0x00000004
  ------------------
  |  Branch (31:5): [True: 0, False: 68]
  ------------------
   32|      0|#if LIBSPDM_FFDHE_4096_SUPPORT
   33|      0|        return 512;
   34|       |#else
   35|       |        return 0;
   36|       |#endif
   37|     31|    case SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_256_R1:
  ------------------
  |  |  409|     31|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_256_R1 0x00000008
  ------------------
  |  Branch (37:5): [True: 31, False: 37]
  ------------------
   38|     31|#if LIBSPDM_ECDHE_P256_SUPPORT
   39|     31|        return 32 * 2;
   40|       |#else
   41|       |        return 0;
   42|       |#endif
   43|      0|    case SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_384_R1:
  ------------------
  |  |  410|      0|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_384_R1 0x00000010
  ------------------
  |  Branch (43:5): [True: 0, False: 68]
  ------------------
   44|      0|#if LIBSPDM_ECDHE_P384_SUPPORT
   45|      0|        return 48 * 2;
   46|       |#else
   47|       |        return 0;
   48|       |#endif
   49|      0|    case SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_521_R1:
  ------------------
  |  |  411|      0|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_521_R1 0x00000020
  ------------------
  |  Branch (49:5): [True: 0, False: 68]
  ------------------
   50|      0|#if LIBSPDM_ECDHE_P521_SUPPORT
   51|      0|        return 66 * 2;
   52|       |#else
   53|       |        return 0;
   54|       |#endif
   55|      0|    case SPDM_ALGORITHMS_DHE_NAMED_GROUP_SM2_P256:
  ------------------
  |  |  414|      0|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_SM2_P256 0x00000040
  ------------------
  |  Branch (55:5): [True: 0, False: 68]
  ------------------
   56|       |#if LIBSPDM_SM2_KEY_EXCHANGE_P256_SUPPORT
   57|       |        return 32 * 2;
   58|       |#else
   59|      0|        return 0;
   60|      0|#endif
   61|     37|    default:
  ------------------
  |  Branch (61:5): [True: 37, False: 31]
  ------------------
   62|     37|        return 0;
   63|     68|    }
   64|     68|}

libspdm_get_hash_size:
   10|    270|{
   11|    270|    switch (base_hash_algo) {
   12|    174|    case SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_256:
  ------------------
  |  |  391|    174|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_256 0x00000001
  ------------------
  |  Branch (12:5): [True: 174, False: 96]
  ------------------
   13|    174|#if LIBSPDM_SHA256_SUPPORT
   14|    174|        return 32;
   15|       |#else
   16|       |        return 0;
   17|       |#endif
   18|      0|    case SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_256:
  ------------------
  |  |  394|      0|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_256 0x00000008
  ------------------
  |  Branch (18:5): [True: 0, False: 270]
  ------------------
   19|      0|#if LIBSPDM_SHA3_256_SUPPORT
   20|      0|        return 32;
   21|       |#else
   22|       |        return 0;
   23|       |#endif
   24|      0|    case SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_384:
  ------------------
  |  |  392|      0|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_384 0x00000002
  ------------------
  |  Branch (24:5): [True: 0, False: 270]
  ------------------
   25|      0|#if LIBSPDM_SHA384_SUPPORT
   26|      0|        return 48;
   27|       |#else
   28|       |        return 0;
   29|       |#endif
   30|      0|    case SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_384:
  ------------------
  |  |  395|      0|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_384 0x00000010
  ------------------
  |  Branch (30:5): [True: 0, False: 270]
  ------------------
   31|      0|#if LIBSPDM_SHA3_384_SUPPORT
   32|      0|        return 48;
   33|       |#else
   34|       |        return 0;
   35|       |#endif
   36|      0|    case SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_512:
  ------------------
  |  |  393|      0|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_512 0x00000004
  ------------------
  |  Branch (36:5): [True: 0, False: 270]
  ------------------
   37|      0|#if LIBSPDM_SHA512_SUPPORT
   38|      0|        return 64;
   39|       |#else
   40|       |        return 0;
   41|       |#endif
   42|      0|    case SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_512:
  ------------------
  |  |  396|      0|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_512 0x00000020
  ------------------
  |  Branch (42:5): [True: 0, False: 270]
  ------------------
   43|      0|#if LIBSPDM_SHA3_512_SUPPORT
   44|      0|        return 64;
   45|       |#else
   46|       |        return 0;
   47|       |#endif
   48|      0|    case SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SM3_256:
  ------------------
  |  |  401|      0|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SM3_256 0x00000040
  ------------------
  |  Branch (48:5): [True: 0, False: 270]
  ------------------
   49|       |#if LIBSPDM_SM3_256_SUPPORT
   50|       |        return 32;
   51|       |#else
   52|      0|        return 0;
   53|      0|#endif
   54|     96|    default:
  ------------------
  |  Branch (54:5): [True: 96, False: 174]
  ------------------
   55|     96|        return 0;
   56|    270|    }
   57|    270|}
libspdm_get_measurement_hash_size:
  493|     19|{
  494|     19|    switch (measurement_hash_algo) {
  495|      0|    case SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_256:
  ------------------
  |  |  458|      0|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_256 0x00000002
  ------------------
  |  Branch (495:5): [True: 0, False: 19]
  ------------------
  496|      0|    case SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_256:
  ------------------
  |  |  461|      0|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_256 0x00000010
  ------------------
  |  Branch (496:5): [True: 0, False: 19]
  ------------------
  497|      0|        return 32;
  498|      0|    case SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_384:
  ------------------
  |  |  459|      0|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_384 0x00000004
  ------------------
  |  Branch (498:5): [True: 0, False: 19]
  ------------------
  499|      0|    case SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_384:
  ------------------
  |  |  462|      0|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_384 0x00000020
  ------------------
  |  Branch (499:5): [True: 0, False: 19]
  ------------------
  500|      0|        return 48;
  501|     19|    case SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_512:
  ------------------
  |  |  460|     19|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_512 0x00000008
  ------------------
  |  Branch (501:5): [True: 19, False: 0]
  ------------------
  502|     19|    case SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_512:
  ------------------
  |  |  463|     19|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_512 0x00000040
  ------------------
  |  Branch (502:5): [True: 0, False: 19]
  ------------------
  503|     19|        return 64;
  504|      0|    case SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SM3_256:
  ------------------
  |  |  468|      0|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SM3_256 0x00000080
  ------------------
  |  Branch (504:5): [True: 0, False: 19]
  ------------------
  505|      0|        return 32;
  506|      0|    case SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_RAW_BIT_STREAM_ONLY:
  ------------------
  |  |  457|      0|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_RAW_BIT_STREAM_ONLY 0x00000001
  ------------------
  |  Branch (506:5): [True: 0, False: 19]
  ------------------
  507|      0|        return 0xFFFFFFFF;
  508|      0|    default:
  ------------------
  |  Branch (508:5): [True: 0, False: 19]
  ------------------
  509|      0|        return 0;
  510|     19|    }
  511|     19|}

libspdm_get_response_algorithms:
   63|  6.68k|{
   64|  6.68k|    const spdm_negotiate_algorithms_request_t *spdm_request;
   65|  6.68k|    size_t spdm_request_size;
   66|  6.68k|    libspdm_algorithms_response_mine_t *spdm_response;
   67|  6.68k|    spdm_negotiate_algorithms_common_struct_table_t *struct_table;
   68|  6.68k|    size_t index;
   69|  6.68k|    libspdm_return_t status;
   70|  6.68k|    uint32_t algo_size;
   71|  6.68k|    uint8_t fixed_alg_size;
   72|  6.68k|    uint8_t ext_alg_count;
   73|  6.68k|    uint16_t ext_alg_total_count;
   74|  6.68k|    uint8_t alg_type_pre;
   75|       |
   76|  6.68k|    uint32_t hash_priority_table[] = {
   77|  6.68k|    #if LIBSPDM_SHA512_SUPPORT
   78|  6.68k|        SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_512,
  ------------------
  |  |  393|  6.68k|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_512 0x00000004
  ------------------
   79|  6.68k|    #endif
   80|  6.68k|    #if LIBSPDM_SHA384_SUPPORT
   81|  6.68k|        SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_384,
  ------------------
  |  |  392|  6.68k|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_384 0x00000002
  ------------------
   82|  6.68k|    #endif
   83|  6.68k|    #if LIBSPDM_SHA256_SUPPORT
   84|  6.68k|        SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_256,
  ------------------
  |  |  391|  6.68k|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_256 0x00000001
  ------------------
   85|  6.68k|    #endif
   86|  6.68k|    #if LIBSPDM_SHA3_512_SUPPORT
   87|  6.68k|        SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_512,
  ------------------
  |  |  396|  6.68k|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_512 0x00000020
  ------------------
   88|  6.68k|    #endif
   89|  6.68k|    #if LIBSPDM_SHA3_384_SUPPORT
   90|  6.68k|        SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_384,
  ------------------
  |  |  395|  6.68k|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_384 0x00000010
  ------------------
   91|  6.68k|    #endif
   92|  6.68k|    #if LIBSPDM_SHA3_256_SUPPORT
   93|  6.68k|        SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_256,
  ------------------
  |  |  394|  6.68k|#define SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA3_256 0x00000008
  ------------------
   94|  6.68k|    #endif
   95|       |    #if LIBSPDM_SM3_256_SUPPORT
   96|       |        SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SM3_256,
   97|       |    #endif
   98|  6.68k|        0,
   99|  6.68k|    };
  100|       |
  101|  6.68k|    uint32_t asym_priority_table[] = {
  102|  6.68k|    #if LIBSPDM_ECDSA_P521_SUPPORT
  103|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P521,
  ------------------
  |  |  379|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P521 0x00000100
  ------------------
  104|  6.68k|    #endif
  105|  6.68k|    #if LIBSPDM_ECDSA_P384_SUPPORT
  106|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P384,
  ------------------
  |  |  378|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P384 0x00000080
  ------------------
  107|  6.68k|    #endif
  108|  6.68k|    #if LIBSPDM_ECDSA_P256_SUPPORT
  109|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P256,
  ------------------
  |  |  375|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P256 0x00000010
  ------------------
  110|  6.68k|    #endif
  111|  6.68k|    #if LIBSPDM_RSA_PSS_4096_SUPPORT
  112|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_4096,
  ------------------
  |  |  377|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_4096 0x00000040
  ------------------
  113|  6.68k|    #endif
  114|  6.68k|    #if LIBSPDM_RSA_PSS_3072_SUPPORT
  115|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_3072,
  ------------------
  |  |  374|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_3072 0x00000008
  ------------------
  116|  6.68k|    #endif
  117|  6.68k|    #if LIBSPDM_RSA_PSS_2048_SUPPORT
  118|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_2048,
  ------------------
  |  |  372|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_2048 0x00000002
  ------------------
  119|  6.68k|    #endif
  120|  6.68k|    #if LIBSPDM_RSA_SSA_4096_SUPPORT
  121|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_4096,
  ------------------
  |  |  376|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_4096 0x00000020
  ------------------
  122|  6.68k|    #endif
  123|  6.68k|    #if LIBSPDM_RSA_SSA_3072_SUPPORT
  124|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_3072,
  ------------------
  |  |  373|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_3072 0x00000004
  ------------------
  125|  6.68k|    #endif
  126|  6.68k|    #if LIBSPDM_RSA_SSA_2048_SUPPORT
  127|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_2048,
  ------------------
  |  |  371|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_2048 0x00000001
  ------------------
  128|  6.68k|    #endif
  129|       |    #if LIBSPDM_EDDSA_ED448_SUPPORT
  130|       |        SPDM_ALGORITHMS_BASE_ASYM_ALGO_EDDSA_ED448,
  131|       |    #endif
  132|       |    #if LIBSPDM_EDDSA_ED25519_SUPPORT
  133|       |        SPDM_ALGORITHMS_BASE_ASYM_ALGO_EDDSA_ED25519,
  134|       |    #endif
  135|       |    #if LIBSPDM_SM2_DSA_P256_SUPPORT
  136|       |        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_SM2_ECC_SM2_P256,
  137|       |    #endif
  138|  6.68k|        0,
  139|  6.68k|    };
  140|       |
  141|  6.68k|    uint32_t req_asym_priority_table[] = {
  142|  6.68k|    #if LIBSPDM_ECDSA_P521_SUPPORT
  143|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P521,
  ------------------
  |  |  379|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P521 0x00000100
  ------------------
  144|  6.68k|    #endif
  145|  6.68k|    #if LIBSPDM_ECDSA_P384_SUPPORT
  146|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P384,
  ------------------
  |  |  378|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P384 0x00000080
  ------------------
  147|  6.68k|    #endif
  148|  6.68k|    #if LIBSPDM_ECDSA_P256_SUPPORT
  149|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P256,
  ------------------
  |  |  375|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_ECDSA_ECC_NIST_P256 0x00000010
  ------------------
  150|  6.68k|    #endif
  151|  6.68k|    #if LIBSPDM_RSA_PSS_4096_SUPPORT
  152|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_4096,
  ------------------
  |  |  377|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_4096 0x00000040
  ------------------
  153|  6.68k|    #endif
  154|  6.68k|    #if LIBSPDM_RSA_PSS_3072_SUPPORT
  155|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_3072,
  ------------------
  |  |  374|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_3072 0x00000008
  ------------------
  156|  6.68k|    #endif
  157|  6.68k|    #if LIBSPDM_RSA_PSS_2048_SUPPORT
  158|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_2048,
  ------------------
  |  |  372|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_2048 0x00000002
  ------------------
  159|  6.68k|    #endif
  160|  6.68k|    #if LIBSPDM_RSA_SSA_4096_SUPPORT
  161|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_4096,
  ------------------
  |  |  376|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_4096 0x00000020
  ------------------
  162|  6.68k|    #endif
  163|  6.68k|    #if LIBSPDM_RSA_SSA_3072_SUPPORT
  164|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_3072,
  ------------------
  |  |  373|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_3072 0x00000004
  ------------------
  165|  6.68k|    #endif
  166|  6.68k|    #if LIBSPDM_RSA_SSA_2048_SUPPORT
  167|  6.68k|        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_2048,
  ------------------
  |  |  371|  6.68k|#define SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSASSA_2048 0x00000001
  ------------------
  168|  6.68k|    #endif
  169|       |    #if LIBSPDM_EDDSA_ED448_SUPPORT
  170|       |        SPDM_ALGORITHMS_BASE_ASYM_ALGO_EDDSA_ED448,
  171|       |    #endif
  172|       |    #if LIBSPDM_EDDSA_ED25519_SUPPORT
  173|       |        SPDM_ALGORITHMS_BASE_ASYM_ALGO_EDDSA_ED25519,
  174|       |    #endif
  175|       |    #if LIBSPDM_SM2_DSA_P256_SUPPORT
  176|       |        SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_SM2_ECC_SM2_P256,
  177|       |    #endif
  178|  6.68k|        0,
  179|  6.68k|    };
  180|       |
  181|  6.68k|    uint32_t dhe_priority_table[] = {
  182|  6.68k|    #if LIBSPDM_ECDHE_P521_SUPPORT
  183|  6.68k|        SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_521_R1,
  ------------------
  |  |  411|  6.68k|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_521_R1 0x00000020
  ------------------
  184|  6.68k|    #endif
  185|  6.68k|    #if LIBSPDM_ECDHE_P384_SUPPORT
  186|  6.68k|        SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_384_R1,
  ------------------
  |  |  410|  6.68k|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_384_R1 0x00000010
  ------------------
  187|  6.68k|    #endif
  188|  6.68k|    #if LIBSPDM_ECDHE_P256_SUPPORT
  189|  6.68k|        SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_256_R1,
  ------------------
  |  |  409|  6.68k|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_SECP_256_R1 0x00000008
  ------------------
  190|  6.68k|    #endif
  191|  6.68k|    #if LIBSPDM_FFDHE_4096_SUPPORT
  192|  6.68k|        SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_4096,
  ------------------
  |  |  408|  6.68k|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_4096 0x00000004
  ------------------
  193|  6.68k|    #endif
  194|  6.68k|    #if LIBSPDM_FFDHE_3072_SUPPORT
  195|  6.68k|        SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_3072,
  ------------------
  |  |  407|  6.68k|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_3072 0x00000002
  ------------------
  196|  6.68k|    #endif
  197|  6.68k|    #if LIBSPDM_FFDHE_2048_SUPPORT
  198|  6.68k|        SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_2048,
  ------------------
  |  |  406|  6.68k|#define SPDM_ALGORITHMS_DHE_NAMED_GROUP_FFDHE_2048 0x00000001
  ------------------
  199|  6.68k|    #endif
  200|       |    #if LIBSPDM_SM2_KEY_EXCHANGE_SUPPORT
  201|       |        SPDM_ALGORITHMS_DHE_NAMED_GROUP_SM2_P256,
  202|       |    #endif
  203|  6.68k|        0,
  204|  6.68k|    };
  205|       |
  206|  6.68k|    uint32_t aead_priority_table[] = {
  207|  6.68k|    #if LIBSPDM_AEAD_AES_256_GCM_SUPPORT
  208|  6.68k|        SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AES_256_GCM,
  ------------------
  |  |  418|  6.68k|#define SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AES_256_GCM 0x00000002
  ------------------
  209|  6.68k|    #endif
  210|  6.68k|    #if LIBSPDM_AEAD_AES_128_GCM_SUPPORT
  211|  6.68k|        SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AES_128_GCM,
  ------------------
  |  |  417|  6.68k|#define SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AES_128_GCM 0x00000001
  ------------------
  212|  6.68k|    #endif
  213|  6.68k|    #if LIBSPDM_AEAD_CHACHA20_POLY1305_SUPPORT
  214|  6.68k|        SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_CHACHA20_POLY1305,
  ------------------
  |  |  419|  6.68k|#define SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_CHACHA20_POLY1305 0x00000004
  ------------------
  215|  6.68k|    #endif
  216|       |    #if LIBSPDM_AEAD_SM4_128_GCM_SUPPORT
  217|       |        SPDM_ALGORITHMS_AEAD_CIPHER_SUITE_AEAD_SM4_GCM,
  218|       |    #endif
  219|  6.68k|        0,
  220|  6.68k|    };
  221|       |
  222|  6.68k|    uint32_t key_schedule_priority_table[] = {
  223|  6.68k|        SPDM_ALGORITHMS_KEY_SCHEDULE_SPDM,
  ------------------
  |  |  425|  6.68k|#define SPDM_ALGORITHMS_KEY_SCHEDULE_SPDM 0x00000001
  ------------------
  224|  6.68k|    };
  225|       |
  226|  6.68k|    uint32_t measurement_hash_priority_table[] = {
  227|  6.68k|    #if LIBSPDM_SHA512_SUPPORT
  228|  6.68k|        SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_512,
  ------------------
  |  |  460|  6.68k|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_512 0x00000008
  ------------------
  229|  6.68k|    #endif
  230|  6.68k|    #if LIBSPDM_SHA384_SUPPORT
  231|  6.68k|        SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_384,
  ------------------
  |  |  459|  6.68k|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_384 0x00000004
  ------------------
  232|  6.68k|    #endif
  233|  6.68k|    #if LIBSPDM_SHA256_SUPPORT
  234|  6.68k|        SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_256,
  ------------------
  |  |  458|  6.68k|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_256 0x00000002
  ------------------
  235|  6.68k|    #endif
  236|  6.68k|    #if LIBSPDM_SHA3_512_SUPPORT
  237|  6.68k|        SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_512,
  ------------------
  |  |  463|  6.68k|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_512 0x00000040
  ------------------
  238|  6.68k|    #endif
  239|  6.68k|    #if LIBSPDM_SHA3_384_SUPPORT
  240|  6.68k|        SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_384,
  ------------------
  |  |  462|  6.68k|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_384 0x00000020
  ------------------
  241|  6.68k|    #endif
  242|  6.68k|    #if LIBSPDM_SHA3_256_SUPPORT
  243|  6.68k|        SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_256,
  ------------------
  |  |  461|  6.68k|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA3_256 0x00000010
  ------------------
  244|  6.68k|    #endif
  245|       |    #if LIBSPDM_SM3_256_SUPPORT
  246|       |        SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SM3_256,
  247|       |    #endif
  248|  6.68k|        SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_RAW_BIT_STREAM_ONLY,
  ------------------
  |  |  457|  6.68k|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_RAW_BIT_STREAM_ONLY 0x00000001
  ------------------
  249|  6.68k|    };
  250|       |
  251|  6.68k|    uint32_t measurement_spec_priority_table[] = {
  252|  6.68k|        SPDM_MEASUREMENT_SPECIFICATION_DMTF,
  ------------------
  |  |  740|  6.68k|#define SPDM_MEASUREMENT_SPECIFICATION_DMTF 0x01
  ------------------
  253|  6.68k|    };
  254|       |
  255|  6.68k|    uint32_t other_params_support_priority_table[] = {
  256|  6.68k|        SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_1,
  ------------------
  |  |  475|  6.68k|#define SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_1 0x2
  ------------------
  257|  6.68k|        SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_0,
  ------------------
  |  |  474|  6.68k|#define SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_0 0x1
  ------------------
  258|  6.68k|        SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_NONE
  ------------------
  |  |  473|  6.68k|#define SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_NONE 0x0
  ------------------
  259|  6.68k|    };
  260|       |
  261|  6.68k|    uint32_t mel_spec_priority_table[] = {
  262|  6.68k|        SPDM_MEL_SPECIFICATION_DMTF,
  ------------------
  |  |  840|  6.68k|#define SPDM_MEL_SPECIFICATION_DMTF 0x01
  ------------------
  263|  6.68k|    };
  264|       |
  265|  6.68k|    spdm_request = request;
  266|       |
  267|  6.68k|    ext_alg_total_count = 0;
  268|       |
  269|       |    /* -=[Check Parameters Phase]=- */
  270|  6.68k|    LIBSPDM_ASSERT(spdm_request->header.request_response_code == SPDM_NEGOTIATE_ALGORITHMS);
  271|  6.68k|    LIBSPDM_ASSERT(!(((spdm_context->local_context.capability.flags &
  272|  6.68k|                       SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP) == 0) ^
  273|  6.68k|                     (spdm_context->local_context.algorithm.measurement_spec == 0)));
  274|  6.68k|    LIBSPDM_ASSERT(!(((spdm_context->local_context.capability.flags &
  275|  6.68k|                       SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP) == 0) ^
  276|  6.68k|                     (spdm_context->local_context.algorithm.measurement_hash_algo == 0)));
  277|       |
  278|       |    /* -=[Verify State Phase]=- */
  279|  6.68k|    if (spdm_context->response_state != LIBSPDM_RESPONSE_STATE_NORMAL) {
  ------------------
  |  Branch (279:9): [True: 0, False: 6.68k]
  ------------------
  280|      0|        return libspdm_responder_handle_response_state(
  281|      0|            spdm_context,
  282|      0|            spdm_request->header.request_response_code,
  283|      0|            response_size, response);
  284|      0|    }
  285|  6.68k|    if (spdm_context->connection_info.connection_state !=
  ------------------
  |  Branch (285:9): [True: 0, False: 6.68k]
  ------------------
  286|  6.68k|        LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES) {
  287|      0|        return libspdm_generate_error_response(spdm_context,
  288|      0|                                               SPDM_ERROR_CODE_UNEXPECTED_REQUEST,
  ------------------
  |  |  857|      0|#define SPDM_ERROR_CODE_UNEXPECTED_REQUEST 0x04
  ------------------
  289|      0|                                               0, response_size, response);
  290|      0|    }
  291|       |
  292|       |    /* -=[Validate Request Phase]=- */
  293|  6.68k|    if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) {
  ------------------
  |  Branch (293:9): [True: 4.83k, False: 1.84k]
  ------------------
  294|  4.83k|        return libspdm_generate_error_response(spdm_context,
  295|  4.83k|                                               SPDM_ERROR_CODE_VERSION_MISMATCH, 0,
  ------------------
  |  |  860|  4.83k|#define SPDM_ERROR_CODE_VERSION_MISMATCH 0x41
  ------------------
  296|  4.83k|                                               response_size, response);
  297|  4.83k|    }
  298|  1.84k|    if (request_size < sizeof(spdm_negotiate_algorithms_request_t)) {
  ------------------
  |  Branch (298:9): [True: 73, False: 1.77k]
  ------------------
  299|     73|        return libspdm_generate_error_response(spdm_context,
  300|     73|                                               SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     73|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  301|     73|                                               response_size, response);
  302|     73|    }
  303|  1.77k|    if (request_size <
  ------------------
  |  Branch (303:9): [True: 90, False: 1.68k]
  ------------------
  304|  1.77k|        sizeof(spdm_negotiate_algorithms_request_t) +
  305|  1.77k|        sizeof(uint32_t) * spdm_request->ext_asym_count +
  306|  1.77k|        sizeof(uint32_t) * spdm_request->ext_hash_count +
  307|  1.77k|        sizeof(spdm_negotiate_algorithms_common_struct_table_t) * spdm_request->header.param1) {
  308|     90|        return libspdm_generate_error_response(spdm_context,
  309|     90|                                               SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     90|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  310|     90|                                               response_size, response);
  311|     90|    }
  312|  1.68k|    struct_table = (void *)((size_t)spdm_request +
  313|  1.68k|                            sizeof(spdm_negotiate_algorithms_request_t) +
  314|  1.68k|                            sizeof(uint32_t) * spdm_request->ext_asym_count +
  315|  1.68k|                            sizeof(uint32_t) * spdm_request->ext_hash_count);
  316|  1.68k|    if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_11) {
  ------------------
  |  |  111|  1.68k|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  |  Branch (316:9): [True: 1.64k, False: 38]
  ------------------
  317|  1.64k|        alg_type_pre = struct_table->alg_type;
  318|  3.12k|        for (index = 0; index < spdm_request->header.param1; index++) {
  ------------------
  |  Branch (318:25): [True: 1.99k, False: 1.13k]
  ------------------
  319|  1.99k|            if ((size_t)spdm_request + request_size < (size_t)struct_table) {
  ------------------
  |  Branch (319:17): [True: 0, False: 1.99k]
  ------------------
  320|      0|                return libspdm_generate_error_response(
  321|      0|                    spdm_context,
  322|      0|                    SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|      0|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  323|      0|                    response_size, response);
  324|      0|            }
  325|  1.99k|            if ((size_t)spdm_request + request_size - (size_t)struct_table <
  ------------------
  |  Branch (325:17): [True: 25, False: 1.97k]
  ------------------
  326|  1.99k|                sizeof(spdm_negotiate_algorithms_common_struct_table_t)) {
  327|     25|                return libspdm_generate_error_response(
  328|     25|                    spdm_context,
  329|     25|                    SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     25|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  330|     25|                    response_size, response);
  331|     25|            }
  332|  1.97k|            if ((struct_table->alg_type < SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE) ||
  ------------------
  |  |  349|  1.97k|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE 2
  ------------------
  |  Branch (332:17): [True: 105, False: 1.86k]
  ------------------
  333|  1.97k|                (struct_table->alg_type >
  ------------------
  |  Branch (333:17): [True: 214, False: 1.65k]
  ------------------
  334|  1.86k|                 SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE)) {
  ------------------
  |  |  352|  1.86k|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE 5
  ------------------
  335|    319|                return libspdm_generate_error_response(
  336|    319|                    spdm_context,
  337|    319|                    SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|    319|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  338|    319|                    response_size, response);
  339|    319|            }
  340|       |            /* AlgType shall monotonically increase for subsequent entries. */
  341|  1.65k|            if ((index != 0) && (struct_table->alg_type <= alg_type_pre)) {
  ------------------
  |  Branch (341:17): [True: 609, False: 1.04k]
  |  Branch (341:33): [True: 38, False: 571]
  ------------------
  342|     38|                return libspdm_generate_error_response(
  343|     38|                    spdm_context,
  344|     38|                    SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     38|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  345|     38|                    response_size, response);
  346|     38|            }
  347|  1.61k|            alg_type_pre = struct_table->alg_type;
  348|  1.61k|            fixed_alg_size = (struct_table->alg_count >> 4) & 0xF;
  349|  1.61k|            ext_alg_count = struct_table->alg_count & 0xF;
  350|  1.61k|            ext_alg_total_count += ext_alg_count;
  351|  1.61k|            if (fixed_alg_size != 2) {
  ------------------
  |  Branch (351:17): [True: 96, False: 1.51k]
  ------------------
  352|     96|                return libspdm_generate_error_response(
  353|     96|                    spdm_context,
  354|     96|                    SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     96|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  355|     96|                    response_size, response);
  356|     96|            }
  357|  1.51k|            if ((size_t)spdm_request + request_size - (size_t)struct_table -
  ------------------
  |  Branch (357:17): [True: 37, False: 1.48k]
  ------------------
  358|  1.51k|                sizeof(spdm_negotiate_algorithms_common_struct_table_t) <
  359|  1.51k|                sizeof(uint32_t) * ext_alg_count) {
  360|     37|                return libspdm_generate_error_response(
  361|     37|                    spdm_context,
  362|     37|                    SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     37|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  363|     37|                    response_size, response);
  364|     37|            }
  365|  1.48k|            struct_table =
  366|  1.48k|                (void *)((size_t)struct_table +
  367|  1.48k|                         sizeof(spdm_negotiate_algorithms_common_struct_table_t) +
  368|  1.48k|                         sizeof(uint32_t) * ext_alg_count);
  369|  1.48k|        }
  370|  1.64k|    }
  371|  1.17k|    ext_alg_total_count += (spdm_request->ext_asym_count + spdm_request->ext_hash_count);
  372|       |    /* Algorithm count check and message size check*/
  373|  1.17k|    if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_11) {
  ------------------
  |  |  111|  1.17k|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  |  Branch (373:9): [True: 1.13k, False: 38]
  ------------------
  374|  1.13k|        if (ext_alg_total_count > SPDM_NEGOTIATE_ALGORITHMS_REQUEST_MAX_EXT_ALG_COUNT_VERSION_11) {
  ------------------
  |  |  338|  1.13k|#define SPDM_NEGOTIATE_ALGORITHMS_REQUEST_MAX_EXT_ALG_COUNT_VERSION_11 0x14
  ------------------
  |  Branch (374:13): [True: 50, False: 1.08k]
  ------------------
  375|     50|            return libspdm_generate_error_response(
  376|     50|                spdm_context,
  377|     50|                SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     50|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  378|     50|                response_size, response);
  379|     50|        }
  380|  1.08k|        if (spdm_request->length > SPDM_NEGOTIATE_ALGORITHMS_REQUEST_MAX_LENGTH_VERSION_11) {
  ------------------
  |  |  335|  1.08k|#define SPDM_NEGOTIATE_ALGORITHMS_REQUEST_MAX_LENGTH_VERSION_11 0x80
  ------------------
  |  Branch (380:13): [True: 117, False: 966]
  ------------------
  381|    117|            return libspdm_generate_error_response(
  382|    117|                spdm_context,
  383|    117|                SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|    117|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  384|    117|                response_size, response);
  385|    117|        }
  386|  1.08k|    } else {
  387|     38|        if (ext_alg_total_count > SPDM_NEGOTIATE_ALGORITHMS_REQUEST_MAX_EXT_ALG_COUNT_VERSION_10) {
  ------------------
  |  |  337|     38|#define SPDM_NEGOTIATE_ALGORITHMS_REQUEST_MAX_EXT_ALG_COUNT_VERSION_10 0x08
  ------------------
  |  Branch (387:13): [True: 6, False: 32]
  ------------------
  388|      6|            return libspdm_generate_error_response(
  389|      6|                spdm_context,
  390|      6|                SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|      6|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  391|      6|                response_size, response);
  392|      6|        }
  393|     32|        if (spdm_request->length > SPDM_NEGOTIATE_ALGORITHMS_REQUEST_MAX_LENGTH_VERSION_10) {
  ------------------
  |  |  334|     32|#define SPDM_NEGOTIATE_ALGORITHMS_REQUEST_MAX_LENGTH_VERSION_10 0x40
  ------------------
  |  Branch (393:13): [True: 14, False: 18]
  ------------------
  394|     14|            return libspdm_generate_error_response(
  395|     14|                spdm_context,
  396|     14|                SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     14|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  397|     14|                response_size, response);
  398|     14|        }
  399|     32|    }
  400|       |
  401|    984|    request_size = (size_t)struct_table - (size_t)spdm_request;
  402|    984|    if (request_size != spdm_request->length) {
  ------------------
  |  Branch (402:9): [True: 135, False: 849]
  ------------------
  403|    135|        return libspdm_generate_error_response(
  404|    135|            spdm_context,
  405|    135|            SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|    135|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  406|    135|            response_size, response);
  407|    135|    }
  408|    849|    spdm_request_size = request_size;
  409|       |
  410|    849|    libspdm_reset_message_buffer_via_request_code(spdm_context, NULL,
  411|    849|                                                  spdm_request->header.request_response_code);
  412|       |
  413|       |    /* -=[Construct Response Phase]=- */
  414|    849|    LIBSPDM_ASSERT(*response_size >= sizeof(libspdm_algorithms_response_mine_t));
  415|    849|    *response_size = sizeof(libspdm_algorithms_response_mine_t);
  416|    849|    libspdm_zero_mem(response, *response_size);
  417|    849|    spdm_response = response;
  418|       |
  419|    849|    spdm_response->header.spdm_version = spdm_request->header.spdm_version;
  420|    849|    if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_11) {
  ------------------
  |  |  111|    849|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  |  Branch (420:9): [True: 842, False: 7]
  ------------------
  421|       |        /* Number of Algorithms Structure Tables */
  422|    842|        spdm_response->header.param1 = spdm_request->header.param1;
  423|       |        /* Respond with only the same amount of Algorithms Structure Tables as requested */
  424|    842|        *response_size = sizeof(libspdm_algorithms_response_mine_t) -
  425|    842|                         ((SPDM_NEGOTIATE_ALGORITHMS_MAX_NUM_STRUCT_TABLE_ALG  -
  ------------------
  |  |  348|    842|#define SPDM_NEGOTIATE_ALGORITHMS_MAX_NUM_STRUCT_TABLE_ALG 4
  ------------------
  426|    842|                           spdm_request->header.param1) *
  427|    842|                          sizeof(spdm_negotiate_algorithms_common_struct_table_t));
  428|    842|    } else {
  429|      7|        spdm_response->header.param1 = 0;
  430|      7|        *response_size =
  431|      7|            sizeof(libspdm_algorithms_response_mine_t) -
  432|      7|            (sizeof(spdm_negotiate_algorithms_common_struct_table_t) *
  433|      7|             SPDM_NEGOTIATE_ALGORITHMS_MAX_NUM_STRUCT_TABLE_ALG);
  ------------------
  |  |  348|      7|#define SPDM_NEGOTIATE_ALGORITHMS_MAX_NUM_STRUCT_TABLE_ALG 4
  ------------------
  434|      7|    }
  435|    849|    spdm_response->header.request_response_code = SPDM_ALGORITHMS;
  ------------------
  |  |   35|    849|#define SPDM_ALGORITHMS 0x63
  ------------------
  436|    849|    spdm_response->header.param2 = 0;
  437|    849|    spdm_response->length = (uint16_t)*response_size;
  438|       |
  439|    849|    spdm_context->connection_info.algorithm.measurement_spec =
  440|    849|        spdm_request->measurement_specification;
  441|    849|    if (spdm_request->measurement_specification != 0) {
  ------------------
  |  Branch (441:9): [True: 660, False: 189]
  ------------------
  442|    660|        spdm_context->connection_info.algorithm.measurement_hash_algo =
  443|    660|            spdm_context->local_context.algorithm.measurement_hash_algo;
  444|    660|    } else {
  445|    189|        spdm_context->connection_info.algorithm.measurement_hash_algo = 0;
  446|    189|    }
  447|    849|    spdm_context->connection_info.algorithm.base_asym_algo = spdm_request->base_asym_algo;
  448|    849|    spdm_context->connection_info.algorithm.base_hash_algo = spdm_request->base_hash_algo;
  449|    849|    if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_11) {
  ------------------
  |  |  111|    849|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  |  Branch (449:9): [True: 842, False: 7]
  ------------------
  450|    842|        struct_table =
  451|    842|            (void *)((size_t)spdm_request +
  452|    842|                     sizeof(spdm_negotiate_algorithms_request_t) +
  453|    842|                     sizeof(uint32_t) * spdm_request->ext_asym_count +
  454|    842|                     sizeof(uint32_t) * spdm_request->ext_hash_count);
  455|  1.81k|        for (index = 0; index < spdm_request->header.param1; index++) {
  ------------------
  |  Branch (455:25): [True: 1.06k, False: 752]
  ------------------
  456|  1.06k|            switch (struct_table->alg_type) {
  457|    268|            case SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE:
  ------------------
  |  |  349|    268|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE 2
  ------------------
  |  Branch (457:13): [True: 268, False: 792]
  ------------------
  458|    268|                if (struct_table->alg_supported == 0) {
  ------------------
  |  Branch (458:21): [True: 16, False: 252]
  ------------------
  459|     16|                    return libspdm_generate_error_response(
  460|     16|                        spdm_context, SPDM_ERROR_CODE_INVALID_REQUEST,
  ------------------
  |  |  855|     16|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  461|     16|                        0, response_size, response);
  462|     16|                }
  463|       |
  464|    252|                spdm_context->connection_info.algorithm.dhe_named_group =
  465|    252|                    struct_table->alg_supported;
  466|    252|                spdm_response->struct_table[index].alg_type =
  467|    252|                    SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE;
  ------------------
  |  |  349|    252|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE 2
  ------------------
  468|    252|                spdm_response->struct_table[index].alg_count = 0x20;
  469|    252|                spdm_response->struct_table[index].alg_supported =
  470|    252|                    (uint16_t)libspdm_prioritize_algorithm(
  471|    252|                        dhe_priority_table, LIBSPDM_ARRAY_SIZE(dhe_priority_table),
  ------------------
  |  |   85|    252|#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  472|    252|                        spdm_context->local_context.algorithm.dhe_named_group,
  473|    252|                        spdm_context->connection_info.algorithm.dhe_named_group);
  474|    252|                break;
  475|    258|            case SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD:
  ------------------
  |  |  350|    258|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD 3
  ------------------
  |  Branch (475:13): [True: 258, False: 802]
  ------------------
  476|    258|                if (struct_table->alg_supported == 0) {
  ------------------
  |  Branch (476:21): [True: 26, False: 232]
  ------------------
  477|     26|                    return libspdm_generate_error_response(
  478|     26|                        spdm_context, SPDM_ERROR_CODE_INVALID_REQUEST,
  ------------------
  |  |  855|     26|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  479|     26|                        0, response_size, response);
  480|     26|                }
  481|       |
  482|    232|                spdm_context->connection_info.algorithm.aead_cipher_suite =
  483|    232|                    struct_table->alg_supported;
  484|    232|                spdm_response->struct_table[index].alg_type =
  485|    232|                    SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD;
  ------------------
  |  |  350|    232|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD 3
  ------------------
  486|    232|                spdm_response->struct_table[index].alg_count = 0x20;
  487|    232|                spdm_response->struct_table[index].alg_supported =
  488|    232|                    (uint16_t)libspdm_prioritize_algorithm(
  489|    232|                        aead_priority_table, LIBSPDM_ARRAY_SIZE(aead_priority_table),
  ------------------
  |  |   85|    232|#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  490|    232|                        spdm_context->local_context.algorithm.aead_cipher_suite,
  491|    232|                        spdm_context->connection_info.algorithm.aead_cipher_suite);
  492|    232|                break;
  493|    265|            case SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG:
  ------------------
  |  |  351|    265|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG 4
  ------------------
  |  Branch (493:13): [True: 265, False: 795]
  ------------------
  494|    265|                if (struct_table->alg_supported == 0) {
  ------------------
  |  Branch (494:21): [True: 17, False: 248]
  ------------------
  495|     17|                    return libspdm_generate_error_response(
  496|     17|                        spdm_context, SPDM_ERROR_CODE_INVALID_REQUEST,
  ------------------
  |  |  855|     17|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  497|     17|                        0, response_size, response);
  498|     17|                }
  499|       |
  500|    248|                spdm_context->connection_info.algorithm.req_base_asym_alg =
  501|    248|                    struct_table->alg_supported;
  502|    248|                spdm_response->struct_table[index].alg_type =
  503|    248|                    SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG;
  ------------------
  |  |  351|    248|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG 4
  ------------------
  504|    248|                spdm_response->struct_table[index].alg_count = 0x20;
  505|    248|                spdm_response->struct_table[index].alg_supported =
  506|    248|                    (uint16_t)libspdm_prioritize_algorithm(
  507|    248|                        req_asym_priority_table,
  508|    248|                        LIBSPDM_ARRAY_SIZE(req_asym_priority_table),
  ------------------
  |  |   85|    248|#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  509|    248|                        spdm_context->local_context.algorithm.req_base_asym_alg,
  510|    248|                        spdm_context->connection_info.algorithm.req_base_asym_alg);
  511|    248|                break;
  512|    269|            case SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE:
  ------------------
  |  |  352|    269|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE 5
  ------------------
  |  Branch (512:13): [True: 269, False: 791]
  ------------------
  513|    269|                if (struct_table->alg_supported == 0) {
  ------------------
  |  Branch (513:21): [True: 31, False: 238]
  ------------------
  514|     31|                    return libspdm_generate_error_response(
  515|     31|                        spdm_context, SPDM_ERROR_CODE_INVALID_REQUEST,
  ------------------
  |  |  855|     31|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  516|     31|                        0, response_size, response);
  517|     31|                }
  518|       |
  519|    238|                spdm_context->connection_info.algorithm.key_schedule =
  520|    238|                    struct_table->alg_supported;
  521|    238|                spdm_response->struct_table[index].alg_type =
  522|    238|                    SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE;
  ------------------
  |  |  352|    238|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE 5
  ------------------
  523|    238|                spdm_response->struct_table[index].alg_count = 0x20;
  524|    238|                spdm_response->struct_table[index].alg_supported =
  525|    238|                    (uint16_t)libspdm_prioritize_algorithm(
  526|    238|                        key_schedule_priority_table,
  527|    238|                        LIBSPDM_ARRAY_SIZE(key_schedule_priority_table),
  ------------------
  |  |   85|    238|#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  528|    238|                        spdm_context->local_context.algorithm.key_schedule,
  529|    238|                        spdm_context->connection_info.algorithm.key_schedule);
  530|    238|                break;
  531|      0|            default:
  ------------------
  |  Branch (531:13): [True: 0, False: 1.06k]
  ------------------
  532|       |                /* Unknown algorithm types do not need to be processed */
  533|      0|                break;
  534|  1.06k|            }
  535|    970|            ext_alg_count = struct_table->alg_count & 0xF;
  536|    970|            struct_table =
  537|    970|                (void *)((size_t)struct_table +
  538|    970|                         sizeof(spdm_negotiate_algorithms_common_struct_table_t) +
  539|    970|                         sizeof(uint32_t) * ext_alg_count);
  540|    970|        }
  541|    842|    }
  542|    759|    if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_12) {
  ------------------
  |  |  112|    759|#define SPDM_MESSAGE_VERSION_12 0x12
  ------------------
  |  Branch (542:9): [True: 131, False: 628]
  ------------------
  543|    131|        spdm_context->connection_info.algorithm.other_params_support =
  544|    131|            spdm_request->other_params_support & SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK;
  ------------------
  |  |  476|    131|#define SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK 0xF
  ------------------
  545|    131|        if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
  ------------------
  |  |  113|    131|#define SPDM_MESSAGE_VERSION_13 0x13
  ------------------
  |  Branch (545:13): [True: 102, False: 29]
  ------------------
  546|    102|            spdm_context->connection_info.algorithm.other_params_support =
  547|    102|                spdm_request->other_params_support;
  548|    102|            spdm_context->connection_info.algorithm.mel_spec =
  549|    102|                spdm_request->mel_specification;
  550|    102|        }
  551|    131|    }
  552|       |
  553|    759|    if (libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (553:9): [True: 69, False: 690]
  ------------------
  554|    759|            spdm_context, false, 0,
  555|    759|            SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) {
  ------------------
  |  |  236|    759|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP (0x00000008 | 0x00000010)
  ------------------
  556|     69|        spdm_response->measurement_specification_sel = (uint8_t)libspdm_prioritize_algorithm(
  557|     69|            measurement_spec_priority_table,
  558|     69|            LIBSPDM_ARRAY_SIZE(measurement_spec_priority_table),
  ------------------
  |  |   85|     69|#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  559|     69|            spdm_context->local_context.algorithm.measurement_spec,
  560|     69|            spdm_context->connection_info.algorithm.measurement_spec);
  561|    690|    } else {
  562|    690|        spdm_response->measurement_specification_sel = 0;
  563|    690|    }
  564|       |
  565|    759|    spdm_response->measurement_hash_algo = libspdm_prioritize_algorithm(
  566|    759|        measurement_hash_priority_table,
  567|    759|        LIBSPDM_ARRAY_SIZE(measurement_hash_priority_table),
  ------------------
  |  |   85|    759|#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  568|    759|        spdm_context->local_context.algorithm.measurement_hash_algo,
  569|    759|        spdm_context->connection_info.algorithm.measurement_hash_algo);
  570|       |
  571|    759|    spdm_response->base_asym_sel = libspdm_prioritize_algorithm(
  572|    759|        asym_priority_table, LIBSPDM_ARRAY_SIZE(asym_priority_table),
  ------------------
  |  |   85|    759|#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  573|    759|        spdm_context->local_context.algorithm.base_asym_algo,
  574|    759|        spdm_context->connection_info.algorithm.base_asym_algo);
  575|       |
  576|    759|    spdm_response->base_hash_sel = libspdm_prioritize_algorithm(
  577|    759|        hash_priority_table, LIBSPDM_ARRAY_SIZE(hash_priority_table),
  ------------------
  |  |   85|    759|#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  578|    759|        spdm_context->local_context.algorithm.base_hash_algo,
  579|    759|        spdm_context->connection_info.algorithm.base_hash_algo);
  580|       |
  581|       |
  582|    759|    if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_12) {
  ------------------
  |  |  112|    759|#define SPDM_MESSAGE_VERSION_12 0x12
  ------------------
  |  Branch (582:9): [True: 131, False: 628]
  ------------------
  583|    131|        spdm_response->other_params_selection = (uint8_t)libspdm_prioritize_algorithm(
  584|    131|            other_params_support_priority_table,
  585|    131|            LIBSPDM_ARRAY_SIZE(other_params_support_priority_table),
  ------------------
  |  |   85|    131|#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  586|    131|            spdm_context->local_context.algorithm.other_params_support &
  587|    131|            SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK,
  ------------------
  |  |  476|    131|#define SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK 0xF
  ------------------
  588|    131|            spdm_context->connection_info.algorithm.other_params_support &
  589|    131|            SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK);
  ------------------
  |  |  476|    131|#define SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK 0xF
  ------------------
  590|    131|        if (spdm_response->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
  ------------------
  |  |  113|    131|#define SPDM_MESSAGE_VERSION_13 0x13
  ------------------
  |  Branch (590:13): [True: 102, False: 29]
  ------------------
  591|    102|            if (libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (591:17): [True: 17, False: 85]
  ------------------
  592|    102|                    spdm_context, false, 0,
  593|    102|                    SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEL_CAP)) {
  ------------------
  |  |  293|    102|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEL_CAP 0x01000000
  ------------------
  594|     17|                spdm_response->mel_specification_sel = (uint8_t)libspdm_prioritize_algorithm(
  595|     17|                    mel_spec_priority_table,
  596|     17|                    LIBSPDM_ARRAY_SIZE(mel_spec_priority_table),
  ------------------
  |  |   85|     17|#define LIBSPDM_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
  ------------------
  597|     17|                    spdm_context->local_context.algorithm.mel_spec,
  598|     17|                    spdm_context->connection_info.algorithm.mel_spec);
  599|     85|            } else {
  600|     85|                spdm_response->mel_specification_sel = 0;
  601|     85|            }
  602|    102|        }
  603|    131|    }
  604|       |
  605|    759|    if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
  ------------------
  |  |  113|    759|#define SPDM_MESSAGE_VERSION_13 0x13
  ------------------
  |  Branch (605:9): [True: 102, False: 657]
  ------------------
  606|    102|        switch (spdm_context->connection_info.capability.flags &
  607|    102|                SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP) {
  ------------------
  |  |  223|    102|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP (0x04000000 | 0x08000000)
  ------------------
  608|     34|        case 0:
  ------------------
  |  Branch (608:9): [True: 34, False: 68]
  ------------------
  609|     34|            spdm_context->connection_info.multi_key_conn_req = false;
  610|     34|            break;
  611|     34|        case SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_ONLY:
  ------------------
  |  |  224|     34|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_ONLY 0x04000000
  ------------------
  |  Branch (611:9): [True: 34, False: 68]
  ------------------
  612|     34|            spdm_context->connection_info.multi_key_conn_req = true;
  613|     34|            break;
  614|     34|        case SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_NEG:
  ------------------
  |  |  225|     34|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_NEG 0x08000000
  ------------------
  |  Branch (614:9): [True: 34, False: 68]
  ------------------
  615|     34|            if ((spdm_context->local_context.algorithm.other_params_support &
  ------------------
  |  Branch (615:17): [True: 17, False: 17]
  ------------------
  616|     34|                 SPDM_ALGORITHMS_MULTI_KEY_CONN) == 0) {
  ------------------
  |  |  478|     34|#define SPDM_ALGORITHMS_MULTI_KEY_CONN 0x10
  ------------------
  617|     17|                spdm_context->connection_info.multi_key_conn_req = false;
  618|     17|            } else {
  619|     17|                spdm_context->connection_info.multi_key_conn_req = true;
  620|     17|            }
  621|     34|            break;
  622|      0|        default:
  ------------------
  |  Branch (622:9): [True: 0, False: 102]
  ------------------
  623|      0|            return libspdm_generate_error_response(
  624|      0|                spdm_context, SPDM_ERROR_CODE_INVALID_REQUEST,
  ------------------
  |  |  855|      0|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  625|      0|                0, response_size, response);
  626|    102|        }
  627|    102|        if (spdm_context->connection_info.multi_key_conn_req) {
  ------------------
  |  Branch (627:13): [True: 51, False: 51]
  ------------------
  628|     51|            spdm_response->other_params_selection |= SPDM_ALGORITHMS_MULTI_KEY_CONN;
  ------------------
  |  |  478|     51|#define SPDM_ALGORITHMS_MULTI_KEY_CONN 0x10
  ------------------
  629|     51|        } else {
  630|     51|            spdm_response->other_params_selection &= ~SPDM_ALGORITHMS_MULTI_KEY_CONN;
  ------------------
  |  |  478|     51|#define SPDM_ALGORITHMS_MULTI_KEY_CONN 0x10
  ------------------
  631|     51|        }
  632|    102|    }
  633|       |
  634|    759|    spdm_context->connection_info.algorithm.measurement_spec =
  635|    759|        spdm_response->measurement_specification_sel;
  636|    759|    spdm_context->connection_info.algorithm.measurement_hash_algo =
  637|    759|        spdm_response->measurement_hash_algo;
  638|    759|    spdm_context->connection_info.algorithm.base_asym_algo = spdm_response->base_asym_sel;
  639|    759|    spdm_context->connection_info.algorithm.base_hash_algo = spdm_response->base_hash_sel;
  640|       |
  641|    759|    if (libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (641:9): [True: 69, False: 690]
  ------------------
  642|    759|            spdm_context, false, 0,
  643|    759|            SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP) &&
  ------------------
  |  |  236|    759|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP (0x00000008 | 0x00000010)
  ------------------
  644|    759|        (spdm_request->measurement_specification != 0)) {
  ------------------
  |  Branch (644:9): [True: 54, False: 15]
  ------------------
  645|     54|        if (spdm_context->connection_info.algorithm.measurement_spec !=
  ------------------
  |  Branch (645:13): [True: 35, False: 19]
  ------------------
  646|     54|            SPDM_MEASUREMENT_SPECIFICATION_DMTF) {
  ------------------
  |  |  740|     54|#define SPDM_MEASUREMENT_SPECIFICATION_DMTF 0x01
  ------------------
  647|     35|            return libspdm_generate_error_response(
  648|     35|                spdm_context, SPDM_ERROR_CODE_INVALID_REQUEST,
  ------------------
  |  |  855|     35|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  649|     35|                0, response_size, response);
  650|     35|        }
  651|     19|        algo_size = libspdm_get_measurement_hash_size(
  652|     19|            spdm_context->connection_info.algorithm.measurement_hash_algo);
  653|     19|        if (algo_size == 0) {
  ------------------
  |  Branch (653:13): [True: 0, False: 19]
  ------------------
  654|      0|            return libspdm_generate_error_response(
  655|      0|                spdm_context, SPDM_ERROR_CODE_INVALID_REQUEST,
  ------------------
  |  |  855|      0|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  656|      0|                0, response_size, response);
  657|      0|        }
  658|     19|    }
  659|       |
  660|    724|    if (libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (660:9): [True: 0, False: 724]
  ------------------
  661|    724|            spdm_context, false, 0,
  662|    724|            SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_CAP) ||
  ------------------
  |  |  234|    724|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_CAP 0x00000002
  ------------------
  663|    724|        libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (663:9): [True: 69, False: 655]
  ------------------
  664|    724|            spdm_context, false, 0,
  665|    724|            SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP) ||
  ------------------
  |  |  235|    724|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP 0x00000004
  ------------------
  666|    724|        libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (666:9): [True: 34, False: 621]
  ------------------
  667|    655|            spdm_context, false, 0,
  668|    655|            SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP_SIG) ||
  ------------------
  |  |  238|    655|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP_SIG 0x00000010
  ------------------
  669|    724|        libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (669:9): [True: 98, False: 523]
  ------------------
  670|    621|            spdm_context, false,
  671|    621|            SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP,
  ------------------
  |  |  190|    621|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  672|    621|            SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP) ||
  ------------------
  |  |  251|    621|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  673|    724|        libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (673:9): [True: 69, False: 454]
  ------------------
  674|    523|            spdm_context, false,
  675|    523|            SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP,
  ------------------
  |  |  191|    523|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP (0x00000400 | 0x00000800)
  ------------------
  676|    523|            SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP)) {
  ------------------
  |  |  252|    523|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP (0x00000400 | 0x00000800)
  ------------------
  677|    270|        algo_size = libspdm_get_hash_size(
  678|    270|            spdm_context->connection_info.algorithm.base_hash_algo);
  679|    270|        if (algo_size == 0) {
  ------------------
  |  Branch (679:13): [True: 96, False: 174]
  ------------------
  680|     96|            return libspdm_generate_error_response(
  681|     96|                spdm_context,
  682|     96|                SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     96|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  683|     96|                response_size, response);
  684|     96|        }
  685|    270|    }
  686|       |
  687|    628|    if (libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (687:9): [True: 0, False: 628]
  ------------------
  688|    628|            spdm_context, false, 0,
  689|    628|            SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_CAP) ||
  ------------------
  |  |  234|    628|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_CAP 0x00000002
  ------------------
  690|    628|        libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (690:9): [True: 43, False: 585]
  ------------------
  691|    628|            spdm_context, false, 0,
  692|    628|            SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP) ||
  ------------------
  |  |  235|    628|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP 0x00000004
  ------------------
  693|    628|        libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (693:9): [True: 25, False: 560]
  ------------------
  694|    585|            spdm_context, false, 0,
  695|    585|            SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP_SIG) ||
  ------------------
  |  |  238|    585|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP_SIG 0x00000010
  ------------------
  696|    628|        libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (696:9): [True: 63, False: 497]
  ------------------
  697|    560|            spdm_context, false,
  698|    560|            SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP,
  ------------------
  |  |  190|    560|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  699|    560|            SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP)) {
  ------------------
  |  |  251|    560|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  700|    131|        algo_size = libspdm_get_asym_signature_size(
  701|    131|            spdm_context->connection_info.algorithm.base_asym_algo);
  702|    131|        if (algo_size == 0) {
  ------------------
  |  Branch (702:13): [True: 47, False: 84]
  ------------------
  703|     47|            return libspdm_generate_error_response(
  704|     47|                spdm_context, SPDM_ERROR_CODE_INVALID_REQUEST,
  ------------------
  |  |  855|     47|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  705|     47|                0, response_size, response);
  706|     47|        }
  707|    131|    }
  708|       |
  709|       |    /* -=[Process Request Phase]=- */
  710|    581|    if (spdm_response->header.spdm_version >= SPDM_MESSAGE_VERSION_11) {
  ------------------
  |  |  111|    581|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  |  Branch (710:9): [True: 574, False: 7]
  ------------------
  711|  1.31k|        for (index = 0; index < spdm_response->header.param1; ++index) {
  ------------------
  |  Branch (711:25): [True: 737, False: 574]
  ------------------
  712|    737|            switch(spdm_response->struct_table[index].alg_type) {
  713|    189|            case SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE:
  ------------------
  |  |  349|    189|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_DHE 2
  ------------------
  |  Branch (713:13): [True: 189, False: 548]
  ------------------
  714|    189|                spdm_context->connection_info.algorithm.dhe_named_group =
  715|    189|                    spdm_response->struct_table[index].alg_supported;
  716|    189|                break;
  717|    170|            case SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD:
  ------------------
  |  |  350|    170|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_AEAD 3
  ------------------
  |  Branch (717:13): [True: 170, False: 567]
  ------------------
  718|    170|                spdm_context->connection_info.algorithm.aead_cipher_suite =
  719|    170|                    spdm_response->struct_table[index].alg_supported;
  720|    170|                break;
  721|    178|            case SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG:
  ------------------
  |  |  351|    178|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_REQ_BASE_ASYM_ALG 4
  ------------------
  |  Branch (721:13): [True: 178, False: 559]
  ------------------
  722|    178|                spdm_context->connection_info.algorithm.req_base_asym_alg =
  723|    178|                    spdm_response->struct_table[index].alg_supported;
  724|    178|                break;
  725|    200|            case SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE:
  ------------------
  |  |  352|    200|#define SPDM_NEGOTIATE_ALGORITHMS_STRUCT_TABLE_ALG_TYPE_KEY_SCHEDULE 5
  ------------------
  |  Branch (725:13): [True: 200, False: 537]
  ------------------
  726|    200|                spdm_context->connection_info.algorithm.key_schedule =
  727|    200|                    spdm_response->struct_table[index].alg_supported;
  728|    200|                break;
  729|      0|            default:
  ------------------
  |  Branch (729:13): [True: 0, False: 737]
  ------------------
  730|       |                /* Unreachable */
  731|      0|                LIBSPDM_ASSERT(false);
  732|      0|                break;
  733|    737|            }
  734|    737|        }
  735|    574|        if (spdm_response->header.spdm_version >= SPDM_MESSAGE_VERSION_12) {
  ------------------
  |  |  112|    574|#define SPDM_MESSAGE_VERSION_12 0x12
  ------------------
  |  Branch (735:13): [True: 116, False: 458]
  ------------------
  736|    116|            if (spdm_response->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
  ------------------
  |  |  113|    116|#define SPDM_MESSAGE_VERSION_13 0x13
  ------------------
  |  Branch (736:17): [True: 102, False: 14]
  ------------------
  737|    102|                spdm_context->connection_info.algorithm.other_params_support =
  738|    102|                    (spdm_context->connection_info.algorithm.other_params_support &
  739|    102|                     SPDM_ALGORITHMS_MULTI_KEY_CONN) |
  ------------------
  |  |  478|    102|#define SPDM_ALGORITHMS_MULTI_KEY_CONN 0x10
  ------------------
  740|    102|                    (spdm_response->other_params_selection &
  741|    102|                     SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK);
  ------------------
  |  |  476|    102|#define SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK 0xF
  ------------------
  742|    102|                spdm_context->connection_info.algorithm.mel_spec =
  743|    102|                    spdm_response->mel_specification_sel;
  744|    102|            } else {
  745|     14|                spdm_context->connection_info.algorithm.other_params_support =
  746|     14|                    (spdm_response->other_params_selection &
  747|     14|                     SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK);
  ------------------
  |  |  476|     14|#define SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK 0xF
  ------------------
  748|     14|                spdm_context->connection_info.algorithm.mel_spec = 0;
  749|     14|            }
  750|    458|        } else {
  751|    458|            spdm_context->connection_info.algorithm.other_params_support = 0;
  752|    458|        }
  753|       |
  754|    574|        if (libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (754:13): [True: 68, False: 506]
  ------------------
  755|    574|                spdm_context, false,
  756|    574|                SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP,
  ------------------
  |  |  190|    574|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  757|    574|                SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP)) {
  ------------------
  |  |  251|    574|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  758|     68|            algo_size = libspdm_get_dhe_pub_key_size(
  759|     68|                spdm_context->connection_info.algorithm.dhe_named_group);
  760|     68|            if (algo_size == 0) {
  ------------------
  |  Branch (760:17): [True: 37, False: 31]
  ------------------
  761|     37|                return libspdm_generate_error_response(
  762|     37|                    spdm_context,
  763|     37|                    SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     37|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  764|     37|                    response_size, response);
  765|     37|            }
  766|     68|        }
  767|    537|        if (libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (767:13): [True: 19, False: 518]
  ------------------
  768|    537|                spdm_context, false,
  769|    537|                SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP,
  ------------------
  |  |  187|    537|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP 0x00000040
  ------------------
  770|    537|                SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP) ||
  ------------------
  |  |  248|    537|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP 0x00000040
  ------------------
  771|    537|            libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (771:13): [True: 69, False: 449]
  ------------------
  772|    518|                spdm_context, false,
  773|    518|                SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP,
  ------------------
  |  |  188|    518|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP 0x00000080
  ------------------
  774|    518|                SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP)) {
  ------------------
  |  |  249|    518|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP 0x00000080
  ------------------
  775|     88|            algo_size = libspdm_get_aead_key_size(
  776|     88|                spdm_context->connection_info.algorithm.aead_cipher_suite);
  777|     88|            if (algo_size == 0) {
  ------------------
  |  Branch (777:17): [True: 61, False: 27]
  ------------------
  778|     61|                return libspdm_generate_error_response(
  779|     61|                    spdm_context,
  780|     61|                    SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     61|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  781|     61|                    response_size, response);
  782|     61|            }
  783|     88|        }
  784|    476|        if (libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (784:13): [True: 149, False: 327]
  ------------------
  785|    476|                spdm_context, false,
  786|    476|                SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP,
  ------------------
  |  |  189|    476|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  787|    476|                SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP)) {
  ------------------
  |  |  250|    476|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  788|    149|            algo_size = libspdm_get_req_asym_signature_size(
  789|    149|                spdm_context->connection_info.algorithm.req_base_asym_alg);
  790|    149|            if (algo_size == 0) {
  ------------------
  |  Branch (790:17): [True: 100, False: 49]
  ------------------
  791|    100|                return libspdm_generate_error_response(
  792|    100|                    spdm_context,
  793|    100|                    SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|    100|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  794|    100|                    response_size, response);
  795|    100|            }
  796|    149|        }
  797|    376|        if (libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (797:13): [True: 21, False: 355]
  ------------------
  798|    376|                spdm_context, false,
  799|    376|                SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP,
  ------------------
  |  |  190|    376|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  800|    376|                SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP) ||
  ------------------
  |  |  251|    376|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  801|    376|            libspdm_is_capabilities_flag_supported(
  ------------------
  |  Branch (801:13): [True: 43, False: 312]
  ------------------
  802|    355|                spdm_context, false,
  803|    355|                SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP,
  ------------------
  |  |  191|    355|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP (0x00000400 | 0x00000800)
  ------------------
  804|    355|                SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP)) {
  ------------------
  |  |  252|    355|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP (0x00000400 | 0x00000800)
  ------------------
  805|     64|            if (spdm_context->connection_info.algorithm.key_schedule !=
  ------------------
  |  Branch (805:17): [True: 35, False: 29]
  ------------------
  806|     64|                SPDM_ALGORITHMS_KEY_SCHEDULE_SPDM) {
  ------------------
  |  |  425|     64|#define SPDM_ALGORITHMS_KEY_SCHEDULE_SPDM 0x00000001
  ------------------
  807|     35|                return libspdm_generate_error_response(
  808|     35|                    spdm_context,
  809|     35|                    SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     35|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  810|     35|                    response_size, response);
  811|     35|            }
  812|     64|        }
  813|       |
  814|    341|        if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
  ------------------
  |  |  113|    341|#define SPDM_MESSAGE_VERSION_13 0x13
  ------------------
  |  Branch (814:13): [True: 102, False: 239]
  ------------------
  815|    102|            if ((spdm_context->connection_info.algorithm.other_params_support &
  ------------------
  |  Branch (815:17): [True: 48, False: 54]
  ------------------
  816|    102|                 SPDM_ALGORITHMS_MULTI_KEY_CONN) == 0) {
  ------------------
  |  |  478|    102|#define SPDM_ALGORITHMS_MULTI_KEY_CONN 0x10
  ------------------
  817|     48|                if ((spdm_context->local_context.capability.flags &
  ------------------
  |  Branch (817:21): [True: 0, False: 48]
  ------------------
  818|     48|                     SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP) ==
  ------------------
  |  |  295|     48|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP (0x04000000 | 0x08000000)
  ------------------
  819|     48|                    SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP_ONLY) {
  ------------------
  |  |  296|     48|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP_ONLY 0x04000000
  ------------------
  820|      0|                    return libspdm_generate_error_response(
  821|      0|                        spdm_context,
  822|      0|                        SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|      0|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  823|      0|                        response_size, response);
  824|      0|                }
  825|     48|                spdm_context->connection_info.multi_key_conn_rsp = false;
  826|     54|            } else {
  827|     54|                if ((spdm_context->local_context.capability.flags &
  ------------------
  |  Branch (827:21): [True: 54, False: 0]
  ------------------
  828|     54|                     SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP) == 0) {
  ------------------
  |  |  295|     54|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MULTI_KEY_CAP (0x04000000 | 0x08000000)
  ------------------
  829|     54|                    return libspdm_generate_error_response(
  830|     54|                        spdm_context,
  831|     54|                        SPDM_ERROR_CODE_INVALID_REQUEST, 0,
  ------------------
  |  |  855|     54|#define SPDM_ERROR_CODE_INVALID_REQUEST 0x01
  ------------------
  832|     54|                        response_size, response);
  833|     54|                }
  834|      0|                spdm_context->connection_info.multi_key_conn_rsp = true;
  835|      0|            }
  836|    102|        }
  837|    341|    } else {
  838|      7|        spdm_context->connection_info.algorithm.dhe_named_group = 0;
  839|      7|        spdm_context->connection_info.algorithm.aead_cipher_suite = 0;
  840|      7|        spdm_context->connection_info.algorithm.req_base_asym_alg = 0;
  841|      7|        spdm_context->connection_info.algorithm.key_schedule = 0;
  842|      7|        spdm_context->connection_info.algorithm.other_params_support = 0;
  843|      7|    }
  844|       |
  845|    294|    status = libspdm_append_message_a(spdm_context, spdm_request, spdm_request_size);
  846|    294|    if (LIBSPDM_STATUS_IS_ERROR(status)) {
  ------------------
  |  |   30|    294|    (LIBSPDM_STATUS_SEVERITY(status) == LIBSPDM_SEVERITY_ERROR)
  |  |  ------------------
  |  |  |  |   37|    294|#define LIBSPDM_STATUS_SEVERITY(status) (((status) >> 28) & 0xf)
  |  |  ------------------
  |  |                   (LIBSPDM_STATUS_SEVERITY(status) == LIBSPDM_SEVERITY_ERROR)
  |  |  ------------------
  |  |  |  |   44|    294|#define LIBSPDM_SEVERITY_ERROR 0x8
  |  |  ------------------
  |  |  |  Branch (30:5): [True: 0, False: 294]
  |  |  ------------------
  ------------------
  847|      0|        return libspdm_generate_error_response(spdm_context,
  848|      0|                                               SPDM_ERROR_CODE_UNSPECIFIED, 0,
  ------------------
  |  |  858|      0|#define SPDM_ERROR_CODE_UNSPECIFIED 0x05
  ------------------
  849|      0|                                               response_size, response);
  850|      0|    }
  851|       |
  852|    294|    status = libspdm_append_message_a(spdm_context, spdm_response, *response_size);
  853|    294|    if (LIBSPDM_STATUS_IS_ERROR(status)) {
  ------------------
  |  |   30|    294|    (LIBSPDM_STATUS_SEVERITY(status) == LIBSPDM_SEVERITY_ERROR)
  |  |  ------------------
  |  |  |  |   37|    294|#define LIBSPDM_STATUS_SEVERITY(status) (((status) >> 28) & 0xf)
  |  |  ------------------
  |  |                   (LIBSPDM_STATUS_SEVERITY(status) == LIBSPDM_SEVERITY_ERROR)
  |  |  ------------------
  |  |  |  |   44|    294|#define LIBSPDM_SEVERITY_ERROR 0x8
  |  |  ------------------
  |  |  |  Branch (30:5): [True: 0, False: 294]
  |  |  ------------------
  ------------------
  854|      0|        return libspdm_generate_error_response(spdm_context,
  855|      0|                                               SPDM_ERROR_CODE_UNSPECIFIED, 0,
  ------------------
  |  |  858|      0|#define SPDM_ERROR_CODE_UNSPECIFIED 0x05
  ------------------
  856|      0|                                               response_size, response);
  857|      0|    }
  858|       |
  859|       |    /* -=[Update State Phase]=- */
  860|    294|    libspdm_set_connection_state(spdm_context, LIBSPDM_CONNECTION_STATE_NEGOTIATED);
  861|       |
  862|    294|    return LIBSPDM_STATUS_SUCCESS;
  ------------------
  |  |   59|    294|    LIBSPDM_STATUS_CONSTRUCT(LIBSPDM_SEVERITY_SUCCESS, LIBSPDM_SOURCE_SUCCESS, 0x0000)
  |  |  ------------------
  |  |  |  |   55|    294|    ((libspdm_return_t)(((severity) << 28) | ((source) << 16) | (code)))
  |  |  ------------------
  ------------------
  863|    294|}
libspdm_rsp_algorithms.c:libspdm_prioritize_algorithm:
   44|  3.46k|{
   45|  3.46k|    uint32_t common_algo;
   46|  3.46k|    size_t index;
   47|       |
   48|  3.46k|    common_algo = (local_algo & peer_algo);
   49|  19.5k|    for (index = 0; index < priority_table_count; index++) {
  ------------------
  |  Branch (49:21): [True: 17.7k, False: 1.88k]
  ------------------
   50|  17.7k|        if ((common_algo & priority_table[index]) != 0) {
  ------------------
  |  Branch (50:13): [True: 1.57k, False: 16.1k]
  ------------------
   51|  1.57k|            return priority_table[index];
   52|  1.57k|        }
   53|  17.7k|    }
   54|       |
   55|  1.88k|    return 0;
   56|  3.46k|}

libspdm_generate_error_response:
   14|  6.38k|{
   15|  6.38k|    spdm_error_response_t *spdm_response;
   16|       |
   17|  6.38k|    LIBSPDM_ASSERT(*response_size >= sizeof(spdm_error_response_t));
   18|  6.38k|    *response_size = sizeof(spdm_error_response_t);
   19|  6.38k|    spdm_response = response;
   20|       |
   21|  6.38k|    spdm_response->header.spdm_version = libspdm_get_connection_version (spdm_context);
   22|  6.38k|    if (spdm_response->header.spdm_version == 0) {
  ------------------
  |  Branch (22:9): [True: 0, False: 6.38k]
  ------------------
   23|       |        /* if version is not negotiated, then use default version 1.0 */
   24|      0|        spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10;
  ------------------
  |  |  110|      0|#define SPDM_MESSAGE_VERSION_10 0x10
  ------------------
   25|      0|    }
   26|  6.38k|    spdm_response->header.request_response_code = SPDM_ERROR;
  ------------------
  |  |   37|  6.38k|#define SPDM_ERROR 0x7F
  ------------------
   27|  6.38k|    spdm_response->header.param1 = error_code;
   28|  6.38k|    spdm_response->header.param2 = error_data;
   29|       |
   30|  6.38k|    if (spdm_response->header.spdm_version <= SPDM_MESSAGE_VERSION_11) {
  ------------------
  |  |  111|  6.38k|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  |  Branch (30:9): [True: 3.68k, False: 2.70k]
  ------------------
   31|  3.68k|        LIBSPDM_ASSERT ((error_code != SPDM_ERROR_CODE_RESPONSE_TOO_LARGE) &&
   32|  3.68k|                        (error_code != SPDM_ERROR_CODE_LARGE_RESPONSE));
   33|  3.68k|    }
   34|       |
   35|  6.38k|    return LIBSPDM_STATUS_SUCCESS;
  ------------------
  |  |   59|  6.38k|    LIBSPDM_STATUS_CONSTRUCT(LIBSPDM_SEVERITY_SUCCESS, LIBSPDM_SOURCE_SUCCESS, 0x0000)
  |  |  ------------------
  |  |  |  |   55|  6.38k|    ((libspdm_return_t)(((severity) << 28) | ((source) << 16) | (code)))
  |  |  ------------------
  ------------------
   36|  6.38k|}

libspdm_set_connection_state:
  392|    294|{
  393|    294|    if (spdm_context->connection_info.connection_state != connection_state) {
  ------------------
  |  Branch (393:9): [True: 294, False: 0]
  ------------------
  394|    294|        spdm_context->connection_info.connection_state = connection_state;
  395|    294|        libspdm_trigger_connection_state_callback(spdm_context, connection_state);
  396|    294|    }
  397|    294|}
libspdm_rsp_receive_send.c:libspdm_trigger_connection_state_callback:
  377|    294|{
  378|    294|    if (spdm_context->spdm_connection_state_callback != NULL) {
  ------------------
  |  Branch (378:9): [True: 0, False: 294]
  ------------------
  379|      0|        ((libspdm_connection_state_callback_func)
  380|      0|         spdm_context->spdm_connection_state_callback)(spdm_context, connection_state);
  381|      0|    }
  382|    294|}

libspdm_secured_message_get_context_size:
   15|  9.43k|{
   16|  9.43k|    return sizeof(libspdm_secured_message_context_t);
   17|  9.43k|}
libspdm_secured_message_init_context:
   27|  18.8k|{
   28|  18.8k|    libspdm_secured_message_context_t *secured_message_context;
   29|       |
   30|  18.8k|    secured_message_context = spdm_secured_message_context;
   31|  18.8k|    libspdm_zero_mem(secured_message_context, sizeof(libspdm_secured_message_context_t));
   32|  18.8k|}

allocate_zero_pool:
   20|    393|{
   21|    393|    void *buffer;
   22|    393|    buffer = malloc(AllocationSize);
   23|    393|    if (buffer == NULL) {
  ------------------
  |  Branch (23:9): [True: 0, False: 393]
  ------------------
   24|      0|        return NULL;
   25|      0|    }
   26|    393|    memset(buffer, 0, AllocationSize);
   27|    393|    return buffer;
   28|    393|}

libspdm_copy_mem:
   12|    941|{
   13|    941|    volatile uint8_t* dst;
   14|    941|    const volatile uint8_t* src;
   15|       |
   16|    941|    dst = (volatile uint8_t*) dst_buf;
   17|    941|    src = (const volatile uint8_t*) src_buf;
   18|       |
   19|    941|    if ((dst == NULL) || (src == NULL)) {
  ------------------
  |  Branch (19:9): [True: 0, False: 941]
  |  Branch (19:26): [True: 0, False: 941]
  ------------------
   20|      0|        LIBSPDM_ASSERT(0);
   21|      0|    }
   22|    941|    if (((src < dst) && ((src + src_len) > dst)) || ((dst < src) && ((dst + src_len) > src))) {
  ------------------
  |  Branch (22:10): [True: 644, False: 297]
  |  Branch (22:25): [True: 0, False: 644]
  |  Branch (22:54): [True: 297, False: 644]
  |  Branch (22:69): [True: 0, False: 297]
  ------------------
   23|      0|        LIBSPDM_ASSERT(0);
   24|      0|    }
   25|    941|    if (src_len > dst_len) {
  ------------------
  |  Branch (25:9): [True: 0, False: 941]
  ------------------
   26|      0|        LIBSPDM_ASSERT(0);
   27|      0|    }
   28|       |
   29|   148k|    while (src_len-- != 0) {
  ------------------
  |  Branch (29:12): [True: 147k, False: 941]
  ------------------
   30|   147k|        *(dst++) = *(src++);
   31|   147k|    }
   32|    941|}

libspdm_zero_mem:
   17|  30.7k|{
   18|       |
   19|       |#if defined(__STDC_LIB_EXT1__)
   20|       |    memset_s(buffer, length, 0, length);
   21|       |#elif defined(_WIN32)
   22|       |    SecureZeroMemory(buffer, length);
   23|       |#elif defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
   24|       |    explicit_bzero(buffer, length);
   25|       |#else
   26|  30.7k|    volatile uint8_t *pointer;
   27|       |
   28|  30.7k|    pointer = (uint8_t *)buffer;
   29|  60.4M|    while (length-- != 0) {
  ------------------
  |  Branch (29:12): [True: 60.4M, False: 30.7k]
  ------------------
   30|  60.4M|        *(pointer++) = 0;
   31|  60.4M|    }
   32|       |
   33|       |#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
   34|       |    _ReadWriteBarrier();
   35|       |#elif defined(__GNUC__)
   36|       |    __asm__ __volatile__ ("" : : : "memory");
   37|  30.7k|#endif
   38|       |
   39|  30.7k|#endif
   40|  30.7k|}

libspdm_setup_test_context:
   59|    393|{
   60|    393|    m_libspdm_test_context = spdm_test_context;
   61|    393|}
libspdm_unit_test_group_setup:
   64|  4.71k|{
   65|  4.71k|    libspdm_test_context_t *spdm_test_context;
   66|  4.71k|    void *spdm_context;
   67|       |
   68|  4.71k|    spdm_test_context = m_libspdm_test_context;
   69|  4.71k|    spdm_test_context->spdm_context =
   70|  4.71k|        (void *)malloc(libspdm_get_context_size());
   71|  4.71k|    if (spdm_test_context->spdm_context == NULL) {
  ------------------
  |  Branch (71:9): [True: 0, False: 4.71k]
  ------------------
   72|      0|        return (size_t)-1;
   73|      0|    }
   74|  4.71k|    spdm_context = spdm_test_context->spdm_context;
   75|       |
   76|  4.71k|    libspdm_init_context(spdm_context);
   77|       |
   78|  4.71k|    libspdm_register_device_io_func(spdm_context,
   79|  4.71k|                                    spdm_test_context->send_message,
   80|  4.71k|                                    spdm_test_context->receive_message);
   81|  4.71k|    libspdm_register_transport_layer_func(spdm_context,
   82|  4.71k|                                          LIBSPDM_MAX_SPDM_MSG_SIZE,
  ------------------
  |  |  101|  4.71k|#define LIBSPDM_MAX_SPDM_MSG_SIZE 0x1200
  ------------------
   83|  4.71k|                                          LIBSPDM_TEST_TRANSPORT_HEADER_SIZE,
  ------------------
  |  |   27|  4.71k|#define LIBSPDM_TEST_TRANSPORT_HEADER_SIZE  (2 + 8 + \
  |  |   28|  4.71k|                                             LIBSPDM_TEST_SEQUENCE_NUMBER_COUNT)
  |  |  ------------------
  |  |  |  |   16|  4.71k|#define LIBSPDM_TEST_SEQUENCE_NUMBER_COUNT 2
  |  |  ------------------
  ------------------
   84|  4.71k|                                          LIBSPDM_TEST_TRANSPORT_TAIL_SIZE,
  ------------------
  |  |   30|  4.71k|#define LIBSPDM_TEST_TRANSPORT_TAIL_SIZE    (LIBSPDM_TEST_MAX_RANDOM_NUMBER_COUNT + \
  |  |  ------------------
  |  |  |  |   17|  4.71k|#define LIBSPDM_TEST_MAX_RANDOM_NUMBER_COUNT 32
  |  |  ------------------
  |  |   31|  4.71k|                                             LIBSPDM_MAX_AEAD_TAG_SIZE + \
  |  |  ------------------
  |  |  |  |   75|  4.71k|#define LIBSPDM_MAX_AEAD_TAG_SIZE 16
  |  |  ------------------
  |  |   32|  4.71k|                                             (LIBSPDM_TEST_ALIGNMENT - 1))
  |  |  ------------------
  |  |  |  |   15|  4.71k|#define LIBSPDM_TEST_ALIGNMENT 4
  |  |  ------------------
  ------------------
   85|  4.71k|                                          libspdm_transport_test_encode_message,
   86|  4.71k|                                          libspdm_transport_test_decode_message);
   87|  4.71k|    libspdm_register_device_buffer_func(spdm_context,
   88|  4.71k|                                        LIBSPDM_MAX_SENDER_RECEIVER_BUFFER_SIZE,
  ------------------
  |  |   93|  4.71k|#define LIBSPDM_MAX_SENDER_RECEIVER_BUFFER_SIZE LIBSPDM_RECEIVER_BUFFER_SIZE
  |  |  ------------------
  |  |  |  |   78|  4.71k|#define LIBSPDM_RECEIVER_BUFFER_SIZE (0x1200 + \
  |  |  |  |   79|  4.71k|                                      LIBSPDM_TRANSPORT_ADDITIONAL_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|  4.71k|#define LIBSPDM_TRANSPORT_ADDITIONAL_SIZE    (LIBSPDM_TEST_TRANSPORT_HEADER_SIZE + \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   27|  4.71k|#define LIBSPDM_TEST_TRANSPORT_HEADER_SIZE  (2 + 8 + \
  |  |  |  |  |  |  |  |   28|  4.71k|                                             LIBSPDM_TEST_SEQUENCE_NUMBER_COUNT)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  4.71k|#define LIBSPDM_TEST_SEQUENCE_NUMBER_COUNT 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   71|  4.71k|                                              LIBSPDM_TEST_TRANSPORT_TAIL_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  4.71k|#define LIBSPDM_TEST_TRANSPORT_TAIL_SIZE    (LIBSPDM_TEST_MAX_RANDOM_NUMBER_COUNT + \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   17|  4.71k|#define LIBSPDM_TEST_MAX_RANDOM_NUMBER_COUNT 32
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   31|  4.71k|                                             LIBSPDM_MAX_AEAD_TAG_SIZE + \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   75|  4.71k|#define LIBSPDM_MAX_AEAD_TAG_SIZE 16
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|  4.71k|                                             (LIBSPDM_TEST_ALIGNMENT - 1))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   15|  4.71k|#define LIBSPDM_TEST_ALIGNMENT 4
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   89|  4.71k|                                        LIBSPDM_MAX_SENDER_RECEIVER_BUFFER_SIZE,
  ------------------
  |  |   93|  4.71k|#define LIBSPDM_MAX_SENDER_RECEIVER_BUFFER_SIZE LIBSPDM_RECEIVER_BUFFER_SIZE
  |  |  ------------------
  |  |  |  |   78|  4.71k|#define LIBSPDM_RECEIVER_BUFFER_SIZE (0x1200 + \
  |  |  |  |   79|  4.71k|                                      LIBSPDM_TRANSPORT_ADDITIONAL_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |   70|  4.71k|#define LIBSPDM_TRANSPORT_ADDITIONAL_SIZE    (LIBSPDM_TEST_TRANSPORT_HEADER_SIZE + \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   27|  4.71k|#define LIBSPDM_TEST_TRANSPORT_HEADER_SIZE  (2 + 8 + \
  |  |  |  |  |  |  |  |   28|  4.71k|                                             LIBSPDM_TEST_SEQUENCE_NUMBER_COUNT)
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   16|  4.71k|#define LIBSPDM_TEST_SEQUENCE_NUMBER_COUNT 2
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |   71|  4.71k|                                              LIBSPDM_TEST_TRANSPORT_TAIL_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   30|  4.71k|#define LIBSPDM_TEST_TRANSPORT_TAIL_SIZE    (LIBSPDM_TEST_MAX_RANDOM_NUMBER_COUNT + \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   17|  4.71k|#define LIBSPDM_TEST_MAX_RANDOM_NUMBER_COUNT 32
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   31|  4.71k|                                             LIBSPDM_MAX_AEAD_TAG_SIZE + \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   75|  4.71k|#define LIBSPDM_MAX_AEAD_TAG_SIZE 16
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|  4.71k|                                             (LIBSPDM_TEST_ALIGNMENT - 1))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   15|  4.71k|#define LIBSPDM_TEST_ALIGNMENT 4
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   90|  4.71k|                                        spdm_device_acquire_sender_buffer,
   91|  4.71k|                                        spdm_device_release_sender_buffer,
   92|  4.71k|                                        spdm_device_acquire_receiver_buffer,
   93|  4.71k|                                        spdm_device_release_receiver_buffer);
   94|       |
   95|  4.71k|    spdm_test_context->scratch_buffer_size =
   96|  4.71k|        libspdm_get_sizeof_required_scratch_buffer(spdm_context);
   97|  4.71k|    spdm_test_context->scratch_buffer = (void *)malloc(spdm_test_context->scratch_buffer_size);
   98|  4.71k|    libspdm_set_scratch_buffer (spdm_context,
   99|  4.71k|                                spdm_test_context->scratch_buffer,
  100|  4.71k|                                spdm_test_context->scratch_buffer_size);
  101|       |
  102|  4.71k|    *State = spdm_test_context;
  103|  4.71k|    return 0;
  104|  4.71k|}
libspdm_unit_test_group_teardown:
  107|  4.71k|{
  108|  4.71k|    libspdm_test_context_t *spdm_test_context;
  109|       |
  110|  4.71k|    spdm_test_context = *State;
  111|  4.71k|    free(spdm_test_context->spdm_context);
  112|  4.71k|    free(spdm_test_context->scratch_buffer);
  113|  4.71k|    spdm_test_context->spdm_context = NULL;
  114|  4.71k|    return 0;
  115|  4.71k|}

libspdm_alignment_size:
   21|    393|{
   22|    393|    size_t alignment;
   23|    393|    size_t max_buffer_size;
   24|       |
   25|    393|    alignment = LIBSPDM_TEST_ALIGNMENT;
  ------------------
  |  |   15|    393|#define LIBSPDM_TEST_ALIGNMENT 4
  ------------------
   26|    393|    max_buffer_size = libspdm_get_max_buffer_size();
   27|       |
   28|       |    /* In the situation where max_buffer_size is not four-byte aligned, reserve sufficient size for the buffer_size */
   29|    393|    if ((size > max_buffer_size - alignment) && (size & (alignment - 1)) != 0) {
  ------------------
  |  Branch (29:9): [True: 45, False: 348]
  |  Branch (29:49): [True: 4, False: 41]
  ------------------
   30|      4|        size -= alignment;
   31|      4|    }
   32|       |
   33|    393|    if (((size) & (alignment - 1)) == 3) {
  ------------------
  |  Branch (33:9): [True: 66, False: 327]
  ------------------
   34|     66|        size += 1;
   35|     66|    }
   36|    393|    if (((size) & (alignment - 1)) == 2) {
  ------------------
  |  Branch (36:9): [True: 38, False: 355]
  ------------------
   37|     38|        size += 2;
   38|     38|    }
   39|    393|    if (((size) & (alignment - 1)) == 1) {
  ------------------
  |  Branch (39:9): [True: 205, False: 188]
  ------------------
   40|    205|        size += 3;
   41|    205|    }
   42|    393|    return size;
   43|    393|}
LLVMFuzzerTestOneInput:
  112|    393|{
  113|    393|    void *test_buffer;
  114|    393|    size_t max_buffer_size;
  115|       |
  116|       |    /* 1. Initialize test_buffer*/
  117|    393|    max_buffer_size = libspdm_get_max_buffer_size();
  118|    393|    test_buffer = allocate_zero_pool(max_buffer_size);
  119|    393|    if (test_buffer == NULL) {
  ------------------
  |  Branch (119:9): [True: 0, False: 393]
  ------------------
  120|      0|        return 0;
  121|      0|    }
  122|    393|    if (size == 0) {
  ------------------
  |  Branch (122:9): [True: 0, False: 393]
  ------------------
  123|      0|        printf("\033[1;33m file_size of the seed file is 0, so exit.\033[0m \n");
  124|      0|        free(test_buffer);
  125|      0|        return 0;
  126|      0|    }
  127|    393|    if (size > max_buffer_size) {
  ------------------
  |  Branch (127:9): [True: 40, False: 353]
  ------------------
  128|     40|        size = max_buffer_size;
  129|    353|    } else {
  130|    353|        libspdm_copy_mem(test_buffer, max_buffer_size, data, size);
  131|    353|    }
  132|    393|    size = libspdm_alignment_size(size);
  133|       |    /* 2. Run test*/
  134|    393|    libspdm_run_test_harness(test_buffer, size);
  135|       |    /* 3. Clean up*/
  136|    393|    free(test_buffer);
  137|    393|    return 0;
  138|    393|}

libspdm_get_max_buffer_size:
   12|    786|{
   13|    786|    return LIBSPDM_MAX_SPDM_MSG_SIZE;
  ------------------
  |  |  101|    786|#define LIBSPDM_MAX_SPDM_MSG_SIZE 0x1200
  ------------------
   14|    786|}
libspdm_test_responder_algorithms_case1:
   17|    393|{
   18|    393|    libspdm_test_context_t *spdm_test_context;
   19|    393|    libspdm_context_t *spdm_context;
   20|    393|    size_t response_size;
   21|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
   22|    393|    response_size = sizeof(response);
   23|       |
   24|    393|    spdm_test_context = *State;
   25|    393|    spdm_context = spdm_test_context->spdm_context;
   26|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 <<
  ------------------
  |  |  111|    393|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
   27|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
   28|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
   29|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
   30|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
   31|       |
   32|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
   33|    393|                                    spdm_test_context->test_buffer, &response_size, response);
   34|    393|}
libspdm_test_responder_algorithms_case2:
   37|    393|{
   38|    393|    libspdm_test_context_t *spdm_test_context;
   39|    393|    libspdm_context_t *spdm_context;
   40|    393|    size_t response_size;
   41|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
   42|    393|    response_size = sizeof(response);
   43|       |
   44|    393|    spdm_test_context = *State;
   45|    393|    spdm_context = spdm_test_context->spdm_context;
   46|    393|    spdm_context->response_state = LIBSPDM_RESPONSE_STATE_NORMAL;
   47|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
   48|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_10 <<
  ------------------
  |  |  110|    393|#define SPDM_MESSAGE_VERSION_10 0x10
  ------------------
   49|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
   50|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
   51|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
   52|       |
   53|    393|    libspdm_reset_message_a(spdm_context);
   54|       |
   55|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
   56|    393|                                    spdm_test_context->test_buffer, &response_size, response);
   57|    393|}
libspdm_test_responder_algorithms_case3:
   60|    393|{
   61|    393|    libspdm_test_context_t *spdm_test_context;
   62|    393|    libspdm_context_t *spdm_context;
   63|    393|    size_t response_size;
   64|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
   65|    393|    response_size = sizeof(response);
   66|       |
   67|    393|    spdm_test_context = *State;
   68|    393|    spdm_context = spdm_test_context->spdm_context;
   69|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
   70|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 <<
  ------------------
  |  |  111|    393|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
   71|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
   72|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
   73|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
   74|    393|    spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
   75|    393|    spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
   76|    393|    spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
   77|    393|    spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
   78|    393|    spdm_context->local_context.capability.flags =
   79|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP | SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP;
  ------------------
  |  |  188|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP 0x00000080
  ------------------
                      SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP | SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP;
  ------------------
  |  |  249|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP 0x00000080
  ------------------
   80|    393|    spdm_context->connection_info.capability.flags =
   81|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP | SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP;
  ------------------
  |  |  188|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP 0x00000080
  ------------------
                      SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP | SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP;
  ------------------
  |  |  249|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP 0x00000080
  ------------------
   82|       |
   83|    393|    libspdm_reset_message_a(spdm_context);
   84|       |
   85|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
   86|    393|                                    spdm_test_context->test_buffer, &response_size, response);
   87|    393|}
libspdm_test_responder_algorithms_case4:
   90|    393|{
   91|    393|    libspdm_test_context_t *spdm_test_context;
   92|    393|    libspdm_context_t *spdm_context;
   93|    393|    size_t response_size;
   94|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
   95|    393|    response_size = sizeof(response);
   96|       |
   97|    393|    spdm_test_context = *State;
   98|    393|    spdm_context = spdm_test_context->spdm_context;
   99|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  100|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 <<
  ------------------
  |  |  111|    393|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  101|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
  102|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
  103|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
  104|    393|    spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
  105|    393|    spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
  106|    393|    spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
  107|    393|    spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
  108|    393|    spdm_context->local_context.capability.flags =
  109|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP | SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP |
  ------------------
  |  |  188|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP 0x00000080
  ------------------
                      SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP | SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP |
  ------------------
  |  |  249|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP 0x00000080
  ------------------
  110|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP |
  ------------------
  |  |  235|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP 0x00000004
  ------------------
  111|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP |
  ------------------
  |  |  187|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP 0x00000040
  ------------------
  112|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP |
  ------------------
  |  |  248|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP 0x00000040
  ------------------
  113|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP |
  ------------------
  |  |  250|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  114|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP |
  ------------------
  |  |  190|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  115|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP;
  ------------------
  |  |  251|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  116|    393|    spdm_context->connection_info.capability.flags =
  117|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP | SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP |
  ------------------
  |  |  188|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP 0x00000080
  ------------------
                      SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP | SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP |
  ------------------
  |  |  249|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP 0x00000080
  ------------------
  118|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP |
  ------------------
  |  |  235|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP 0x00000004
  ------------------
  119|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP |
  ------------------
  |  |  187|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP 0x00000040
  ------------------
  120|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP |
  ------------------
  |  |  248|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP 0x00000040
  ------------------
  121|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP |
  ------------------
  |  |  250|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  122|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP |
  ------------------
  |  |  189|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  123|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP |
  ------------------
  |  |  190|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  124|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP;
  ------------------
  |  |  251|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  125|       |
  126|    393|    libspdm_reset_message_a(spdm_context);
  127|       |
  128|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  129|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  130|    393|}
libspdm_test_responder_algorithms_case5:
  132|    393|{
  133|    393|    libspdm_test_context_t *spdm_test_context;
  134|    393|    libspdm_context_t *spdm_context;
  135|    393|    size_t response_size;
  136|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
  137|    393|    response_size = sizeof(response);
  138|       |
  139|    393|    spdm_test_context = *State;
  140|    393|    spdm_context = spdm_test_context->spdm_context;
  141|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  142|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 <<
  ------------------
  |  |  111|    393|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  143|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
  144|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
  145|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
  146|    393|    spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
  147|    393|    spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
  148|    393|    spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
  149|    393|    spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
  150|    393|    spdm_context->local_context.capability.flags =
  151|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP |
  ------------------
  |  |  250|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  152|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP;
  ------------------
  |  |  189|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  153|    393|    spdm_context->connection_info.capability.flags =
  154|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP |
  ------------------
  |  |  250|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  155|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP;
  ------------------
  |  |  189|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  156|       |
  157|    393|    libspdm_reset_message_a(spdm_context);
  158|       |
  159|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  160|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  161|    393|}
libspdm_test_responder_algorithms_case6:
  164|    393|{
  165|    393|    libspdm_test_context_t *spdm_test_context;
  166|    393|    libspdm_context_t *spdm_context;
  167|    393|    size_t response_size;
  168|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
  169|    393|    response_size = sizeof(response);
  170|       |
  171|    393|    spdm_test_context = *State;
  172|    393|    spdm_context = spdm_test_context->spdm_context;
  173|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  174|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 <<
  ------------------
  |  |  111|    393|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  175|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
  176|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
  177|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
  178|    393|    spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
  179|    393|    spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
  180|    393|    spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
  181|    393|    spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
  182|    393|    spdm_context->local_context.capability.flags =
  183|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP |
  ------------------
  |  |  250|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  184|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP;
  ------------------
  |  |  189|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  185|    393|    spdm_context->connection_info.capability.flags =
  186|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP |
  ------------------
  |  |  250|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  187|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP;
  ------------------
  |  |  189|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  188|       |
  189|    393|    libspdm_reset_message_a(spdm_context);
  190|       |
  191|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  192|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  193|    393|}
libspdm_test_responder_algorithms_case7:
  196|    393|{
  197|    393|    libspdm_test_context_t *spdm_test_context;
  198|    393|    libspdm_context_t *spdm_context;
  199|    393|    size_t response_size;
  200|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
  201|    393|    response_size = sizeof(response);
  202|       |
  203|    393|    spdm_test_context = *State;
  204|    393|    spdm_context = spdm_test_context->spdm_context;
  205|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  206|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 <<
  ------------------
  |  |  111|    393|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  207|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
  208|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
  209|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
  210|    393|    spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
  211|    393|    spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
  212|    393|    spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
  213|    393|    spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
  214|    393|    spdm_context->local_context.capability.flags = SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP |
  ------------------
  |  |  190|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  215|    393|                                                   SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP;
  ------------------
  |  |  251|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  216|    393|    spdm_context->connection_info.capability.flags =
  217|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP |
  ------------------
  |  |  190|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  218|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP;
  ------------------
  |  |  251|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  219|       |
  220|    393|    libspdm_reset_message_a(spdm_context);
  221|       |
  222|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  223|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  224|    393|}
libspdm_test_responder_algorithms_case8:
  227|    393|{
  228|    393|    libspdm_test_context_t *spdm_test_context;
  229|    393|    libspdm_context_t *spdm_context;
  230|    393|    size_t response_size;
  231|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
  232|    393|    response_size = sizeof(response);
  233|       |
  234|    393|    spdm_test_context = *State;
  235|    393|    spdm_context = spdm_test_context->spdm_context;
  236|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  237|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 <<
  ------------------
  |  |  111|    393|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  238|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
  239|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
  240|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
  241|    393|    spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
  242|    393|    spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
  243|    393|    spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
  244|    393|    spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
  245|    393|    spdm_context->local_context.capability.flags =
  246|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP | SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP;
  ------------------
  |  |  252|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP (0x00000400 | 0x00000800)
  ------------------
                      SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP | SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP;
  ------------------
  |  |  191|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP (0x00000400 | 0x00000800)
  ------------------
  247|    393|    spdm_context->connection_info.capability.flags =
  248|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP | SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP;
  ------------------
  |  |  252|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP (0x00000400 | 0x00000800)
  ------------------
                      SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP | SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP;
  ------------------
  |  |  191|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP (0x00000400 | 0x00000800)
  ------------------
  249|       |
  250|    393|    libspdm_reset_message_a(spdm_context);
  251|       |
  252|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  253|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  254|    393|}
libspdm_test_responder_algorithms_case9:
  257|    393|{
  258|    393|    libspdm_test_context_t *spdm_test_context;
  259|    393|    libspdm_context_t *spdm_context;
  260|    393|    size_t response_size;
  261|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
  262|    393|    response_size = sizeof(response);
  263|       |
  264|    393|    spdm_test_context = *State;
  265|    393|    spdm_context = spdm_test_context->spdm_context;
  266|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  267|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 <<
  ------------------
  |  |  111|    393|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  268|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
  269|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
  270|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
  271|       |
  272|    393|    libspdm_reset_message_a(spdm_context);
  273|       |
  274|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  275|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  276|    393|}
libspdm_test_responder_algorithms_case10:
  279|    393|{
  280|    393|    libspdm_test_context_t *spdm_test_context;
  281|    393|    libspdm_context_t *spdm_context;
  282|    393|    size_t response_size;
  283|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
  284|    393|    response_size = sizeof(response);
  285|       |
  286|    393|    spdm_test_context = *State;
  287|    393|    spdm_context = spdm_test_context->spdm_context;
  288|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  289|    393|    spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
  ------------------
  |  |  236|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP (0x00000008 | 0x00000010)
  ------------------
  290|    393|    spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP;
  ------------------
  |  |  236|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP (0x00000008 | 0x00000010)
  ------------------
  291|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 <<
  ------------------
  |  |  111|    393|#define SPDM_MESSAGE_VERSION_11 0x11
  ------------------
  292|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
  293|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
  294|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
  295|    393|    spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
  296|    393|    spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
  297|    393|    spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
  298|    393|    spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
  299|    393|    spdm_context->local_context.algorithm.measurement_spec = m_libspdm_use_measurement_spec;
  300|    393|    spdm_context->connection_info.algorithm.measurement_spec = m_libspdm_use_measurement_spec;
  301|    393|    spdm_context->local_context.algorithm.measurement_hash_algo =
  302|    393|        m_libspdm_use_measurement_hash_algo;
  303|    393|    spdm_context->local_context.algorithm.measurement_hash_algo =
  304|    393|        SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_512;
  ------------------
  |  |  460|    393|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_512 0x00000008
  ------------------
  305|    393|    spdm_context->connection_info.algorithm.measurement_hash_algo =
  306|    393|        SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_512;
  ------------------
  |  |  460|    393|#define SPDM_ALGORITHMS_MEASUREMENT_HASH_ALGO_TPM_ALG_SHA_512 0x00000008
  ------------------
  307|    393|    libspdm_reset_message_a(spdm_context);
  308|       |
  309|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  310|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  311|    393|}
libspdm_test_responder_algorithms_case11:
  314|    393|{
  315|    393|    libspdm_test_context_t    *spdm_test_context;
  316|    393|    libspdm_context_t  *spdm_context;
  317|    393|    size_t response_size;
  318|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
  319|       |
  320|    393|    spdm_test_context = *State;
  321|    393|    spdm_context = spdm_test_context->spdm_context;
  322|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  323|       |
  324|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_12 <<
  ------------------
  |  |  112|    393|#define SPDM_MESSAGE_VERSION_12 0x12
  ------------------
  325|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
  326|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
  327|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
  328|    393|    spdm_context->local_context.algorithm.dhe_named_group = m_libspdm_use_dhe_algo;
  329|    393|    spdm_context->local_context.algorithm.aead_cipher_suite = m_libspdm_use_aead_algo;
  330|    393|    spdm_context->local_context.algorithm.req_base_asym_alg = m_libspdm_use_req_asym_algo;
  331|    393|    spdm_context->local_context.algorithm.key_schedule = m_libspdm_use_key_schedule_algo;
  332|    393|    spdm_context->local_context.algorithm.other_params_support =
  333|    393|        SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_1;
  ------------------
  |  |  475|    393|#define SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_1 0x2
  ------------------
  334|    393|    libspdm_reset_message_a(spdm_context);
  335|    393|    spdm_context->local_context.capability.flags = 0;
  336|    393|    spdm_context->connection_info.capability.flags = 0;
  337|    393|    spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP;
  ------------------
  |  |  190|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  338|    393|    spdm_context->connection_info.capability.flags |=
  339|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP;
  ------------------
  |  |  251|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP 0x00000200
  ------------------
  340|       |
  341|    393|    spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP;
  ------------------
  |  |  187|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP 0x00000040
  ------------------
  342|    393|    spdm_context->connection_info.capability.flags |=
  343|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP;
  ------------------
  |  |  248|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP 0x00000040
  ------------------
  344|       |
  345|    393|    spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP;
  ------------------
  |  |  188|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP 0x00000080
  ------------------
  346|    393|    spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP;
  ------------------
  |  |  249|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP 0x00000080
  ------------------
  347|       |
  348|    393|    spdm_context->local_context.capability.flags |=
  349|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP;
  ------------------
  |  |  189|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  350|    393|    spdm_context->connection_info.capability.flags |=
  351|    393|        SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP;
  ------------------
  |  |  250|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP 0x00000100
  ------------------
  352|       |
  353|    393|    spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP;
  ------------------
  |  |  191|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP (0x00000400 | 0x00000800)
  ------------------
  354|    393|    spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP;
  ------------------
  |  |  252|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP (0x00000400 | 0x00000800)
  ------------------
  355|       |
  356|    393|    response_size = sizeof(response);
  357|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  358|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  359|    393|}
libspdm_test_responder_algorithms_case12:
  362|    393|{
  363|    393|    libspdm_test_context_t    *spdm_test_context;
  364|    393|    libspdm_context_t  *spdm_context;
  365|    393|    size_t response_size;
  366|    393|    uint8_t response[LIBSPDM_MAX_SPDM_MSG_SIZE];
  367|       |
  368|    393|    spdm_test_context = *State;
  369|    393|    spdm_context = spdm_test_context->spdm_context;
  370|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  371|       |
  372|    393|    spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_13 <<
  ------------------
  |  |  113|    393|#define SPDM_MESSAGE_VERSION_13 0x13
  ------------------
  373|    393|                                            SPDM_VERSION_NUMBER_SHIFT_BIT;
  ------------------
  |  |  140|    393|#define SPDM_VERSION_NUMBER_SHIFT_BIT 8
  ------------------
  374|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  375|    393|    spdm_context->local_context.algorithm.base_hash_algo = m_libspdm_use_hash_algo;
  376|    393|    spdm_context->local_context.algorithm.base_asym_algo = m_libspdm_use_asym_algo;
  377|    393|    spdm_context->local_context.algorithm.measurement_hash_algo = 0;
  378|    393|    spdm_context->local_context.algorithm.measurement_spec = 0;
  379|    393|    spdm_context->local_context.capability.flags = 0;
  380|    393|    spdm_context->local_context.algorithm.other_params_support = 0;
  381|    393|    spdm_context->local_context.algorithm.mel_spec = SPDM_MEL_SPECIFICATION_DMTF;
  ------------------
  |  |  840|    393|#define SPDM_MEL_SPECIFICATION_DMTF 0x01
  ------------------
  382|    393|    libspdm_reset_message_a(spdm_context);
  383|       |
  384|    393|    spdm_context->connection_info.algorithm.other_params_support = SPDM_ALGORITHMS_MULTI_KEY_CONN;
  ------------------
  |  |  478|    393|#define SPDM_ALGORITHMS_MULTI_KEY_CONN 0x10
  ------------------
  385|       |
  386|       |    /* Sub Case 1: MEL_CAP set 1*/
  387|    393|    spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEL_CAP;
  ------------------
  |  |  293|    393|#define SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEL_CAP 0x01000000
  ------------------
  388|       |
  389|    393|    response_size = sizeof(response);
  390|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  391|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  392|       |
  393|       |    /* Sub Case 2: MEL_CAP set 0*/
  394|    393|    spdm_context->local_context.capability.flags = 0;
  395|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  396|    393|    libspdm_reset_message_a(spdm_context);
  397|       |
  398|    393|    response_size = sizeof(response);
  399|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  400|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  401|       |
  402|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  403|    393|    libspdm_reset_message_a(spdm_context);
  404|       |
  405|    393|    spdm_context->local_context.algorithm.other_params_support = 0;
  406|    393|    spdm_context->connection_info.capability.flags =
  407|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_ONLY;
  ------------------
  |  |  224|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_ONLY 0x04000000
  ------------------
  408|       |
  409|    393|    response_size = sizeof(response);
  410|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  411|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  412|       |
  413|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  414|    393|    libspdm_reset_message_a(spdm_context);
  415|       |
  416|    393|    spdm_context->local_context.algorithm.other_params_support = SPDM_ALGORITHMS_MULTI_KEY_CONN;
  ------------------
  |  |  478|    393|#define SPDM_ALGORITHMS_MULTI_KEY_CONN 0x10
  ------------------
  417|    393|    spdm_context->connection_info.capability.flags =
  418|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_ONLY;
  ------------------
  |  |  224|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_ONLY 0x04000000
  ------------------
  419|       |
  420|    393|    response_size = sizeof(response);
  421|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  422|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  423|       |
  424|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  425|    393|    libspdm_reset_message_a(spdm_context);
  426|       |
  427|    393|    spdm_context->local_context.algorithm.other_params_support = 0;
  428|    393|    spdm_context->connection_info.capability.flags =
  429|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_NEG;
  ------------------
  |  |  225|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_NEG 0x08000000
  ------------------
  430|       |
  431|    393|    response_size = sizeof(response);
  432|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  433|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  434|       |
  435|       |
  436|    393|    spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES;
  437|    393|    libspdm_reset_message_a(spdm_context);
  438|       |
  439|    393|    spdm_context->local_context.algorithm.other_params_support = SPDM_ALGORITHMS_MULTI_KEY_CONN;
  ------------------
  |  |  478|    393|#define SPDM_ALGORITHMS_MULTI_KEY_CONN 0x10
  ------------------
  440|    393|    spdm_context->connection_info.capability.flags =
  441|    393|        SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_NEG;
  ------------------
  |  |  225|    393|#define SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MULTI_KEY_CAP_NEG 0x08000000
  ------------------
  442|       |
  443|    393|    response_size = sizeof(response);
  444|    393|    libspdm_get_response_algorithms(spdm_context, spdm_test_context->test_buffer_size,
  445|    393|                                    spdm_test_context->test_buffer, &response_size, response);
  446|       |
  447|    393|}
libspdm_run_test_harness:
  455|    393|{
  456|    393|    void *State;
  457|    393|    spdm_message_header_t *spdm_request_header;
  458|    393|    libspdm_setup_test_context(&libspdm_test_responder_context);
  459|       |
  460|    393|    spdm_request_header = (spdm_message_header_t*)test_buffer;
  461|       |
  462|    393|    if (spdm_request_header->request_response_code != SPDM_NEGOTIATE_ALGORITHMS) {
  ------------------
  |  |   72|    393|#define SPDM_NEGOTIATE_ALGORITHMS 0xE3
  ------------------
  |  Branch (462:9): [True: 392, False: 1]
  ------------------
  463|    392|        spdm_request_header->request_response_code = SPDM_NEGOTIATE_ALGORITHMS;
  ------------------
  |  |   72|    392|#define SPDM_NEGOTIATE_ALGORITHMS 0xE3
  ------------------
  464|    392|    }
  465|       |
  466|    393|    libspdm_test_responder_context.test_buffer = test_buffer;
  467|    393|    libspdm_test_responder_context.test_buffer_size = test_buffer_size;
  468|       |
  469|       |    /* Success Case*/
  470|    393|    libspdm_unit_test_group_setup(&State);
  471|    393|    libspdm_test_responder_algorithms_case1(&State);
  472|    393|    libspdm_unit_test_group_teardown(&State);
  473|       |
  474|       |    /* connection_state Check */
  475|    393|    libspdm_unit_test_group_setup(&State);
  476|    393|    libspdm_test_responder_algorithms_case2(&State);
  477|    393|    libspdm_unit_test_group_teardown(&State);
  478|       |
  479|       |    /* Support capabilities flag: SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP*/
  480|    393|    libspdm_unit_test_group_setup(&State);
  481|    393|    libspdm_test_responder_algorithms_case3(&State);
  482|    393|    libspdm_unit_test_group_teardown(&State);
  483|       |
  484|       |    /* Support capabilities flag */
  485|    393|    libspdm_unit_test_group_setup(&State);
  486|    393|    libspdm_test_responder_algorithms_case4(&State);
  487|    393|    libspdm_unit_test_group_teardown(&State);
  488|       |
  489|       |    /* Support capabilities flag: SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP*/
  490|    393|    libspdm_unit_test_group_setup(&State);
  491|    393|    libspdm_test_responder_algorithms_case5(&State);
  492|    393|    libspdm_unit_test_group_teardown(&State);
  493|       |
  494|       |    /* Support capabilities flag: SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP */
  495|    393|    libspdm_unit_test_group_setup(&State);
  496|    393|    libspdm_test_responder_algorithms_case6(&State);
  497|    393|    libspdm_unit_test_group_teardown(&State);
  498|       |
  499|       |    /* Support capabilities flag: SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP*/
  500|    393|    libspdm_unit_test_group_setup(&State);
  501|    393|    libspdm_test_responder_algorithms_case7(&State);
  502|    393|    libspdm_unit_test_group_teardown(&State);
  503|       |
  504|       |    /* Support capabilities flag: SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP*/
  505|    393|    libspdm_unit_test_group_setup(&State);
  506|    393|    libspdm_test_responder_algorithms_case8(&State);
  507|    393|    libspdm_unit_test_group_teardown(&State);
  508|       |
  509|       |    /* response_state: LIBSPDM_RESPONSE_STATE_BUSY */
  510|    393|    libspdm_unit_test_group_setup(&State);
  511|    393|    libspdm_test_responder_algorithms_case9(&State);
  512|    393|    libspdm_unit_test_group_teardown(&State);
  513|       |
  514|       |    /* capabilities: SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP */
  515|    393|    libspdm_unit_test_group_setup(&State);
  516|    393|    libspdm_test_responder_algorithms_case10(&State);
  517|    393|    libspdm_unit_test_group_teardown(&State);
  518|       |
  519|    393|    libspdm_unit_test_group_setup(&State);
  520|    393|    libspdm_test_responder_algorithms_case11(&State);
  521|    393|    libspdm_unit_test_group_teardown(&State);
  522|       |
  523|       |    /* V1.3 requester*/
  524|    393|    libspdm_unit_test_group_setup(&State);
  525|    393|    libspdm_test_responder_algorithms_case12(&State);
  526|    393|    libspdm_unit_test_group_teardown(&State);
  527|    393|}

