MdePkg/Include/Protocol/SmartCardReader.h File Reference


Data Structures

struct  _EFI_SMART_CARD_READER_PROTOCOL

Defines

#define EFI_SMART_CARD_READER_PROTOCOL_GUID
#define SCARD_AM_READER   0x0001
#define SCARD_AM_CARD   0x0002
#define SCARD_CA_NORESET   0x0000
#define SCARD_CA_COLDRESET   0x0001
#define SCARD_CA_WARMRESET   0x0002
#define SCARD_CA_UNPOWER   0x0003
#define SCARD_CA_EJECT   0x0004
#define SCARD_PROTOCOL_UNDEFINED   0x0000
#define SCARD_PROTOCOL_T0   0x0001
#define SCARD_PROTOCOL_T1   0x0002
#define SCARD_PROTOCOL_RAW   0x0004
#define SCARD_UNKNOWN   0x0000
#define SCARD_ABSENT   0x0001
#define SCARD_INACTIVE   0x0002
#define SCARD_ACTIVE   0x0003
#define SCARD_CTL_CODE(code)   (0x42000000 + (code))
#define CM_IOCTL_GET_FEATURE_REQUEST   SCARD_CTL_CODE(3400)

Typedefs

typedef struct
_EFI_SMART_CARD_READER_PROTOCOL 
EFI_SMART_CARD_READER_PROTOCOL
typedef IN UINT32 AccessMode
typedef IN UINT32 IN UINT32 CardAction
typedef IN UINT32 IN UINT32 IN
UINT32 
PreferredProtocols
typedef IN UINT32 IN UINT32 IN
UINT32 OUT UINT32
ActiveProtocol
typedef OUT CHAR16ReaderName
typedef OUT CHAR16 IN OUT UINTN * ReaderNameLength
typedef OUT CHAR16 IN OUT
UINTN OUT UINT32
State
typedef OUT CHAR16 IN OUT
UINTN OUT UINT32 OUT UINT32
CardProtocol
typedef OUT CHAR16 IN OUT
UINTN OUT UINT32 OUT UINT32
OUT UINT8
Atr
typedef OUT CHAR16 IN OUT
UINTN OUT UINT32 OUT UINT32
OUT UINT8 IN OUT UINTN * 
AtrLength
typedef IN UINT8CAPDU
typedef IN UINT8 IN UINTN CAPDULength
typedef IN UINT8 IN UINTN OUT
UINT8
RAPDU
typedef IN UINT8 IN UINTN OUT
UINT8 IN OUT UINTN * 
RAPDULength
typedef IN UINT32 ControlCode
typedef IN UINT32 IN UINT8InBuffer
typedef IN UINT32 IN UINT8 IN UINTN InBufferLength
typedef IN UINT32 IN UINT8 IN
UINTN OUT UINT8
OutBuffer
typedef IN UINT32 IN UINT8 IN
UINTN OUT UINT8 IN OUT UINTN * 
OutBufferLength
typedef IN UINT32 Attrib

Functions

typedef EFI_STATUS (EFIAPI *EFI_SMART_CARD_READER_CONNECT)(IN EFI_SMART_CARD_READER_PROTOCOL *This

Variables

EFI_GUID gEfiSmartCardReaderProtocolGuid

Detailed Description

The UEFI Smart Card Reader Protocol provides an abstraction for device to provide smart card reader support. This protocol is very close to Part 5 of PC/SC workgroup specifications and provides an API to applications willing to communicate with a smart card or a smart card reader.

Copyright (c) 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Define Documentation

#define CM_IOCTL_GET_FEATURE_REQUEST   SCARD_CTL_CODE(3400)

#define EFI_SMART_CARD_READER_PROTOCOL_GUID

Value:

{ \
      0x2a4d1adf, 0x21dc, 0x4b81, {0xa4, 0x2f, 0x8b, 0x8e, 0xe2, 0x38, 0x00, 0x60} \
    }

#define SCARD_ABSENT   0x0001

#define SCARD_ACTIVE   0x0003

#define SCARD_AM_CARD   0x0002

#define SCARD_AM_READER   0x0001

#define SCARD_CA_COLDRESET   0x0001

#define SCARD_CA_EJECT   0x0004

#define SCARD_CA_NORESET   0x0000

#define SCARD_CA_UNPOWER   0x0003

#define SCARD_CA_WARMRESET   0x0002

#define SCARD_CTL_CODE ( code   )     (0x42000000 + (code))

#define SCARD_INACTIVE   0x0002

#define SCARD_PROTOCOL_RAW   0x0004

#define SCARD_PROTOCOL_T0   0x0001

#define SCARD_PROTOCOL_T1   0x0002

#define SCARD_PROTOCOL_UNDEFINED   0x0000

#define SCARD_UNKNOWN   0x0000


Typedef Documentation

typedef IN UINT32 AccessMode

typedef IN UINT32 IN UINT32 IN UINT32 OUT UINT32* ActiveProtocol

typedef OUT CHAR16 IN OUT UINTN OUT UINT32 OUT UINT32 OUT UINT8* Atr

typedef OUT CHAR16 IN OUT UINTN OUT UINT32 OUT UINT32 OUT UINT8 IN OUT UINTN* AtrLength

typedef IN UINT32 Attrib

typedef IN UINT8* CAPDU

typedef IN UINT8 IN UINTN CAPDULength

typedef IN UINT32 CardAction

typedef OUT CHAR16 IN OUT UINTN OUT UINT32 OUT UINT32* CardProtocol

typedef IN UINT32 ControlCode

typedef IN UINT32 IN UINT8* InBuffer

typedef IN UINT32 IN UINT8 IN UINTN InBufferLength

typedef IN UINT32 OUT UINT8 * OutBuffer

typedef IN UINT32 OUT UINT8 IN OUT UINTN * OutBufferLength

typedef IN UINT8 IN UINTN OUT UINT8* RAPDU

typedef IN UINT8 IN UINTN OUT UINT8 IN OUT UINTN* RAPDULength

typedef OUT CHAR16* ReaderName

typedef OUT CHAR16 IN OUT UINTN* ReaderNameLength


Function Documentation

typedef EFI_STATUS ( EFIAPI EFI_SMART_CARD_READER_GET_ATTRIB  ) 

This function requests connection to the smart card or the reader, using the appropriate reset type and protocol.

The SCardConnectfunction requests access to the smart card or the reader. Upon success, it is then possible to call SCardTransmit.

If AccessMode is set to SCARD_AM_READER, PreferredProtocols must be set to SCARD_PROTOCOL_UNDEFINED and CardAction to SCARD_CA_NORESET else function fails with EFI_INVALID_PARAMETER.

Parameters:
[in] This Indicates a pointer to the calling context.
[in] AccessMode Codes of access mode.
[in] CardAction SCARD_CA_NORESET, SCARD_CA_COLDRESET or SCARD_CA_WARMRESET.
[in] PreferredProtocols Bitmask of acceptable protocols.
[out] ActiveProtocol A flag that indicates the active protocol.
Return values:
EFI_SUCCESS The requested command completed successfully.
EFI_INVALID_PARAMETER This is NULL
EFI_INVALID_PARAMETER AccessMode is not valid.
EFI_INVALID_PARAMETER CardAction is not valid.
EFI_INVALID_PARAMETER Invalid combination of AccessMode/CardAction/ PreferredProtocols.
EFI_NOT_READY A smart card is inserted but failed to return an ATR.
EFI_UNSUPPORTED PreferredProtocols does not contain an available protocol to use.
EFI_NO_MEDIA AccessMode is set to SCARD_AM_CARD but there is no smart card inserted.
EFI_ACCESS_DENIED Access is already locked by a previous SCardConnectcall.
EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
This function releases a connection previously taken by SCardConnect.

The SCardDisconnect function releases the lock previously taken by SCardConnect. In case the smart card has been removed before this call, thisfunction returns EFI_SUCCESS. If there is no previous call to SCardConnect, this function returns EFI_SUCCESS.

Parameters:
[in] This Indicates a pointer to the calling context.
[in] CardAction Codes for card action.
Return values:
EFI_SUCCESS The requested command completed successfully.
EFI_INVALID_PARAMETER This is NULL
EFI_INVALID_PARAMETER CardAction value is unknown.
EFI_UNSUPPORTED Reader does not support Eject card feature (disconnect was not performed).
EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
This function retrieves some basic information about the smart card and reader.

The SCardStatusfunction retrieves basic reader and card information.

If ReaderName, State, CardProtocolor Atris NULL, the function does not fail but does not fill in such variables.

If EFI_SUCCESS is not returned, ReaderName and Atr contents shall not be considered as valid.

Parameters:
[in] This Indicates a pointer to the calling context.
[out] ReaderName A pointer to a NULL terminated string that will contain the reader name.
[in,out] ReaderNameLength On input, a pointer to the variablethat holds the maximal size, in bytes,of ReaderName. On output, the required size, in bytes, for ReaderName.
[out] State Current state of the smart card reader.
[out] CardProtocol Current protocol used to communicate with the smart card.
[out] Atr A pointer to retrieve the ATR of the smart card.
[in,out] AtrLength On input, a pointer to hold the maximum size, in bytes, of Atr(usually 33). On output, the required size, inbytes, for the smart card ATR.
Return values:
EFI_SUCCESS The requested command completed successfully.
EFI_INVALID_PARAMETER This is NULL
EFI_INVALID_PARAMETER ReaderName is not NULL but ReaderNameLength is NULL
EFI_INVALID_PARAMETER Atr is not NULL but AtrLength is NULL
EFI_BUFFER_TOO_SMALL ReaderNameLength is not big enough to hold the reader name. ReaderNameLength has been updated to the required value.
EFI_BUFFER_TOO_SMALL AtrLength is not big enough to hold the ATR. AtrLength has been updated to the required value.
EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
This function sends a command to the card or reader and returns its response.

The protocol to use to communicate with the smart card has been selected through SCardConnectcall.

In case RAPDULength indicates a buffer too small to holdthe response APDU, the function fails with EFI_BUFFER_TOO_SMALL.

Parameters:
[in] This A pointer to the EFI_USBFN_IO_PROTOCOLinstance.
[in] CAPDU A pointer to a byte array thatcontains the Command APDU to send to the smart card or reader.
[in] CAPDULength Command APDU size, in bytes.
[out] RAPDU A pointer to a byte array that will contain the Response APDU.
[in,out] RAPDULength On input, the maximum size, inbytes, of the Response APDU. On output, the size, in bytes, of the Response APDU.
Return values:
EFI_SUCCESS The requested command completed successfully.
EFI_INVALID_PARAMETER This is NULL.
EFI_INVALID_PARAMETER CAPDU is NULL or CAPDULength is 0.
EFI_BUFFER_TOO_SMALL RAPDULength is not big enough to hold the response APDU. RAPDULength has been updated to the required value.
EFI_NO_MEDIA There is no card in the reader.
EFI_NOT_READY Card is not powered.
EFI_PROTOCOL_ERROR A protocol error has occurred.
EFI_TIMEOUT The reader did not respond.
EFI_ACCESS_DENIED A communication with the reader/card is already pending.
EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
This function provides direct access to the reader.

This function gives direct control to send commands to the driver or the reader. The ControlCode to use is vendor dependant; the only standard code defined is the one to get PC/SC part 10 features.

InBuffer and Outbuffer may be NULL when ControlCode operation does not require them.

Parameters:
[in] This Indicates a pointer to the calling context.
[in] ControlCode The control code for the operation to perform.
[in] InBuffer A pointer to the input parameters.
[in] InBufferLength Size, in bytes, of input parameters.
[out] OutBuffer A pointer to the output parameters.
[in,out] OutBufferLength On input, maximal size, in bytes, to store output parameters. On output, the size, in bytes, of output parameters.
Return values:
EFI_SUCCESS The requested command completed successfully.
EFI_INVALID_PARAMETER This is NULL.
EFI_INVALID_PARAMETER ControlCode requires input parameters but: InBuffer is NULL or InBufferLenth is NULL or InBuffer is not NULL but InBufferLenth is less than expected.
EFI_INVALID_PARAMETER OutBuffer is not NULL but OutBufferLength is NULL.
EFI_UNSUPPORTED ControlCode is not supported.
EFI_BUFFER_TOO_SMALL OutBufferLength is not big enough to hold the output parameters. OutBufferLength has been updated to the required value.
EFI_NO_MEDIA There is no card in the reader and the control code specified requires one.
EFI_NOT_READY ControlCode requires a powered card to operate.
EFI_PROTOCOL_ERROR A protocol error has occurred.
EFI_TIMEOUT The reader did not respond.
EFI_ACCESS_DENIED A communication with the reader/card is already pending.
EFI_DEVICE_ERROR Any other error condition, typically a reader removal.
This function retrieves a reader or smart card attribute.

Possibly supported attrib values are listed in "PC/SC specification, Part 3: Requirements for PC-Connected Interface Devices".

Parameters:
[in] This Indicates a pointer to the calling context.
[in] Attrib Identifier for the attribute to retrieve.
[out] OutBuffer A pointer to a buffer that will contain attribute data.
[in,out] OutBufferLength On input, maximal size, in bytes, to store attribute data. On output, the size, in bytes, of attribute data.
Return values:
EFI_SUCCESS The requested command completed successfully.
EFI_INVALID_PARAMETER This is NULL.
EFI_INVALID_PARAMETER OutBuffer is NULL or OutBufferLength is 0.
EFI_BUFFER_TOO_SMALL OutBufferLength is not big enough to hold the output parameters. OutBufferLength has been updated to the required value.
EFI_UNSUPPORTED Attribis not supported
EFI_NO_MEDIA There is no card in the reader and Attrib value requires one.
EFI_NOT_READY Attrib requires a powered card to operate.
EFI_PROTOCOL_ERROR A protocol error has occurred.
EFI_TIMEOUT The reader did not respond.
EFI_DEVICE_ERROR Any other error condition, typically a reader removal.


Variable Documentation


Generated on Thu Sep 24 23:14:20 2015 for MdePkg[ALL] by  doxygen 1.5.7.1