2 The Smart Card Edge Protocol provides an abstraction for device to provide Smart
5 This protocol allows UEFI applications to interface with a Smart Card during
6 boot process for authentication or data signing/decryption, especially if the
7 application has to make use of PKI.
9 Copyright (c) 2015-2018, Intel Corporation. All rights reserved.<BR>
10 SPDX-License-Identifier: BSD-2-Clause-Patent
12 @par Revision Reference:
13 This Protocol was introduced in UEFI Specification 2.5.
17 #ifndef __SMART_CARD_EDGE_H__
18 #define __SMART_CARD_EDGE_H__
20 #define EFI_SMART_CARD_EDGE_PROTOCOL_GUID \
22 0xd317f29b, 0xa325, 0x4712, {0x9b, 0xf1, 0xc6, 0x19, 0x54, 0xdc, 0x19, 0x8c} \
25 typedef struct _EFI_SMART_CARD_EDGE_PROTOCOL EFI_SMART_CARD_EDGE_PROTOCOL
;
28 // Maximum size for a Smart Card AID (Application IDentifier)
30 #define SCARD_AID_MAXSIZE 0x0010
32 // Size of CSN (Card Serial Number)
34 #define SCARD_CSN_SIZE 0x0010
36 // Current specification version 1.00
38 #define SMART_CARD_EDGE_PROTOCOL_VERSION_1 0x00000100
40 // Parameters type definition
42 typedef UINT8 SMART_CARD_AID
[SCARD_AID_MAXSIZE
];
43 typedef UINT8 SMART_CARD_CSN
[SCARD_CSN_SIZE
];
46 // Type of data elements in credentials list
48 // value of tag field for header, the number of containers
50 #define SC_EDGE_TAG_HEADER 0x0000
52 // value of tag field for certificate
54 #define SC_EDGE_TAG_CERT 0x0001
56 // value of tag field for key index associated with certificate
58 #define SC_EDGE_TAG_KEY_ID 0x0002
60 // value of tag field for key type
62 #define SC_EDGE_TAG_KEY_TYPE 0x0003
64 // value of tag field for key size
66 #define SC_EDGE_TAG_KEY_SIZE 0x0004
69 // Length of L fields of TLV items
72 // size of L field for header
74 #define SC_EDGE_L_SIZE_HEADER 1
76 // size of L field for certificate (big endian)
78 #define SC_EDGE_L_SIZE_CERT 2
80 // size of L field for key index
82 #define SC_EDGE_L_SIZE_KEY_ID 1
84 // size of L field for key type
86 #define SC_EDGE_L_SIZE_KEY_TYPE 1
88 // size of L field for key size (big endian)
90 #define SC_EDGE_L_SIZE_KEY_SIZE 2
93 // Some TLV items have a fixed value for L field
95 // value of L field for header
97 #define SC_EDGE_L_VALUE_HEADER 1
99 // value of L field for key index
101 #define SC_EDGE_L_VALUE_KEY_ID 1
103 // value of L field for key type
105 #define SC_EDGE_L_VALUE_KEY_TYPE 1
107 // value of L field for key size
109 #define SC_EDGE_L_VALUE_KEY_SIZE 2
112 // Possible values for key type
117 #define SC_EDGE_RSA_EXCHANGE 0x01
121 #define SC_EDGE_RSA_SIGNATURE 0x02
125 #define SC_EDGE_ECDSA_256 0x03
129 #define SC_EDGE_ECDSA_384 0x04
133 #define SC_EDGE_ECDSA_521 0x05
137 #define SC_EDGE_ECDH_256 0x06
141 #define SC_EDGE_ECDH_384 0x07
145 #define SC_EDGE_ECDH_521 0x08
148 // Padding methods GUIDs for signature
151 // RSASSA- PKCS#1-V1.5 padding method, for signature
153 #define EFI_PADDING_RSASSA_PKCS1V1P5_GUID \
155 0x9317ec24, 0x7cb0, 0x4d0e, {0x8b, 0x32, 0x2e, 0xd9, 0x20, 0x9c, 0xd8, 0xaf} \
158 extern EFI_GUID gEfiPaddingRsassaPkcs1V1P5Guid
;
161 // RSASSA-PSS padding method, for signature
163 #define EFI_PADDING_RSASSA_PSS_GUID \
165 0x7b2349e0, 0x522d, 0x4f8e, {0xb9, 0x27, 0x69, 0xd9, 0x7c, 0x9e, 0x79, 0x5f} \
168 extern EFI_GUID gEfiPaddingRsassaPssGuid
;
171 // Padding methods GUIDs for decryption
174 // No padding, for decryption
176 #define EFI_PADDING_NONE_GUID \
178 0x3629ddb1, 0x228c, 0x452e, {0xb6, 0x16, 0x09, 0xed, 0x31, 0x6a, 0x97, 0x00} \
181 extern EFI_GUID gEfiPaddingNoneGuid
;
184 // RSAES-PKCS#1-V1.5 padding, for decryption
186 #define EFI_PADDING_RSAES_PKCS1V1P5_GUID \
188 0xe1c1d0a9, 0x40b1, 0x4632, {0xbd, 0xcc, 0xd9, 0xd6, 0xe5, 0x29, 0x56, 0x31} \
191 extern EFI_GUID gEfiPaddingRsaesPkcs1V1P5Guid
;
194 // RSAES-OAEP padding, for decryption
196 #define EFI_PADDING_RSAES_OAEP_GUID \
198 0xc1e63ac4, 0xd0cf, 0x4ce6, {0x83, 0x5b, 0xee, 0xd0, 0xe6, 0xa8, 0xa4, 0x5b} \
201 extern EFI_GUID gEfiPaddingRsaesOaepGuid
;
204 This function retrieves the context driver.
206 The GetContextfunction returns the context of the protocol, the application
207 identifiers supported by the protocol and the number and the CSN unique identifier
208 of Smart Cards that are present and supported by protocol.
210 If AidTableSize, AidTable, CsnTableSize, CsnTable or VersionProtocol is NULL,
211 the function does not fail but does not fill in such variables.
213 In case AidTableSize indicates a buffer too small to hold all the protocol AID table,
214 only the first AidTableSize items of the table are returned in AidTable.
216 In case CsnTableSize indicates a buffer too small to hold the entire table of
217 Smart Card CSN present, only the first CsnTableSize items of the table are returned
220 VersionScEdgeProtocol returns the version of the EFI_SMART_CARD_EDGE_PROTOCOL this
221 driver uses. For this protocol specification value is SMART_CARD_EDGE_PROTOCOL_VERSION_1.
223 In case of Smart Card removal the internal CSN list is immediately updated, even if
224 a connection is opened with that Smart Card.
226 @param[in] This Indicates a pointer to the calling context.
227 @param[out] NumberAidSupported Number of AIDs this protocol supports.
228 @param[in, out] AidTableSize On input, number of items allocated for the
229 AID table. On output, number of items returned
231 @param[out] AidTable Table of the AIDs supported by the protocol.
232 @param[out] NumberSCPresent Number of currently present Smart Cards that
233 are supported by protocol.
234 @param[in, out] CsnTableSize On input, the number of items the buffer CSN
235 table can contain. On output, the number of
236 items returned by the protocol.
237 @param[out] CsnTable Table of the CSN of the Smart Card present and
238 supported by protocol.
239 @param[out] VersionScEdgeProtocol EFI_SMART_CARD_EDGE_PROTOCOL version.
241 @retval EFI_SUCCESS The requested command completed successfully.
242 @retval EFI_INVALID_PARAMETER This is NULL.
243 @retval EFI_INVALID_PARAMETER NumberSCPresent is NULL.
248 (EFIAPI
*EFI_SMART_CARD_EDGE_GET_CONTEXT
) (
249 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
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
260 This function establish a connection with a Smart Card the protocol support.
262 In case of success the SCardHandle can be used.
264 If the ScardCsn is NULL the connection is established with the first Smart Card
265 the protocol finds in its table of Smart Card present and supported. Else it
266 establish context with the Smart Card whose CSN given by ScardCsn.
268 If ScardAid is not NULL the function returns the Smart Card AID the protocol supports.
269 After a successful connect the SCardHandle will remain existing even in case Smart Card
270 removed from Smart Card reader, but all function invoking this SCardHandle will fail.
271 SCardHandle is released only on Disconnect.
273 @param[in] This Indicates a pointer to the calling context.
274 @param[out] SCardHandle Handle on Smart Card connection.
275 @param[in] ScardCsn CSN of the Smart Card the connection has to be
277 @param[out] ScardAid AID of the Smart Card the connection has been
280 @retval EFI_SUCCESS The requested command completed successfully.
281 @retval EFI_INVALID_PARAMETER This is NULL.
282 @retval EFI_INVALID_PARAMETER SCardHandle is NULL.
283 @retval EFI_NO_MEDIA No Smart Card supported by protocol is present,
284 Smart Card with CSN ScardCsn or Reader has been
285 removed. A Disconnect should be performed.
290 (EFIAPI
*EFI_SMART_CARD_EDGE_CONNECT
) (
291 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
292 OUT EFI_HANDLE
*SCardHandle
,
293 IN UINT8
*ScardCsn OPTIONAL
,
294 OUT UINT8
*ScardAid OPTIONAL
298 This function releases a connection previously established by Connect.
300 The Disconnect function releases the connection previously established by
301 a Connect. In case the Smart Card or the Smart Card reader has been removed
302 before this call, this function returns EFI_SUCCESS.
304 @param[in] This Indicates a pointer to the calling context.
305 @param[in] SCardHandle Handle on Smart Card connection to release.
307 @retval EFI_SUCCESS The requested command completed successfully.
308 @retval EFI_INVALID_PARAMETER This is NULL.
309 @retval EFI_INVALID_PARAMETER No connection for SCardHandle value.
314 (EFIAPI
*EFI_SMART_CARD_EDGE_DISCONNECT
) (
315 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
316 IN EFI_HANDLE SCardHandle
320 This function returns the Smart Card serial number.
322 @param[in] This Indicates a pointer to the calling context.
323 @param[in] SCardHandle Handle on Smart Card connection.
324 @param[out] Csn The Card Serial number, 16 bytes array.
326 @retval EFI_SUCCESS The requested command completed successfully.
327 @retval EFI_INVALID_PARAMETER This is NULL.
328 @retval EFI_INVALID_PARAMETER No connection for SCardHandle value.
329 @retval EFI_NO_MEDIA Smart Card or Reader of SCardHandle connection
330 has been removed. A Disconnect should be performed.
335 (EFIAPI
*EFI_SMART_CARD_EDGE_GET_CSN
) (
336 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
337 IN EFI_HANDLE SCardHandle
,
338 OUT UINT8 Csn
[SCARD_CSN_SIZE
]
342 This function returns the name of the Smart Card reader used for this connection.
344 @param[in] This Indicates a pointer to the calling context.
345 @param[in] SCardHandle Handle on Smart Card connection.
346 @param[in, out] ReaderNameLength On input, a pointer to the variable that holds
347 the maximal size, in bytes, of ReaderName.
348 On output, the required size, in bytes, for ReaderName.
349 @param[out] ReaderName A pointer to a NULL terminated string that will
350 contain the reader name.
352 @retval EFI_SUCCESS The requested command completed successfully.
353 @retval EFI_INVALID_PARAMETER This is NULL.
354 @retval EFI_INVALID_PARAMETER No connection for SCardHandle value.
355 @retval EFI_INVALID_PARAMETER ReaderNameLength is NULL.
356 @retval EFI_NO_MEDIA Smart Card or Reader of SCardHandle connection
357 has been removed. A Disconnect should be performed.
362 (EFIAPI
*EFI_SMART_CARD_EDGE_GET_READER_NAME
) (
363 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
364 IN EFI_HANDLE SCardHandle
,
365 IN OUT UINTN
*ReaderNameLength
,
366 OUT CHAR16
*ReaderName OPTIONAL
370 This function authenticates a Smart Card user by presenting a PIN code.
372 The VerifyPinfunction presents a PIN code to the Smart Card.
374 If Smart Card found the PIN code correct the user is considered authenticated
375 to current application, and the function returns TRUE.
377 Negative or null PinSize value rejected if PinCodeis not NULL.
379 A NULL PinCodebuffer means the application didn't know the PIN, in that case:
380 - If PinSize value is negative the caller only wants to know if the current
381 chain of the elements Smart Card Edge protocol, Smart Card Reader protocol
382 and Smart Card Reader supports the Secure Pin Entry PCSC V2 functionality.
383 - If PinSize value is positive or null the caller ask to perform the verify
384 PIN using the Secure PIN Entry functionality.
386 In PinCode buffer, the PIN value is always given in plaintext, in case of secure
387 messaging the SMART_CARD_EDGE_PROTOCOL will be in charge of all intermediate
388 treatments to build the correct Smart Card APDU.
390 @param[in] This Indicates a pointer to the calling context.
391 @param[in] SCardHandle Handle on Smart Card connection.
392 @param[in] PinSize PIN code buffer size.
393 @param[in] PinCode PIN code to present to the Smart Card.
394 @param[out] PinResult Result of PIN code presentation to the Smart Card.
395 TRUE when Smard Card founds the PIN code correct.
396 @param[out] RemainingAttempts Number of attempts still possible.
398 @retval EFI_SUCCESS The requested command completed successfully.
399 @retval EFI_UNSUPPORTED Pinsize < 0 and Secure PIN Entry functionality not
401 @retval EFI_INVALID_PARAMETER This is NULL.
402 @retval EFI_INVALID_PARAMETER No connection for SCardHandle value.
403 @retval EFI_INVALID_PARAMETER Bad value for PinSize: value not supported by Smart
404 Card or, negative with PinCode not null.
405 @retval EFI_INVALID_PARAMETER PinResult is NULL.
406 @retval EFI_NO_MEDIA Smart Card or Reader of SCardHandle connection
407 has been removed. A Disconnect should be performed.
412 (EFIAPI
*EFI_SMART_CARD_EDGE_VERIFY_PIN
) (
413 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
414 IN EFI_HANDLE SCardHandle
,
417 OUT BOOLEAN
*PinResult
,
418 OUT UINT32
*RemainingAttempts OPTIONAL
422 This function gives the remaining number of attempts for PIN code presentation.
424 The number of attempts to present a correct PIN is limited and depends on Smart
427 This function will retrieve the number of remaining possible attempts.
429 @param[in] This Indicates a pointer to the calling context.
430 @param[in] SCardHandle Handle on Smart Card connection.
431 @param[out] RemainingAttempts Number of attempts still possible.
433 @retval EFI_SUCCESS The requested command completed successfully.
434 @retval EFI_INVALID_PARAMETER This is NULL.
435 @retval EFI_INVALID_PARAMETER No connection for SCardHandle value.
436 @retval EFI_INVALID_PARAMETER RemainingAttempts is NULL.
437 @retval EFI_NO_MEDIA Smart Card or Reader of SCardHandle connection
438 has been removed. A Disconnect should be performed.
443 (EFIAPI
*EFI_SMART_CARD_EDGE_GET_PIN_REMAINING
) (
444 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
445 IN EFI_HANDLE SCardHandle
,
446 OUT UINT32
*RemainingAttempts
450 This function returns a specific data from Smart Card.
452 The function is generic for any kind of data, but driver and application must
453 share an EFI_GUID that identify the data.
455 @param[in] This Indicates a pointer to the calling context.
456 @param[in] SCardHandle Handle on Smart Card connection.
457 @param[in] DataId The type identifier of the data to get.
458 @param[in, out] DataSize On input, in bytes, the size of Data. On output,
459 in bytes, the size of buffer required to store
461 @param[out] Data The data buffer in which the data is returned.
462 The type of the data buffer is associated with
463 the DataId. Ignored if *DataSize is 0.
465 @retval EFI_SUCCESS The requested command completed successfully.
466 @retval EFI_INVALID_PARAMETER This is NULL.
467 @retval EFI_INVALID_PARAMETER No connection for SCardHandle value.
468 @retval EFI_INVALID_PARAMETER DataId is NULL.
469 @retval EFI_INVALID_PARAMETER DataSize is NULL.
470 @retval EFI_INVALID_PARAMETER Data is NULL, and *DataSize is not zero.
471 @retval EFI_NOT_FOUND DataId unknown for this driver.
472 @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified
473 data and the required size is returned in DataSize.
474 @retval EFI_ACCESS_DENIED Operation not performed, conditions not fulfilled.
476 @retval EFI_NO_MEDIA Smart Card or Reader of SCardHandle connection
477 has been removed. A Disconnect should be performed.
482 (EFIAPI
*EFI_SMART_CARD_EDGE_GET_DATA
) (
483 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
484 IN EFI_HANDLE SCardHandle
,
486 IN OUT UINTN
*DataSize
,
487 OUT VOID
*Data OPTIONAL
491 This function retrieve credentials store into the Smart Card.
493 The function returns a series of items in TLV (Tag Length Value) format.
495 First TLV item is the header item that gives the number of following
496 containers (0x00, 0x01, Nb containers).
498 All these containers are a series of 4 TLV items:
499 - The certificate item (0x01, certificate size, certificate)
500 - The Key identifier item (0x02, 0x01, key index)
501 - The key type item (0x03, 0x01, key type)
502 - The key size item (0x04, 0x02, key size), key size in number of bits.
503 Numeric multi-bytes values are on big endian format, most significant byte first:
504 - The L field value for certificate (2 bytes)
505 - The L field value for key size (2 bytes)
506 - The value field for key size (2 bytes)
508 @param[in] This Indicates a pointer to the calling context.
509 @param[in] SCardHandle Handle on Smart Card connection.
510 @param[in, out] CredentialSize On input, in bytes, the size of buffer to store
511 the list of credential.
512 On output, in bytes, the size of buffer required
513 to store the entire list of credentials.
515 @param[out] CredentialList List of credentials stored into the Smart Card.
516 A list of TLV (Tag Length Value) elements organized
519 @retval EFI_SUCCESS The requested command completed successfully.
520 @retval EFI_INVALID_PARAMETER This is NULL.
521 @retval EFI_INVALID_PARAMETER No connection for SCardHandle value.
522 @retval EFI_INVALID_PARAMETER CredentialSize is NULL.
523 @retval EFI_INVALID_PARAMETER CredentialList is NULL, if CredentialSize is not zero.
524 @retval EFI_BUFFER_TOO_SMALL The size of CredentialList is too small for the
525 specified data and the required size is returned in
527 @retval EFI_NO_MEDIA Smart Card or Reader of SCardHandle connection
528 has been removed. A Disconnect should be performed.
533 (EFIAPI
*EFI_SMART_CARD_EDGE_GET_CREDENTIAL
) (
534 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
535 IN EFI_HANDLE SCardHandle
,
536 IN OUT UINTN
*CredentialSize
,
537 OUT UINT8
*CredentialList OPTIONAL
541 This function signs an already hashed data with a Smart Card private key.
543 This function signs data, actually it is the hash of these data that is given
546 SignatureData buffer shall be big enough for signature. Signature size is
547 function key size and key type.
549 @param[in] This Indicates a pointer to the calling context.
550 @param[in] SCardHandle Handle on Smart Card connection.
551 @param[in] KeyId Identifier of the key container, retrieved
552 in a key index item of credentials.
553 @param[in] KeyType The key type, retrieved in a key type item of
556 @param[in] HashAlgorithm Hash algorithm used to hash the, one of:
557 - EFI_HASH_ALGORITHM_SHA1_GUID
558 - EFI_HASH_ALGORITHM_SHA256_GUID
559 - EFI_HASH_ALGORITHM_SHA384_GUID
560 - EFI_HASH_ALGORITHM_SHA512_GUID
561 @param[in] PaddingMethod Padding method used jointly with hash algorithm,
563 - EFI_PADDING_RSASSA_PKCS1V1P5_GUID
564 - EFI_PADDING_RSASSA_PSS_GUID
565 @param[in] HashedData Hash of the data to sign. Size is function of the
568 @param[out] SignatureData Resulting signature with private key KeyId. Size
569 is function of the KeyType and key size retrieved
570 in the associated key size item of credentials.
572 @retval EFI_SUCCESS The requested command completed successfully.
573 @retval EFI_INVALID_PARAMETER This is NULL.
574 @retval EFI_INVALID_PARAMETER No connection for SCardHandle value.
575 @retval EFI_INVALID_PARAMETER KeyId is not valid.
576 @retval EFI_INVALID_PARAMETER KeyType is not valid or not corresponding to KeyId.
577 @retval EFI_INVALID_PARAMETER HashAlgorithm is NULL.
578 @retval EFI_INVALID_PARAMETER HashAlgorithm is not valid.
579 @retval EFI_INVALID_PARAMETER PaddingMethod is NULL.
580 @retval EFI_INVALID_PARAMETER PaddingMethod is not valid.
581 @retval EFI_INVALID_PARAMETER HashedData is NULL.
582 @retval EFI_INVALID_PARAMETER SignatureData is NULL.
583 @retval EFI_ACCESS_DENIED Operation not performed, conditions not fulfilled.
585 @retval EFI_NO_MEDIA Smart Card or Reader of SCardHandle connection
586 has been removed. A Disconnect should be performed.
591 (EFIAPI
*EFI_SMART_CARD_EDGE_SIGN_DATA
) (
592 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
593 IN EFI_HANDLE SCardHandle
,
596 IN EFI_GUID
*HashAlgorithm
,
597 IN EFI_GUID
*PaddingMethod
,
598 IN UINT8
*HashedData
,
599 OUT UINT8
*SignatureData
603 This function decrypts data with a PKI/RSA Smart Card private key.
605 The function decrypts some PKI/RSA encrypted data with private key securely
606 stored into the Smart Card.
608 The KeyId must reference a key of type SC_EDGE_RSA_EXCHANGE.
610 @param[in] This Indicates a pointer to the calling context.
611 @param[in] SCardHandle Handle on Smart Card connection.
612 @param[in] KeyId Identifier of the key container, retrieved
613 in a key index item of credentials.
614 @param[in] HashAlgorithm Hash algorithm used to hash the, one of:
615 - EFI_HASH_ALGORITHM_SHA1_GUID
616 - EFI_HASH_ALGORITHM_SHA256_GUID
617 - EFI_HASH_ALGORITHM_SHA384_GUID
618 - EFI_HASH_ALGORITHM_SHA512_GUID
619 @param[in] PaddingMethod Padding method used jointly with hash algorithm,
621 - EFI_PADDING_NONE_GUID
622 - EFI_PADDING_RSAES_PKCS1V1P5_GUID
623 - EFI_PADDING_RSAES_OAEP_GUID
624 @param[in] EncryptedSize Size of data to decrypt.
625 @param[in] EncryptedData Data to decrypt
626 @param[in, out] PlaintextSize On input, in bytes, the size of buffer to store
628 On output, in bytes, the size of buffer required
629 to store the decrypted data.
630 @param[out] PlaintextData Buffer for decrypted data, padding removed.
632 @retval EFI_SUCCESS The requested command completed successfully.
633 @retval EFI_INVALID_PARAMETER This is NULL.
634 @retval EFI_INVALID_PARAMETER No connection for SCardHandle value.
635 @retval EFI_INVALID_PARAMETER KeyId is not valid or associated key not of type
636 SC_EDGE_RSA_EXCHANGE.
637 @retval EFI_INVALID_PARAMETER HashAlgorithm is NULL.
638 @retval EFI_INVALID_PARAMETER HashAlgorithm is not valid.
639 @retval EFI_INVALID_PARAMETER PaddingMethod is NULL.
640 @retval EFI_INVALID_PARAMETER PaddingMethod is not valid.
641 @retval EFI_INVALID_PARAMETER EncryptedSize is 0.
642 @retval EFI_INVALID_PARAMETER EncryptedData is NULL.
643 @retval EFI_INVALID_PARAMETER PlaintextSize is NULL.
644 @retval EFI_INVALID_PARAMETER PlaintextData is NULL.
645 @retval EFI_ACCESS_DENIED Operation not performed, conditions not fulfilled.
647 @retval EFI_BUFFER_TOO_SMALL PlaintextSize is too small for the plaintext data
648 and the required size is returned in PlaintextSize.
649 @retval EFI_NO_MEDIA Smart Card or Reader of SCardHandle connection
650 has been removed. A Disconnect should be performed.
655 (EFIAPI
*EFI_SMART_CARD_EDGE_DECRYPT_DATA
) (
656 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
657 IN EFI_HANDLE SCardHandle
,
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
668 This function performs a secret Diffie Hellman agreement calculation that would
669 be used to derive a symmetric encryption / decryption key.
671 The function compute a DH agreement that should be diversified togenerate a symmetric
672 key to proceed encryption or decryption.
674 The application and the Smart Card shall agree on the diversification process.
676 The KeyId must reference a key of one of the types: SC_EDGE_ECDH_256, SC_EDGE_ECDH_384
679 @param[in] This Indicates a pointer to the calling context.
680 @param[in] SCardHandle Handle on Smart Card connection.
681 @param[in] KeyId Identifier of the key container, retrieved
682 in a key index item of credentials.
683 @param[in] dataQx Public key x coordinate. Size is the same as
684 key size for KeyId. Stored in big endian format.
685 @param[in] dataQy Public key y coordinate. Size is the same as
686 key size for KeyId. Stored in big endian format.
687 @param[out] DHAgreement Buffer for DH agreement computed. Size must be
688 bigger or equal to key size for KeyId.
690 @retval EFI_SUCCESS The requested command completed successfully.
691 @retval EFI_INVALID_PARAMETER This is NULL.
692 @retval EFI_INVALID_PARAMETER No connection for SCardHandle value.
693 @retval EFI_INVALID_PARAMETER KeyId is not valid.
694 @retval EFI_INVALID_PARAMETER dataQx is NULL.
695 @retval EFI_INVALID_PARAMETER dataQy is NULL.
696 @retval EFI_INVALID_PARAMETER DHAgreement is NULL.
697 @retval EFI_ACCESS_DENIED Operation not performed, conditions not fulfilled.
699 @retval EFI_NO_MEDIA Smart Card or Reader of SCardHandle connection
700 has been removed. A Disconnect should be performed.
705 (EFIAPI
*EFI_SMART_CARD_EDGE_BUILD_DH_AGREEMENT
) (
706 IN EFI_SMART_CARD_EDGE_PROTOCOL
*This
,
707 IN EFI_HANDLE SCardHandle
,
711 OUT UINT8
*DHAgreement
715 /// Smart card aware application invokes this protocol to get access to an inserted
716 /// smart card in the reader or to the reader itself.
718 struct _EFI_SMART_CARD_EDGE_PROTOCOL
{
719 EFI_SMART_CARD_EDGE_GET_CONTEXT GetContext
;
720 EFI_SMART_CARD_EDGE_CONNECT Connect
;
721 EFI_SMART_CARD_EDGE_DISCONNECT Disconnect
;
722 EFI_SMART_CARD_EDGE_GET_CSN GetCsn
;
723 EFI_SMART_CARD_EDGE_GET_READER_NAME GetReaderName
;
724 EFI_SMART_CARD_EDGE_VERIFY_PIN VerifyPin
;
725 EFI_SMART_CARD_EDGE_GET_PIN_REMAINING GetPinRemaining
;
726 EFI_SMART_CARD_EDGE_GET_DATA GetData
;
727 EFI_SMART_CARD_EDGE_GET_CREDENTIAL GetCredential
;
728 EFI_SMART_CARD_EDGE_SIGN_DATA SignData
;
729 EFI_SMART_CARD_EDGE_DECRYPT_DATA DecryptData
;
730 EFI_SMART_CARD_EDGE_BUILD_DH_AGREEMENT BuildDHAgreement
;
733 extern EFI_GUID gEfiSmartCardEdgeProtocolGuid
;