TianoCore EDK2 master
Loading...
Searching...
No Matches
SpdmSecurityLib.h
Go to the documentation of this file.
1
10#ifndef SPDM_SECURITY_LIB_H_
11#define SPDM_SECURITY_LIB_H_
12
15
47typedef
48 SPDM_RETURN
50 IN VOID *SpdmContext,
51 IN UINTN MessageSize,
52 IN OUT CONST VOID *Message,
53 IN UINT64 Timeout
54 );
55
90typedef
91 SPDM_RETURN
93 IN VOID *SpdmContext,
94 IN OUT UINTN *MessageSize,
95 IN OUT VOID **Message,
96 IN UINT64 Timeout
97 );
98
128typedef
129 SPDM_RETURN
131 IN VOID *SpdmContext,
132 IN OUT CONST UINT32 *SessionId,
133 IN BOOLEAN IsAppMessage,
134 IN BOOLEAN IsRequester,
135 IN UINTN MessageSize,
136 IN OUT VOID *Message,
137 IN OUT UINTN *TransportMessageSize,
138 IN VOID **TransportMessage
139 );
140
171typedef
172 SPDM_RETURN
174 IN VOID *SpdmContext,
175 IN OUT UINT32 **SessionId,
176 IN BOOLEAN *IsAppMessage,
177 IN BOOLEAN IsRequester,
178 IN UINTN TransportMessageSize,
179 IN OUT VOID *TransportMessage,
180 IN OUT UINTN *MessageSize,
181 IN OUT VOID **Message
182 );
183
221typedef
222 SPDM_RETURN
224 IN VOID *SpdmContext,
225 IN OUT VOID **MsgBufPtr
226 );
227
236typedef
237 VOID
239 IN VOID *SpdmContext,
240 IN CONST VOID *MsgBufPtr
241 );
242
280typedef
281 SPDM_RETURN
283 IN VOID *SpdmContext,
284 IN OUT VOID **MsgBufPtr
285 );
286
295typedef
296 VOID
298 IN VOID *SpdmContext,
299 IN CONST VOID *MsgBufPtr
300 );
301
302typedef struct {
303 UINT32 Version;
304 //
305 // DeviceType is used to create TCG event log context_data.
306 // DeviceHandle is used to create TCG event log device_path information.
307 //
308 EDKII_DEVICE_IDENTIFIER *DeviceId;
309
310 //
311 // TRUE means to use PCR 0 (code) / 1 (config).
312 // FALSE means to use PCR 2 (code) / 3 (config).
313 //
314 BOOLEAN IsEmbeddedDevice;
315
316 //
317 // Below 9 APIs are used to send/receive SPDM request/response.
318 //
319 // The request flow is:
320 // |<--- SenderBufferSize --->|
321 // |<--- TransportRequestBufferSize --->|
322 // |<---MaxHeaderSize--->|<-SpdmRequestBufferSize ->|
323 // +--+------------------+==========================+----------------+--+
324 // | | Transport Header | SPDM Message | Transport Tail | |
325 // +--+------------------+==========================+----------------+--+
326 // ^ ^ ^
327 // | | | SpdmRequestBuffer
328 // | | TransportRequestBuffer
329 // | SenderBuffer
330 //
331 // AcquireSenderBuffer (&SenderBuffer, &SenderBufferSize);
332 // SpdmRequestBuffer = SenderBuffer + TransportHeaderSize;
333 // /* build SPDM request in SpdmRequestBuffer */
334 // TransportEncodeMessage (SpdmRequestBuffer, SpdmRequestBufferSize,
335 // &TransportRequestBuffer, &TransportRequestBufferSize);
336 // SendMessage (TransportRequestBuffer, TransportRequestBufferSize);
337 // ReleaseSenderBuffer (SenderBuffer);
338 //
339 // The response flow is:
340 // |<--- ReceiverBufferSize --->|
341 // |<--- TransportResponseBufferSize --->|
342 // |<-SpdmResponseBufferSize->|
343 // +--+------------------+==========================+----------------+--+
344 // | | Transport Header | SPDM Message | Transport Tail | |
345 // +--+------------------+==========================+----------------+--+
346 // ^ ^ ^
347 // | | | SpdmResponseBuffer
348 // | | TransportResponseBuffer
349 // | ReceiverBuffer
350 //
351 // AcquireReceiverBuffer (&ReceiverBuffer, &ReceiverBufferSize);
352 // TransportResponseBuffer = ReceiverBuffer;
353 // ReceiveMessage (&TransportResponseBuffer, &TransportResponseBufferSize);
354 // TransportDecodeMessage (TransportResponseBuffer, TransportResponseBufferSize,
355 // &SpdmResponseBuffer, &SpdmResponseBufferSize);
356 // /* process SPDM response in SpdmResponseBuffer */
357 // ReleaseReceiverBuffer (ReceiverBuffer);
358 //
359
360 //
361 // API required by SpdmRegisterDeviceIoFunc in libspdm
362 // It is used to send/receive transport message (SPDM + transport header).
363 //
366 //
367 // API required by SpdmRegisterTransportLayerFunc in libspdm
368 // It is used to add/remove transport header for SPDM.
369 //
370 SPDM_TRANSPORT_ENCODE_MESSAGE_FUNC TransportEncodeMessage;
371 SPDM_TRANSPORT_DECODE_MESSAGE_FUNC TransportDecodeMessage;
372 //
373 // API required by SpdmRegisterDeviceBufferFunc in libspdm
374 // It is used to get the sender/receiver buffer for transport message (SPDM + transport header).
375 // The size MUST be big enough to send or receive one transport message (SPDM + transport header).
376 // Tthe sender/receiver buffer MAY be overlapped.
377 //
378 SPDM_DEVICE_ACQUIRE_SENDER_BUFFER_FUNC AcquireSenderBuffer;
379 SPDM_DEVICE_RELEASE_SENDER_BUFFER_FUNC ReleaseSenderBuffer;
380 SPDM_DEVICE_ACQUIRE_RECEIVER_BUFFER_FUNC AcquireReceiverBuffer;
381 SPDM_DEVICE_RELEASE_RECEIVER_BUFFER_FUNC ReleaseReceiverBuffer;
382
383 //
384 // Preferred Algorithm List for SPDM negotiation.
385 // If it is none zero, it will be used directly.
386 // If it is zero, then the SpdmSecurityLib will set the default value.
387 //
388 UINT32 BaseHashAlgo;
389 UINT32 BaseAsymAlgo;
390
391 //
392 // transfer size
393 //
394 UINT32 MaxSpdmMsgSize;
395 UINT32 TransportHeaderSize;
396 UINT32 TransportTailSize;
397 UINT32 SenderBufferSize;
398 UINT32 ReceiverBufferSize;
399
400 EFI_GUID *SpdmIoProtocolGuid;
402
407RETURN_STATUS
408EFIAPI
410 IN EDKII_SPDM_DEVICE_INFO *SpdmDeviceInfo,
411 IN EDKII_DEVICE_SECURITY_POLICY *SecurityPolicy,
412 OUT EDKII_DEVICE_SECURITY_STATE *SecurityState
413 );
414
418VOID *
419EFIAPI
421 IN VOID *SpdmContext
422 );
423
431BOOLEAN
432EFIAPI
434 VOID
435 );
436
437#endif
UINT64 UINTN
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
SPDM_RETURN(* SPDM_DEVICE_ACQUIRE_SENDER_BUFFER_FUNC)(IN VOID *SpdmContext, IN OUT VOID **MsgBufPtr)
SPDM_RETURN(* SPDM_DEVICE_RECEIVE_MESSAGE_FUNC)(IN VOID *SpdmContext, IN OUT UINTN *MessageSize, IN OUT VOID **Message, IN UINT64 Timeout)
VOID *EFIAPI SpdmGetIoProtocolViaSpdmContext(IN VOID *SpdmContext)
SPDM_RETURN(* SPDM_DEVICE_ACQUIRE_RECEIVER_BUFFER_FUNC)(IN VOID *SpdmContext, IN OUT VOID **MsgBufPtr)
SPDM_RETURN(* SPDM_TRANSPORT_DECODE_MESSAGE_FUNC)(IN VOID *SpdmContext, IN OUT UINT32 **SessionId, IN BOOLEAN *IsAppMessage, IN BOOLEAN IsRequester, IN UINTN TransportMessageSize, IN OUT VOID *TransportMessage, IN OUT UINTN *MessageSize, IN OUT VOID **Message)
SPDM_RETURN(* SPDM_TRANSPORT_ENCODE_MESSAGE_FUNC)(IN VOID *SpdmContext, IN OUT CONST UINT32 *SessionId, IN BOOLEAN IsAppMessage, IN BOOLEAN IsRequester, IN UINTN MessageSize, IN OUT VOID *Message, IN OUT UINTN *TransportMessageSize, IN VOID **TransportMessage)
VOID(* SPDM_DEVICE_RELEASE_RECEIVER_BUFFER_FUNC)(IN VOID *SpdmContext, IN CONST VOID *MsgBufPtr)
RETURN_STATUS EFIAPI SpdmDeviceAuthenticationAndMeasurement(IN EDKII_SPDM_DEVICE_INFO *SpdmDeviceInfo, IN EDKII_DEVICE_SECURITY_POLICY *SecurityPolicy, OUT EDKII_DEVICE_SECURITY_STATE *SecurityState)
SPDM_RETURN(* SPDM_DEVICE_SEND_MESSAGE_FUNC)(IN VOID *SpdmContext, IN UINTN MessageSize, IN OUT CONST VOID *Message, IN UINT64 Timeout)
BOOLEAN EFIAPI IsDeviceAuthBootEnabled(VOID)
VOID(* SPDM_DEVICE_RELEASE_SENDER_BUFFER_FUNC)(IN VOID *SpdmContext, IN CONST VOID *MsgBufPtr)
Definition: Base.h:213