TianoCore EDK2 master
Loading...
Searching...
No Matches
SpdmSecurityLibInternal.h
Go to the documentation of this file.
1
10#ifndef SPDM_SECURITY_LIB_INTERNAL_H_
11#define SPDM_SECURITY_LIB_INTERNAL_H_
12
13#include <Uefi.h>
14#include <hal/base.h>
15#include <Stub/SpdmLibStub.h>
16#include <industry_standard/spdm.h>
17#include <industry_standard/spdm_secured_message.h>
21#include <Library/BaseLib.h>
22#include <Library/DebugLib.h>
28#include <Library/UefiLib.h>
30#include <Library/RngLib.h>
32#include <library/spdm_requester_lib.h>
33
36
37#include <Protocol/PciIo.h>
39#include "library/spdm_crypt_lib.h"
40
41#define SPDM_DEVICE_CONTEXT_SIGNATURE SIGNATURE_32 ('S', 'P', 'D', 'C')
42
43typedef struct {
44 UINT32 Signature;
45 // UEFI Context
47 BOOLEAN IsEmbeddedDevice;
48 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
49 VOID *DeviceIo;
50 UINT64 DeviceUID;
51 // SPDM Context
52 UINTN SpdmContextSize;
53 VOID *SpdmContext;
54 UINTN ScratchBufferSize;
55 VOID *ScratchBuffer;
56 UINT8 SpdmVersion;
57 VOID *SpdmIoProtocol;
58 EFI_SIGNATURE_LIST *SignatureList;
59 UINTN SignatureListSize;
61
62typedef struct {
63 UINTN Signature;
64 LIST_ENTRY Link;
65 SPDM_DEVICE_CONTEXT *SpdmDeviceContext;
67
68#define SPDM_DEVICE_CONTEXT_INSTANCE_SIGNATURE SIGNATURE_32 ('S', 'D', 'C', 'S')
69#define SPDM_DEVICE_CONTEXT_INSTANCE_FROM_LINK(a) CR (a, SPDM_DEVICE_CONTEXT_INSTANCE, Link, SPDM_DEVICE_CONTEXT_INSTANCE_SIGNATURE)
70
71VOID *
72EFIAPI
74 IN VOID *SpdmContext
75 );
76
88EFIAPI
90 IN EDKII_SPDM_DEVICE_INFO *SpdmDeviceInfo,
91 OUT EDKII_DEVICE_SECURITY_STATE *SecurityState
92 );
93
94VOID
95EFIAPI
97 IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext
98 );
99
107UINT32
108EFIAPI
110 IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext
111 );
112
120UINTN
121EFIAPI
123 IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext
124 );
125
137EFIAPI
139 IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext,
140 IN OUT VOID *DeviceContext,
141 IN UINTN DeviceContextSize
142 );
143
164 IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext,
165 IN UINT8 AuthState,
166 IN UINTN CertChainSize,
167 IN UINT8 *CertChain,
168 IN VOID *TrustAnchor,
169 IN UINTN TrustAnchorSize,
170 IN UINT8 SlotId,
171 OUT EDKII_DEVICE_SECURITY_STATE *SecurityState
172 );
173
180EFIAPI
182 IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext,
183 IN UINT8 SlotId,
184 OUT EDKII_DEVICE_SECURITY_STATE *SecurityState
185 );
186
203EFIAPI
205 IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext,
206 OUT UINT8 *AuthState,
207 OUT UINT8 *ValidSlotId,
208 OUT EDKII_DEVICE_SECURITY_STATE *SecurityState,
209 OUT BOOLEAN *IsValidCertChain,
210 OUT BOOLEAN *RootCertMatch
211 );
212
227EFIAPI
229 IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext,
230 OUT UINT8 *AuthState,
231 IN UINT8 ValidSlotId,
232 IN BOOLEAN IsValidCertChain,
233 IN BOOLEAN RootCertMatch,
234 OUT EDKII_DEVICE_SECURITY_STATE *SecurityState
235 );
236
243VOID
244EFIAPI
246 CONST UINT8 *Data,
247 UINTN Size
248 );
249
250#endif
UINT64 UINTN
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
VOID *EFIAPI GetSpdmIoProtocolViaSpdmContext(IN VOID *SpdmContext)
SPDM_DEVICE_CONTEXT *EFIAPI CreateSpdmDeviceContext(IN EDKII_SPDM_DEVICE_INFO *SpdmDeviceInfo, OUT EDKII_DEVICE_SECURITY_STATE *SecurityState)
VOID EFIAPI InternalDumpData(CONST UINT8 *Data, UINTN Size)
EFI_STATUS EFIAPI DoDeviceCertificate(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, OUT UINT8 *AuthState, OUT UINT8 *ValidSlotId, OUT EDKII_DEVICE_SECURITY_STATE *SecurityState, OUT BOOLEAN *IsValidCertChain, OUT BOOLEAN *RootCertMatch)
EFI_STATUS EFIAPI CreateDeviceMeasurementContext(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, IN OUT VOID *DeviceContext, IN UINTN DeviceContextSize)
EFI_STATUS ExtendCertificate(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, IN UINT8 AuthState, IN UINTN CertChainSize, IN UINT8 *CertChain, IN VOID *TrustAnchor, IN UINTN TrustAnchorSize, IN UINT8 SlotId, OUT EDKII_DEVICE_SECURITY_STATE *SecurityState)
EFI_STATUS EFIAPI DoDeviceMeasurement(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, IN UINT8 SlotId, OUT EDKII_DEVICE_SECURITY_STATE *SecurityState)
UINT32 EFIAPI GetSpdmDeviceType(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext)
EFI_STATUS EFIAPI DoDeviceAuthentication(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext, OUT UINT8 *AuthState, IN UINT8 ValidSlotId, IN BOOLEAN IsValidCertChain, IN BOOLEAN RootCertMatch, OUT EDKII_DEVICE_SECURITY_STATE *SecurityState)
VOID EFIAPI DestroySpdmDeviceContext(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext)
UINTN EFIAPI GetDeviceMeasurementContextSize(IN SPDM_DEVICE_CONTEXT *SpdmDeviceContext)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29