These Components implement the MIFARE DESFire EVx ISO/IEC 7816-4 Basic commands. More...

Functions | |
| phStatus_t | phalMfdfEVx_IsoSelectFile (void *pDataParams, uint8_t bOption, uint8_t bSelector, uint8_t *pFid, uint8_t *pDFname, uint8_t bDFnameLen, uint8_t bExtendedLenApdu, uint8_t **ppFCI, uint16_t *pwFCILen) |
| ISO Select. More... | |
| phStatus_t | phalMfdfEVx_IsoReadBinary (void *pDataParams, uint16_t wOption, uint8_t bOffset, uint8_t bSfid, uint32_t dwBytesToRead, uint8_t bExtendedLenApdu, uint8_t **ppRxBuffer, uint32_t *pBytesRead) |
| ISO Read Binary. More... | |
| phStatus_t | phalMfdfEVx_IsoUpdateBinary (void *pDataParams, uint8_t bOffset, uint8_t bSfid, uint8_t bExtendedLenApdu, uint8_t *pData, uint32_t dwDataLen) |
| ISO Update Binary. More... | |
| phStatus_t | phalMfdfEVx_IsoReadRecords (void *pDataParams, uint16_t wOption, uint8_t bRecNo, uint8_t bReadAllFromP1, uint8_t bSfid, uint32_t dwBytesToRead, uint8_t bExtendedLenApdu, uint8_t **ppRxBuffer, uint32_t *pBytesRead) |
| ISO Read Records. More... | |
| phStatus_t | phalMfdfEVx_IsoAppendRecord (void *pDataParams, uint8_t bSfid, uint8_t *pData, uint32_t dwDataLen, uint8_t bExtendedLenApdu) |
| ISO Append record. More... | |
| phStatus_t | phalMfdfEVx_IsoUpdateRecord (void *pDataParams, uint8_t bIns, uint8_t bRecNo, uint8_t bSfid, uint8_t bRefCtrl, uint8_t *pData, uint8_t bDataLen) |
| ISO Update record. More... | |
| phStatus_t | phalMfdfEVx_IsoGetChallenge (void *pDataParams, uint16_t wKeyNo, uint16_t wKeyVer, uint8_t bExtendedLenApdu, uint32_t dwLe, uint8_t *pRPICC1) |
| ISOGetChallenge. More... | |
| phStatus_t | phalMfdfEVx_IsoExternalAuthenticate (void *pDataParams, uint8_t *pInput, uint8_t bInputLen, uint8_t bExtendedLenApdu, uint8_t *pDataOut, uint8_t *pOutLen) |
| ISO External Authenticate. More... | |
| phStatus_t | phalMfdfEVx_IsoInternalAuthenticate (void *pDataParams, uint8_t *pInput, uint8_t bInputLen, uint8_t bExtendedLenApdu, uint8_t *pDataOut, uint8_t *pOutLen) |
| ISO Internal Authenticate. More... | |
| phStatus_t | phalMfdfEVx_IsoAuthenticate (void *pDataParams, uint16_t wKeyNo, uint16_t wKeyVer, uint8_t bKeyNoCard, uint8_t bIsPICCkey) |
| Perform ISO authentication GetChallenge, External Authenticate & Internal Authenticate of a DESFire PICC. More... | |
Options for ISOSelectFile command. | |
| #define | PHAL_MFDFEVX_FCI_RETURNED 0x00U |
| Option to indicate the return of FCI. | |
| #define | PHAL_MFDFEVX_FCI_NOT_RETURNED 0x0CU |
| Option to indicate the no return of FCI. | |
| #define | PHAL_MFDFEVX_SELECTOR_0 0x00U |
| Option to indicate Selection by 2 byte file Id. | |
| #define | PHAL_MFDFEVX_SELECTOR_1 0x01U |
| Option to indicate Selection by child DF. | |
| #define | PHAL_MFDFEVX_SELECTOR_2 0x02U |
| Option to indicate Select EF under current DF. More... | |
| #define | PHAL_MFDFEVX_SELECTOR_3 0x03U |
| Option to indicate Select parent DF of the current DF. | |
| #define | PHAL_MFDFEVX_SELECTOR_4 0x04U |
| Option to indicate Selection by DF Name. More... | |
These Components implement the MIFARE DESFire EVx ISO/IEC 7816-4 Basic commands.
| #define PHAL_MFDFEVX_SELECTOR_2 0x02U |
Option to indicate Select EF under current DF.
FID = EF id.
| #define PHAL_MFDFEVX_SELECTOR_4 0x04U |
Option to indicate Selection by DF Name.
DFName and len is then valid.
| phStatus_t phalMfdfEVx_IsoSelectFile | ( | void * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t | bSelector, | ||
| uint8_t * | pFid, | ||
| uint8_t * | pDFname, | ||
| uint8_t | bDFnameLen, | ||
| uint8_t | bExtendedLenApdu, | ||
| uint8_t ** | ppFCI, | ||
| uint16_t * | pwFCILen | ||
| ) |
ISO Select.
This command is implemented in compliance with ISO/IEC 7816-4.
| PH_ERR_SUCCESS | Operation successful. |
| Other | Depending on implementation and underlying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOption | [In] Option for return / no return of FCI. |
| [in] | bSelector | [In] The selector to be used. |
| [in] | pFid | [In] The ISO File number to be selected. |
| [in] | pDFname | [In] The ISO DFName to be selected. Valid only when bOption = 0x04. |
| [in] | bDFnameLen | [In] Length of bytes available in DFname buffer. |
| [in] | bExtendedLenApdu | [In] Flag for Extended Length APDU. |
| [out] | ppFCI | [Out] The FCI information returned by the PICC. |
| [out] | pwFCILen | [Out] Length of bytes available in FCI buffer. |
| phStatus_t phalMfdfEVx_IsoReadBinary | ( | void * | pDataParams, |
| uint16_t | wOption, | ||
| uint8_t | bOffset, | ||
| uint8_t | bSfid, | ||
| uint32_t | dwBytesToRead, | ||
| uint8_t | bExtendedLenApdu, | ||
| uint8_t ** | ppRxBuffer, | ||
| uint32_t * | pBytesRead | ||
| ) |
ISO Read Binary.
This command is implemented in compliance with ISO/IEC 7816-4.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_SUCCESS_CHAINING | operation success with chaining. |
| Other | Depending on implementation and underlying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | wOption | [In] One of the below options.
|
| [in] | bOffset | [In] The offset from where the data should be read. |
| [in] | bSfid | [In] Short ISO File Id. Bit 7 should be 1 to indicate SFID is supplied. Else it is treated as MSB of 2Byte offset. |
| [in] | dwBytesToRead | [In] Number of bytes to read. If 0, then entire file to be read. |
| [in] | bExtendedLenApdu | [In] Flag for Extended Length APDU. |
| [out] | ppRxBuffer | [Out] The data returned by the PICC. |
| [out] | pBytesRead | [Out] Length of bytes available in RxData buffer. |
| phStatus_t phalMfdfEVx_IsoUpdateBinary | ( | void * | pDataParams, |
| uint8_t | bOffset, | ||
| uint8_t | bSfid, | ||
| uint8_t | bExtendedLenApdu, | ||
| uint8_t * | pData, | ||
| uint32_t | dwDataLen | ||
| ) |
ISO Update Binary.
This command is implemented in compliance with ISO/IEC 7816-4.
| PH_ERR_SUCCESS | Operation successful. |
| Other | Depending on implementation and underlying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOffset | [In] The offset from where the data should be updated. |
| [in] | bSfid | [In] Short ISO File Id. Bit 7 should be 1 to indicate SFID is supplied. Else it is treated as MSB of 2Byte offset. |
| [in] | bExtendedLenApdu | [In] Flag for Extended Length APDU. |
| [in] | pData | [In] Data to be updated. |
| [in] | dwDataLen | [In] Length of bytes available in Data buffer. |
| phStatus_t phalMfdfEVx_IsoReadRecords | ( | void * | pDataParams, |
| uint16_t | wOption, | ||
| uint8_t | bRecNo, | ||
| uint8_t | bReadAllFromP1, | ||
| uint8_t | bSfid, | ||
| uint32_t | dwBytesToRead, | ||
| uint8_t | bExtendedLenApdu, | ||
| uint8_t ** | ppRxBuffer, | ||
| uint32_t * | pBytesRead | ||
| ) |
ISO Read Records.
This command is implemented in compliance with ISO/IEC 7816-4.
| PH_ERR_SUCCESS | Operation successful. |
| Other | Depending on implementation and underlying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | wOption | [In] One of the below options.
|
| [in] | bRecNo | [In] Record to read / from where to read. |
| [in] | bReadAllFromP1 | [In] Whether to read all records from P1 or just one. |
| [in] | bSfid | [In] Short ISO File Id. |
| [in] | dwBytesToRead | [In] Number of bytes to read. |
| [in] | bExtendedLenApdu | [In] Flag for Extended Length APDU. |
| [out] | ppRxBuffer | [Out] The data returned by the PICC. |
| [out] | pBytesRead | [Out] Length of bytes available in RxData buffer. |
| phStatus_t phalMfdfEVx_IsoAppendRecord | ( | void * | pDataParams, |
| uint8_t | bSfid, | ||
| uint8_t * | pData, | ||
| uint32_t | dwDataLen, | ||
| uint8_t | bExtendedLenApdu | ||
| ) |
ISO Append record.
This command is implemented in compliance with ISO/IEC 7816-4.
| PH_ERR_SUCCESS | Operation successful. |
| Other | Depending on implementation and underlying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bSfid | [In] Short ISO File Id. |
| [in] | pData | [In] Data to be appended. |
| [in] | dwDataLen | [In] Length of bytes available in Data buffer. |
| [in] | bExtendedLenApdu | [In] Flag for Extended Length APDU. |
| phStatus_t phalMfdfEVx_IsoUpdateRecord | ( | void * | pDataParams, |
| uint8_t | bIns, | ||
| uint8_t | bRecNo, | ||
| uint8_t | bSfid, | ||
| uint8_t | bRefCtrl, | ||
| uint8_t * | pData, | ||
| uint8_t | bDataLen | ||
| ) |
ISO Update record.
| PH_ERR_SUCCESS | Operation successful. |
| Other | Depending on implementation and underlying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bIns | [In] Either 0xDC or 0xDD. |
| [in] | bRecNo | [In] Record number. 00 indicates current record. |
| [in] | bSfid | [In] Short ISO File Id bits 0..4 only code this value. Either 0 or SFID. |
| [in] | bRefCtrl | [In] Bit 0 to bit 3 code the value based on bIns as defined in ISO 7816-4 Update Record. |
| [in] | pData | [In] Data to write. |
| [in] | bDataLen | [In] number of bytes to write. |
| phStatus_t phalMfdfEVx_IsoGetChallenge | ( | void * | pDataParams, |
| uint16_t | wKeyNo, | ||
| uint16_t | wKeyVer, | ||
| uint8_t | bExtendedLenApdu, | ||
| uint32_t | dwLe, | ||
| uint8_t * | pRPICC1 | ||
| ) |
ISOGetChallenge.
This command is implemented in compliance with ISO/IEC 7816-4. Returns the random number from the PICC. Size depends on the key type referred by wKeyNo and wKeyVer.
| PH_ERR_SUCCESS | Operation successful. |
| Other | Depending on implementation and underlying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | wKeyNo | [In] Key number to be used form KeyStore. |
| [in] | wKeyVer | [In] Key version to be used from key store. |
| [in] | bExtendedLenApdu | [In] Flag for Extended Length APDU. |
| [in] | dwLe | [In] Length of expected challenge RPICC1. |
| [out] | pRPICC1 | [Out] RPICC1 returned from PICC. |
| phStatus_t phalMfdfEVx_IsoExternalAuthenticate | ( | void * | pDataParams, |
| uint8_t * | pInput, | ||
| uint8_t | bInputLen, | ||
| uint8_t | bExtendedLenApdu, | ||
| uint8_t * | pDataOut, | ||
| uint8_t * | pOutLen | ||
| ) |
ISO External Authenticate.
This command is implemented in compliance with ISO/IEC 7816-4.
| PH_ERR_SUCCESS | Operation successful. |
| Other | Depending on implementation and underlying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | pInput | [In] Input data should be as mentioned below. Reference to crypto algorithm - 1 Byte: 00 => context defined, 02 => 2K3DES, 04 => 3k3DES, 09 => AES128 Card master key flag - 1 Byte: 0x00 if card master key, 0x01 otherwise. Key number on card - 1 Byte: 0x0 to 0xD Length of random number: 1 Byte Random number generated by PCD : 8 or 16 bytes. Not required for Sam non X mode. Random number returned by GetChallenge command : 8 Bytes or 16 Bytes Key number : 2 bytes key Version: 2 bytes |
| [in] | bInputLen | [In] Length of bytes available in Input buffer. |
| [in] | bExtendedLenApdu | [In] Flag for Extended Length APDU. |
| [out] | pDataOut | [Out] Returns Rnd number PCD2 in Sam non x mode. Nothing in S/W mode. |
| [out] | pOutLen | [Out] Length of data returned in pDataOut. |
| phStatus_t phalMfdfEVx_IsoInternalAuthenticate | ( | void * | pDataParams, |
| uint8_t * | pInput, | ||
| uint8_t | bInputLen, | ||
| uint8_t | bExtendedLenApdu, | ||
| uint8_t * | pDataOut, | ||
| uint8_t * | pOutLen | ||
| ) |
ISO Internal Authenticate.
This command is implemented in compliance with ISO/IEC 7816-4.
| PH_ERR_SUCCESS | Operation successful. |
| Other | Depending on implementation and underlying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | pInput | [In] Input data should be as mentioned below. Reference to crypto algorithm - 1 Byte: 00 => context defined, 02 => 2K3DES, 04 => 3k3DES, 09 => AES128 Card master key flag - 1 Byte: 0x00 if card master key, 0x01 otherwise. Key number on card - 1 Byte: 0x0 to 0xD Length of random number: 1 Byte Random number Rpcd2 : 8 Bytes or 16 Bytes. Key number : 2 bytes key Version: 2 bytes |
| [in] | bInputLen | [In] Length of bytes available in Input buffer. |
| [in] | bExtendedLenApdu | [In] Flag for Extended Length APDU. |
| [out] | pDataOut | [Out] RRPICC2 || RPCD2 after decryption in S/W mode. Nothing in Sam non x mode. |
| [out] | pOutLen | [Out] Length of data available in DataOut buffer. |
| phStatus_t phalMfdfEVx_IsoAuthenticate | ( | void * | pDataParams, |
| uint16_t | wKeyNo, | ||
| uint16_t | wKeyVer, | ||
| uint8_t | bKeyNoCard, | ||
| uint8_t | bIsPICCkey | ||
| ) |
Perform ISO authentication GetChallenge, External Authenticate & Internal Authenticate of a DESFire PICC.
Internally performs the three pass ISO authentication by calling GetChallenge
External Authenticate
Internal Authenticate
Generates and stores the session key
| PH_ERR_SUCCESS | Operation successful. |
| Other | Depending on implementation and underlying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | wKeyNo | [In] DESFire key number or SAM Key entry number. |
| [in] | wKeyVer | [In] Key version. |
| [in] | bKeyNoCard | [In] Key number on card. 0x0 to 0xD. |
| [in] | bIsPICCkey | [In] Is it PICC Master key ? 1 = YES. |