@@ -243,6 +243,15 @@ typedef struct {
243
243
#define LIBSPDM_MAX_MESSAGE_F_BUFFER_SIZE (8 + LIBSPDM_MAX_HASH_SIZE * 2 + \
244
244
LIBSPDM_MAX_ASYM_KEY_SIZE)
245
245
246
+ /*
247
+ * +--------------------------+------------------------------------------+---------+
248
+ * | GET_EP_INFO 1.3 | 8 + Nonce (0 or 32) = [8, 40] | 1 |
249
+ * | EP_INFO 1.3 | 12 + Nonce + EPInfoLen = [12, 1024] | [1, 25] |
250
+ * +--------------------------+------------------------------------------+---------+
251
+ */
252
+ #define LIBSPDM_MAX_MESSAGE_E_BUFFER_SIZE (20 + SPDM_NONCE_SIZE * 2 + \
253
+ LIBSPDM_MAX_ENDPOINT_INFO_LENGTH)
254
+
246
255
#define LIBSPDM_MAX_MESSAGE_L1L2_BUFFER_SIZE \
247
256
(LIBSPDM_MAX_MESSAGE_VCA_BUFFER_SIZE + LIBSPDM_MAX_MESSAGE_M_BUFFER_SIZE)
248
257
@@ -257,6 +266,9 @@ typedef struct {
257
266
LIBSPDM_MAX_MESSAGE_D_BUFFER_SIZE + \
258
267
LIBSPDM_MAX_HASH_SIZE + LIBSPDM_MAX_MESSAGE_F_BUFFER_SIZE)
259
268
269
+ #define LIBSPDM_MAX_MESSAGE_IL1IL2_BUFFER_SIZE \
270
+ (LIBSPDM_MAX_MESSAGE_VCA_BUFFER_SIZE + LIBSPDM_MAX_MESSAGE_E_BUFFER_SIZE)
271
+
260
272
typedef struct {
261
273
size_t max_buffer_size ;
262
274
size_t buffer_size ;
@@ -287,6 +299,12 @@ typedef struct {
287
299
uint8_t buffer [LIBSPDM_MAX_MESSAGE_F_BUFFER_SIZE ];
288
300
} libspdm_message_f_managed_buffer_t ;
289
301
302
+ typedef struct {
303
+ size_t max_buffer_size ;
304
+ size_t buffer_size ;
305
+ uint8_t buffer [LIBSPDM_MAX_MESSAGE_E_BUFFER_SIZE ];
306
+ } libspdm_message_e_managed_buffer_t ;
307
+
290
308
typedef struct {
291
309
size_t max_buffer_size ;
292
310
size_t buffer_size ;
@@ -299,6 +317,12 @@ typedef struct {
299
317
uint8_t buffer [LIBSPDM_MAX_MESSAGE_M1M2_BUFFER_SIZE ];
300
318
} libspdm_m1m2_managed_buffer_t ;
301
319
320
+ typedef struct {
321
+ size_t max_buffer_size ;
322
+ size_t buffer_size ;
323
+ uint8_t buffer [LIBSPDM_MAX_MESSAGE_IL1IL2_BUFFER_SIZE ];
324
+ } libspdm_il1il2_managed_buffer_t ;
325
+
302
326
typedef struct {
303
327
size_t max_buffer_size ;
304
328
size_t buffer_size ;
@@ -325,6 +349,12 @@ typedef struct {
325
349
/* L1/L2 = Concatenate (M)
326
350
* M = Concatenate (GET_MEASUREMENT, MEASUREMENT\signature)*/
327
351
352
+ /* IL1/IL2 = Concatenate (A, E)
353
+ * E = Concatenate (GET_ENDPOINT_INFO, ENDPOINT_INFO\signature)*/
354
+
355
+ /* Mut IL1/IL2 = Concatenate (A, Mut E)
356
+ * Mut E = Concatenate (GET_ENDPOINT_INFO, ENDPOINT_INFO\signature)*/
357
+
328
358
typedef struct {
329
359
/* the message_a must be plan text because we do not know the algorithm yet.*/
330
360
libspdm_vca_managed_buffer_t message_a ;
@@ -335,10 +365,14 @@ typedef struct {
335
365
libspdm_message_b_managed_buffer_t message_mut_b ;
336
366
libspdm_message_c_managed_buffer_t message_mut_c ;
337
367
libspdm_message_m_managed_buffer_t message_m ;
368
+ libspdm_message_e_managed_buffer_t message_e ;
369
+ libspdm_message_e_managed_buffer_t message_mut_e ;
338
370
#else
339
371
void * digest_context_m1m2 ;
340
372
void * digest_context_mut_m1m2 ;
341
373
void * digest_context_l1l2 ;
374
+ void * digest_context_il1il2 ;
375
+ void * digest_context_mut_il1il2 ;
342
376
#endif
343
377
} libspdm_transcript_t ;
344
378
@@ -405,10 +439,14 @@ typedef struct {
405
439
libspdm_message_k_managed_buffer_t message_k ;
406
440
libspdm_message_f_managed_buffer_t message_f ;
407
441
libspdm_message_m_managed_buffer_t message_m ;
442
+ libspdm_message_e_managed_buffer_t message_e ;
443
+ libspdm_message_e_managed_buffer_t message_mut_e ;
408
444
#else
409
445
bool message_f_initialized ;
410
446
void * digest_context_th ;
411
447
void * digest_context_l1l2 ;
448
+ void * digest_context_il1il2 ;
449
+ void * digest_context_mut_il1il2 ;
412
450
/* this is back up for message F reset.*/
413
451
void * digest_context_th_backup ;
414
452
#endif
@@ -619,6 +657,10 @@ typedef struct {
619
657
* This field is ignored for other SPDM versions */
620
658
uint8_t spdm_10_11_verify_signature_endian ;
621
659
660
+ #if LIBSPDM_ENABLE_ENDPOINT_INFO_CAP
661
+ libspdm_endpoint_info_device_func endpoint_info_device_func ;
662
+ #endif /* LIBSPDM_ENABLE_ENDPOINT_INFO_CAP */
663
+
622
664
#if LIBSPDM_ENABLE_VENDOR_DEFINED_MESSAGES
623
665
libspdm_vendor_response_callback_func vendor_response_callback ;
624
666
libspdm_vendor_get_id_callback_func vendor_response_get_id ;
@@ -1006,6 +1048,40 @@ uint32_t libspdm_get_measurement_summary_hash_size(libspdm_context_t *spdm_conte
1006
1048
bool is_requester ,
1007
1049
uint8_t measurement_summary_hash_type );
1008
1050
1051
+ /**
1052
+ * This function generates the endpoint info signature based upon il1il2 for authentication.
1053
+ *
1054
+ * @param spdm_context A pointer to the SPDM context.
1055
+ * @param session_info A pointer to the SPDM session context.
1056
+ * @param is_requester Indicate of the signature generation for a requester or a responder.
1057
+ * @param signature The buffer to store the endpoint info signature.
1058
+ *
1059
+ * @retval true challenge signature is generated.
1060
+ * @retval false challenge signature is not generated.
1061
+ **/
1062
+ bool libspdm_generate_endpoint_info_signature (libspdm_context_t * spdm_context ,
1063
+ libspdm_session_info_t * session_info ,
1064
+ bool is_requester ,
1065
+ uint8_t * signature );
1066
+
1067
+ /**
1068
+ * This function verifies the challenge signature based upon m1m2.
1069
+ *
1070
+ * @param spdm_context A pointer to the SPDM context.
1071
+ * @param session_info A pointer to the SPDM session context.
1072
+ * @param is_requester Indicate of the signature verification for a requester or a responder.
1073
+ * @param sign_data The signature data buffer.
1074
+ * @param sign_data_size size in bytes of the signature data buffer.
1075
+ *
1076
+ * @retval true signature verification pass.
1077
+ * @retval false signature verification fail.
1078
+ **/
1079
+ bool libspdm_verify_endpoint_info_signature (libspdm_context_t * spdm_context ,
1080
+ libspdm_session_info_t * session_info ,
1081
+ bool is_requester ,
1082
+ const void * sign_data ,
1083
+ size_t sign_data_size );
1084
+
1009
1085
#if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT
1010
1086
/*
1011
1087
* This function calculates l1l2.
@@ -1306,6 +1382,26 @@ void libspdm_reset_message_encap_d(libspdm_context_t *spdm_context, void *spdm_s
1306
1382
**/
1307
1383
void libspdm_reset_message_f (libspdm_context_t * spdm_context , void * spdm_session_info );
1308
1384
1385
+ /**
1386
+ * Reset message E cache in SPDM context.
1387
+ * If session_info is NULL, this function will use E cache of SPDM context,
1388
+ * else will use E cache of SPDM session context.
1389
+ *
1390
+ * @param spdm_context A pointer to the SPDM context.
1391
+ * @param spdm_session_info A pointer to the SPDM session context.
1392
+ **/
1393
+ void libspdm_reset_message_e (libspdm_context_t * spdm_context , void * session_info );
1394
+
1395
+ /**
1396
+ * Reset message mut E cache in SPDM context.
1397
+ * If session_info is NULL, this function will use mut E cache of SPDM context,
1398
+ * else will use mut E cache of SPDM session context.
1399
+ *
1400
+ * @param spdm_context A pointer to the SPDM context.
1401
+ * @param spdm_session_info A pointer to the SPDM session context.
1402
+ **/
1403
+ void libspdm_reset_message_mut_e (libspdm_context_t * spdm_context , void * session_info );
1404
+
1309
1405
/**
1310
1406
* Append message A cache in SPDM context.
1311
1407
*
@@ -1452,6 +1548,38 @@ libspdm_return_t libspdm_append_message_f(libspdm_context_t *spdm_context,
1452
1548
bool is_requester , const void * message ,
1453
1549
size_t message_size );
1454
1550
1551
+ /**
1552
+ * Append message E cache in SPDM context.
1553
+ * If session_info is NULL, this function will use E cache of SPDM context,
1554
+ * else will use E cache of SPDM session context.
1555
+ *
1556
+ * @param spdm_context A pointer to the SPDM context.
1557
+ * @param session_info A pointer to the SPDM session context.
1558
+ * @param message message buffer.
1559
+ * @param message_size size in bytes of message buffer.
1560
+ *
1561
+ * @return RETURN_SUCCESS message is appended.
1562
+ * @return RETURN_OUT_OF_RESOURCES message is not appended because the internal cache is full.
1563
+ **/
1564
+ libspdm_return_t libspdm_append_message_e (libspdm_context_t * spdm_context , void * session_info ,
1565
+ const void * message , size_t message_size );
1566
+
1567
+ /**
1568
+ * Append message mut E cache in SPDM context.
1569
+ * If session_info is NULL, this function will use mut E cache of SPDM context,
1570
+ * else will use mut E cache of SPDM session context.
1571
+ *
1572
+ * @param spdm_context A pointer to the SPDM context.
1573
+ * @param session_info A pointer to the SPDM session context.
1574
+ * @param message message buffer.
1575
+ * @param message_size size in bytes of message buffer.
1576
+ *
1577
+ * @return RETURN_SUCCESS message is appended.
1578
+ * @return RETURN_OUT_OF_RESOURCES message is not appended because the internal cache is full.
1579
+ **/
1580
+ libspdm_return_t libspdm_append_message_mut_e (libspdm_context_t * spdm_context , void * session_info ,
1581
+ const void * message , size_t message_size );
1582
+
1455
1583
/**
1456
1584
* This function generates a session ID by concatenating req_session_id and rsp_session_id.
1457
1585
*
0 commit comments