TianoCore EDK2 master
Loading...
Searching...
No Matches
SmartCardEdge.h
Go to the documentation of this file.
1
17#ifndef __SMART_CARD_EDGE_H__
18#define __SMART_CARD_EDGE_H__
19
20#define EFI_SMART_CARD_EDGE_PROTOCOL_GUID \
21 { \
22 0xd317f29b, 0xa325, 0x4712, {0x9b, 0xf1, 0xc6, 0x19, 0x54, 0xdc, 0x19, 0x8c} \
23 }
24
26
27//
28// Maximum size for a Smart Card AID (Application IDentifier)
29//
30#define SCARD_AID_MAXSIZE 0x0010
31//
32// Size of CSN (Card Serial Number)
33//
34#define SCARD_CSN_SIZE 0x0010
35//
36// Current specification version 1.00
37//
38#define SMART_CARD_EDGE_PROTOCOL_VERSION_1 0x00000100
39//
40// Parameters type definition
41//
42typedef UINT8 SMART_CARD_AID[SCARD_AID_MAXSIZE];
43typedef UINT8 SMART_CARD_CSN[SCARD_CSN_SIZE];
44
45//
46// Type of data elements in credentials list
47//
48// value of tag field for header, the number of containers
49//
50#define SC_EDGE_TAG_HEADER 0x0000
51//
52// value of tag field for certificate
53//
54#define SC_EDGE_TAG_CERT 0x0001
55//
56// value of tag field for key index associated with certificate
57//
58#define SC_EDGE_TAG_KEY_ID 0x0002
59//
60// value of tag field for key type
61//
62#define SC_EDGE_TAG_KEY_TYPE 0x0003
63//
64// value of tag field for key size
65//
66#define SC_EDGE_TAG_KEY_SIZE 0x0004
67
68//
69// Length of L fields of TLV items
70//
71//
72// size of L field for header
73//
74#define SC_EDGE_L_SIZE_HEADER 1
75//
76// size of L field for certificate (big endian)
77//
78#define SC_EDGE_L_SIZE_CERT 2
79//
80// size of L field for key index
81//
82#define SC_EDGE_L_SIZE_KEY_ID 1
83//
84// size of L field for key type
85//
86#define SC_EDGE_L_SIZE_KEY_TYPE 1
87//
88// size of L field for key size (big endian)
89//
90#define SC_EDGE_L_SIZE_KEY_SIZE 2
91
92//
93// Some TLV items have a fixed value for L field
94//
95// value of L field for header
96//
97#define SC_EDGE_L_VALUE_HEADER 1
98//
99// value of L field for key index
100//
101#define SC_EDGE_L_VALUE_KEY_ID 1
102//
103// value of L field for key type
104//
105#define SC_EDGE_L_VALUE_KEY_TYPE 1
106//
107// value of L field for key size
108//
109#define SC_EDGE_L_VALUE_KEY_SIZE 2
110
111//
112// Possible values for key type
113//
114//
115// RSA decryption
116//
117#define SC_EDGE_RSA_EXCHANGE 0x01
118//
119// RSA signature
120//
121#define SC_EDGE_RSA_SIGNATURE 0x02
122//
123// ECDSA signature
124//
125#define SC_EDGE_ECDSA_256 0x03
126//
127// ECDSA signature
128//
129#define SC_EDGE_ECDSA_384 0x04
130//
131// ECDSA signature
132//
133#define SC_EDGE_ECDSA_521 0x05
134//
135// ECDH agreement
136//
137#define SC_EDGE_ECDH_256 0x06
138//
139// ECDH agreement
140//
141#define SC_EDGE_ECDH_384 0x07
142//
143// ECDH agreement
144//
145#define SC_EDGE_ECDH_521 0x08
146
147//
148// Padding methods GUIDs for signature
149//
150//
151// RSASSA- PKCS#1-V1.5 padding method, for signature
152//
153#define EFI_PADDING_RSASSA_PKCS1V1P5_GUID \
154 { \
155 0x9317ec24, 0x7cb0, 0x4d0e, {0x8b, 0x32, 0x2e, 0xd9, 0x20, 0x9c, 0xd8, 0xaf} \
156 }
157
158extern EFI_GUID gEfiPaddingRsassaPkcs1V1P5Guid;
159
160//
161// RSASSA-PSS padding method, for signature
162//
163#define EFI_PADDING_RSASSA_PSS_GUID \
164 { \
165 0x7b2349e0, 0x522d, 0x4f8e, {0xb9, 0x27, 0x69, 0xd9, 0x7c, 0x9e, 0x79, 0x5f} \
166 }
167
168extern EFI_GUID gEfiPaddingRsassaPssGuid;
169
170//
171// Padding methods GUIDs for decryption
172//
173//
174// No padding, for decryption
175//
176#define EFI_PADDING_NONE_GUID \
177 { \
178 0x3629ddb1, 0x228c, 0x452e, {0xb6, 0x16, 0x09, 0xed, 0x31, 0x6a, 0x97, 0x00} \
179 }
180
181extern EFI_GUID gEfiPaddingNoneGuid;
182
183//
184// RSAES-PKCS#1-V1.5 padding, for decryption
185//
186#define EFI_PADDING_RSAES_PKCS1V1P5_GUID \
187 { \
188 0xe1c1d0a9, 0x40b1, 0x4632, {0xbd, 0xcc, 0xd9, 0xd6, 0xe5, 0x29, 0x56, 0x31} \
189 }
190
191extern EFI_GUID gEfiPaddingRsaesPkcs1V1P5Guid;
192
193//
194// RSAES-OAEP padding, for decryption
195//
196#define EFI_PADDING_RSAES_OAEP_GUID \
197 { \
198 0xc1e63ac4, 0xd0cf, 0x4ce6, {0x83, 0x5b, 0xee, 0xd0, 0xe6, 0xa8, 0xa4, 0x5b} \
199 }
200
201extern EFI_GUID gEfiPaddingRsaesOaepGuid;
202
246typedef
250 OUT UINTN *NumberAidSupported,
251 IN OUT UINTN *AidTableSize OPTIONAL,
252 OUT SMART_CARD_AID *AidTable OPTIONAL,
253 OUT UINTN *NumberSCPresent,
254 IN OUT UINTN *CsnTableSize OPTIONAL,
255 OUT SMART_CARD_CSN *CsnTable OPTIONAL,
256 OUT UINT32 *VersionScEdgeProtocol OPTIONAL
257 );
258
288typedef
292 OUT EFI_HANDLE *SCardHandle,
293 IN UINT8 *ScardCsn OPTIONAL,
294 OUT UINT8 *ScardAid OPTIONAL
295 );
296
312typedef
316 IN EFI_HANDLE SCardHandle
317 );
318
333typedef
337 IN EFI_HANDLE SCardHandle,
338 OUT UINT8 Csn[SCARD_CSN_SIZE]
339 );
340
360typedef
364 IN EFI_HANDLE SCardHandle,
365 IN OUT UINTN *ReaderNameLength,
366 OUT CHAR16 *ReaderName OPTIONAL
367 );
368
410typedef
414 IN EFI_HANDLE SCardHandle,
415 IN INT32 PinSize,
416 IN UINT8 *PinCode,
417 OUT BOOLEAN *PinResult,
418 OUT UINT32 *RemainingAttempts OPTIONAL
419 );
420
441typedef
445 IN EFI_HANDLE SCardHandle,
446 OUT UINT32 *RemainingAttempts
447 );
448
480typedef
484 IN EFI_HANDLE SCardHandle,
485 IN EFI_GUID *DataId,
486 IN OUT UINTN *DataSize,
487 OUT VOID *Data OPTIONAL
488 );
489
531typedef
535 IN EFI_HANDLE SCardHandle,
536 IN OUT UINTN *CredentialSize,
537 OUT UINT8 *CredentialList OPTIONAL
538 );
539
589typedef
593 IN EFI_HANDLE SCardHandle,
594 IN UINTN KeyId,
595 IN UINTN KeyType,
596 IN EFI_GUID *HashAlgorithm,
597 IN EFI_GUID *PaddingMethod,
598 IN UINT8 *HashedData,
599 OUT UINT8 *SignatureData
600 );
601
653typedef
657 IN EFI_HANDLE SCardHandle,
658 IN UINTN KeyId,
659 IN EFI_GUID *HashAlgorithm,
660 IN EFI_GUID *PaddingMethod,
661 IN UINTN EncryptedSize,
662 IN UINT8 *EncryptedData,
663 IN OUT UINTN *PlaintextSize,
664 OUT UINT8 *PlaintextData
665 );
666
703typedef
707 IN EFI_HANDLE SCardHandle,
708 IN UINTN KeyId,
709 IN UINT8 *dataQx,
710 IN UINT8 *dataQy,
711 OUT UINT8 *DHAgreement
712 );
713
731};
732
733extern EFI_GUID gEfiSmartCardEdgeProtocolGuid;
734
735#endif
UINT64 UINTN
#define OPTIONAL
Definition: Base.h:290
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_READER_NAME)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN OUT UINTN *ReaderNameLength, OUT CHAR16 *ReaderName OPTIONAL)
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_CONTEXT)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, OUT UINTN *NumberAidSupported, IN OUT UINTN *AidTableSize OPTIONAL, OUT SMART_CARD_AID *AidTable OPTIONAL, OUT UINTN *NumberSCPresent, IN OUT UINTN *CsnTableSize OPTIONAL, OUT SMART_CARD_CSN *CsnTable OPTIONAL, OUT UINT32 *VersionScEdgeProtocol OPTIONAL)
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_VERIFY_PIN)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN INT32 PinSize, IN UINT8 *PinCode, OUT BOOLEAN *PinResult, OUT UINT32 *RemainingAttempts OPTIONAL)
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_CSN)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, OUT UINT8 Csn[SCARD_CSN_SIZE])
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_PIN_REMAINING)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, OUT UINT32 *RemainingAttempts)
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_SIGN_DATA)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN UINTN KeyId, IN UINTN KeyType, IN EFI_GUID *HashAlgorithm, IN EFI_GUID *PaddingMethod, IN UINT8 *HashedData, OUT UINT8 *SignatureData)
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_DISCONNECT)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle)
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_CREDENTIAL)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN OUT UINTN *CredentialSize, OUT UINT8 *CredentialList OPTIONAL)
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_BUILD_DH_AGREEMENT)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN UINTN KeyId, IN UINT8 *dataQx, IN UINT8 *dataQy, OUT UINT8 *DHAgreement)
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_GET_DATA)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN EFI_GUID *DataId, IN OUT UINTN *DataSize, OUT VOID *Data OPTIONAL)
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_CONNECT)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, OUT EFI_HANDLE *SCardHandle, IN UINT8 *ScardCsn OPTIONAL, OUT UINT8 *ScardAid OPTIONAL)
EFI_STATUS(EFIAPI * EFI_SMART_CARD_EDGE_DECRYPT_DATA)(IN EFI_SMART_CARD_EDGE_PROTOCOL *This, IN EFI_HANDLE SCardHandle, IN UINTN KeyId, IN EFI_GUID *HashAlgorithm, IN EFI_GUID *PaddingMethod, IN UINTN EncryptedSize, IN UINT8 *EncryptedData, IN OUT UINTN *PlaintextSize, OUT UINT8 *PlaintextData)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
Definition: Base.h:213