NXP Reader Library  v17.1.0.2535
Commands_Miscellaneous

These Components implement the MIFARE DESFire Light Miscellaneous functions. These are not part of actual Identity data sheet rather its for internal purpose. More...

Collaboration diagram for Commands_Miscellaneous:

Functions

phStatus_t phalMfIdentity_GetConfig (void *pDataParams, uint16_t wConfig, uint8_t *pValue)
 Perform a GetConfig command. More...
 
phStatus_t phalMfIdentity_SetConfig (void *pDataParams, uint16_t wConfig, uint8_t *pValue)
 Perform a SetConfig command. More...
 
phStatus_t phalMfIdentity_ResetAuthentication (void *pDataParams)
 Reset the authentication. More...
 
phStatus_t phalMfIdentity_CalculateTMV (void *pDataParams, uint16_t wOption, uint16_t wKeyNoTMACKey, uint16_t wKeyVerTMACKey, uint16_t wRamKeyNo, uint16_t wRamKeyVer, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t *pTMC, uint8_t *pUid, uint8_t bUidLen, uint8_t *pTMI, uint32_t wTMILen, uint8_t *pTMV)
 Computed the Transaction MAC input as performed on the PICC. More...
 
phStatus_t phalMfIdentity_DecryptReaderID (void *pDataParams, uint16_t wOption, uint16_t wKeyNoTMACKey, uint16_t wKeyVerTMACKey, uint16_t wRamKeyNo, uint16_t wRamKeyVer, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t *pTMC, uint8_t *pUid, uint8_t bUidLen, uint8_t *pEncTMRI, uint8_t *pTMRIPrev)
 Decrypted the reader ID as performed on the PICC. More...
 
phStatus_t phalMfIdentity_CalculateMACSDM (void *pDataParams, uint16_t wOption, uint8_t bSdmOption, uint16_t wSDMMacKeyNo, uint16_t wSDMMacKeyVer, uint16_t wRamKeyNo, uint16_t wRamKeyVer, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t *pUid, uint8_t bUidLen, uint8_t *pSDMReadCtr, uint8_t *pInData, uint16_t wInDataLen, uint8_t *pRespMac)
 Calculate MAC for SDM information. More...
 
phStatus_t phalMfIdentity_DecryptSDMENCFileData (void *pDataParams, uint16_t wOption, uint16_t wEncKeyNo, uint16_t wEncKeyVer, uint16_t wRamKeyNo, uint16_t wRamKeyVer, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t *pUid, uint8_t bUidLen, uint8_t *pSDMReadCtr, uint8_t *pEncdata, uint16_t wEncDataLen, uint8_t *pPlainData)
 Decrypt the SDM File data information. More...
 
phStatus_t phalMfIdentity_DecryptSDMPICCData (void *pDataParams, uint16_t wOption, uint16_t wKeyNo, uint16_t wKeyVer, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t *pEncdata, uint16_t wEncDataLen, uint8_t *pPlainData)
 Decrypt SDM PICC Data. More...
 

The configuration to be used for SetConfig / GetConfig.

#define PHAL_MFIDENTITY_ADDITIONAL_INFO   0x00A1U
 Option for getconfig to get additional info of a generic error.
 
#define PHAL_MFIDENTITY_WRAPPED_MODE   0x00A2U
 Option to get / set current status of command wrapping in ISO 7816-4 APDUs.
 
#define PHAL_MFIDENTITY_SHORT_LENGTH_APDU   0x00A3U
 Option to get / set Short Length APDU wrapping in ISO 7816-4 APDUs.
 
#define PHAL_MFIDENTITY_FILE_OPTION   0x00A4U
 The settings of the File.
 
#define PHAL_MFIDENTITY_SDM_OPTION   0x00A5U
 The SDM settings of the file.
 
#define PHAL_MFIDENTITY_KEY_INFO   0x00A6U
 Key Information. More...
 
#define PHAL_MFIDENTITY_SDM_ENC_OFFSET   0x00A7U
 SDM ENC offset. More...
 
#define PHAL_MFIDENTITY_SDM_ENC_LENGTH   0x00A8U
 SDM ENC Length. More...
 
#define PHAL_MFIDENTITY_SDM_READ_CTR   0x00A9U
 SDM Read Counter information.
 
#define PHAL_MFIDENTITY_SDM_KEY_TYPE   0x00AAU
 Distinguish between the LRP_AES or AES key. More...
 
#define PHAL_MFIDENTITY_RAM_KEY_INFO   0x00ABU
 Key Information. More...
 

Detailed Description

These Components implement the MIFARE DESFire Light Miscellaneous functions. These are not part of actual Identity data sheet rather its for internal purpose.

Macro Definition Documentation

◆ PHAL_MFIDENTITY_KEY_INFO

#define PHAL_MFIDENTITY_KEY_INFO   0x00A6U

Key Information.

This should be used to set Key number and version for decryption the SDMENCFileData.

◆ PHAL_MFIDENTITY_SDM_ENC_OFFSET

#define PHAL_MFIDENTITY_SDM_ENC_OFFSET   0x00A7U

SDM ENC offset.

This should be set to identify the start position of SDM Encrypted file data.

◆ PHAL_MFIDENTITY_SDM_ENC_LENGTH

#define PHAL_MFIDENTITY_SDM_ENC_LENGTH   0x00A8U

SDM ENC Length.

This should be set for the total encrypted data available.

◆ PHAL_MFIDENTITY_SDM_KEY_TYPE

#define PHAL_MFIDENTITY_SDM_KEY_TYPE   0x00AAU

Distinguish between the LRP_AES or AES key.

The values to be used for this configuration are AES128 : 0x00 LRP_AES128 : 0x01

◆ PHAL_MFIDENTITY_RAM_KEY_INFO

#define PHAL_MFIDENTITY_RAM_KEY_INFO   0x00ABU

Key Information.

This should be used to set Key number and version for decryption the SDMENCFileData.

Function Documentation

◆ phalMfIdentity_GetConfig()

phStatus_t phalMfIdentity_GetConfig ( void *  pDataParams,
uint16_t  wConfig,
uint8_t pValue 
)

Perform a GetConfig command.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wConfig[In] Configuration to read. Will be one of the below values.
[out]pValue[Out] The value for the mentioned configuration.

◆ phalMfIdentity_SetConfig()

phStatus_t phalMfIdentity_SetConfig ( void *  pDataParams,
uint16_t  wConfig,
uint8_t pValue 
)

Perform a SetConfig command.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wConfig[In] Configuration to set. Will be one of the below values.
[in]pValue[In] The value for the mentioned configuration.

◆ phalMfIdentity_ResetAuthentication()

phStatus_t phalMfIdentity_ResetAuthentication ( void *  pDataParams)

Reset the authentication.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.

◆ phalMfIdentity_CalculateTMV()

phStatus_t phalMfIdentity_CalculateTMV ( void *  pDataParams,
uint16_t  wOption,
uint16_t  wKeyNoTMACKey,
uint16_t  wKeyVerTMACKey,
uint16_t  wRamKeyNo,
uint16_t  wRamKeyVer,
uint8_t pDivInput,
uint8_t  bDivInputLen,
uint8_t pTMC,
uint8_t pUid,
uint8_t  bUidLen,
uint8_t pTMI,
uint32_t  wTMILen,
uint8_t pTMV 
)

Computed the Transaction MAC input as performed on the PICC.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Diversification option. 0xFFFF is for No Diversification.
[in]wKeyNoTMACKey[In] Key number in key store of Software.
[in]wKeyVerTMACKey[In] Key version in key store of Software.
[in]wRamKeyNo[In] Key number of Destination Key where the computed session TMAC key will be stored. To be used for SAM AV3 only.
[in]wRamKeyVer[In] Key version of Destination Key where the computed session TMAC key will be stored. To be used for SAM AV3 only.
[in]pDivInput[In] Diversification input to diversify TMACKey.
[in]bDivInputLen[In] Length of byte available in DivInput buffer.
[in]pTMC[In] 4 bytes Transaction MAC Counter. It should be 1 time subtracted from the actual value and should be LSB first.
[in]pUid[In] UID of the card.
[in]bUidLen[In] Length of UID supplied.
[in]pTMI[In] Transaction MAC Input.
[in]wTMILen[In] Length of bytes available in TMI buffer.
[out]pTMV[Out] The computed Transaction MAC Value.

◆ phalMfIdentity_DecryptReaderID()

phStatus_t phalMfIdentity_DecryptReaderID ( void *  pDataParams,
uint16_t  wOption,
uint16_t  wKeyNoTMACKey,
uint16_t  wKeyVerTMACKey,
uint16_t  wRamKeyNo,
uint16_t  wRamKeyVer,
uint8_t pDivInput,
uint8_t  bDivInputLen,
uint8_t pTMC,
uint8_t pUid,
uint8_t  bUidLen,
uint8_t pEncTMRI,
uint8_t pTMRIPrev 
)

Decrypted the reader ID as performed on the PICC.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Diversification option. 0xFFFF is for No Diversification.
[in]wKeyNoTMACKey[In] Key number in key store of Software.
[in]wKeyVerTMACKey[In] Key version in key store of Software.
[in]wRamKeyNo[In] Key number of Destination Key where the computed session TMAC key will be stored. To be used for SAM AV3 only.
[in]wRamKeyVer[In] Key version of Destination Key where the computed session TMAC key will be stored. To be used for SAM AV3 only.
[in]pDivInput[In] Diversification input to diversify TMACKey.
[in]bDivInputLen[In] Length of byte available in DivInput buffer.
[in]pTMC[In] 4 bytes Transaction MAC Counter. It should be 1 time subtracted from the actual value and should be LSB first.
[in]pUid[In] UID of the card.
[in]bUidLen[In] Length of UID supplied.
[in]pEncTMRI[In] Encrypted Transaction MAC ReaderID of the latest successful transaction.
[out]pTMRIPrev[Out] Decrypted Reader ID of the last successful transaction.

◆ phalMfIdentity_CalculateMACSDM()

phStatus_t phalMfIdentity_CalculateMACSDM ( void *  pDataParams,
uint16_t  wOption,
uint8_t  bSdmOption,
uint16_t  wSDMMacKeyNo,
uint16_t  wSDMMacKeyVer,
uint16_t  wRamKeyNo,
uint16_t  wRamKeyVer,
uint8_t pDivInput,
uint8_t  bDivInputLen,
uint8_t pUid,
uint8_t  bUidLen,
uint8_t pSDMReadCtr,
uint8_t pInData,
uint16_t  wInDataLen,
uint8_t pRespMac 
)

Calculate MAC for SDM information.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Diversification option. 0xFFFF is for No Diversification.
[in]bSdmOption[In] SDM Option to indicate which parameters to be considered. Can be ORed.
[in]wSDMMacKeyNo[In] Key number in Software or SAM keystore.
[in]wSDMMacKeyVer[In] Key version in Software or SAM keystore.
[in]wRamKeyNo[In] Key number of Destination Key where the computed session TMAC key will be stored. To be used for SAM AV3 only.
[in]wRamKeyVer[In] Key version of Destination Key where the computed session TMAC key will be stored. To be used for SAM AV3 only.
[in]pDivInput[In] Diversification input to diversify the SDMMACKey.
[in]bDivInputLen[In] Length of byte available in DivInput buffer.
[in]pUid[In] UID of the card.
[in]bUidLen[In] Length of bytes available in UID buffer.
[in]pSDMReadCtr[In] SDM Read Counter Input.
[in]pInData[In] Data read out of PICC from SDMMacInputoffset for ReadLength bytes
[in]wInDataLen[In] Length of bytes available in InData buffer.
[out]pRespMac[Out] The computed MAC information.

◆ phalMfIdentity_DecryptSDMENCFileData()

phStatus_t phalMfIdentity_DecryptSDMENCFileData ( void *  pDataParams,
uint16_t  wOption,
uint16_t  wEncKeyNo,
uint16_t  wEncKeyVer,
uint16_t  wRamKeyNo,
uint16_t  wRamKeyVer,
uint8_t pDivInput,
uint8_t  bDivInputLen,
uint8_t pUid,
uint8_t  bUidLen,
uint8_t pSDMReadCtr,
uint8_t pEncdata,
uint16_t  wEncDataLen,
uint8_t pPlainData 
)

Decrypt the SDM File data information.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Diversification option. 0xFFFF is for No Diversification.
[in]wEncKeyNo[In] Key number in keystore of Software or SAM.
[in]wEncKeyVer[In] Key version in keystore of Software or SAM.
[in]wRamKeyNo[In] Key number of Destination Key where the computed session TMAC key will be stored. To be used for SAM AV3 only.
[in]wRamKeyVer[In] Key version of Destination Key where the computed session TMAC key will be stored. To be used for SAM AV3 only.
[in]pDivInput[In] Diversification input to diversify the EncKey.
[in]bDivInputLen[In] Length of byte available in DivInput buffer.
[in]pUid[In] UID of the card.
[in]bUidLen[In] Length of bytes available in UID buffer.
[in]pSDMReadCtr[In] SDM Read Counter Input.
[in]pEncdata[In] Input Enciphered data. Caller has to pass only the Enciphered data which is between SDMEncOffset for SDMEncLength bytes.
[in]wEncDataLen[In] Length of bytes available in Encdata buffer
[out]pPlainData[Out] The decrypted SDM ENC file data.

◆ phalMfIdentity_DecryptSDMPICCData()

phStatus_t phalMfIdentity_DecryptSDMPICCData ( void *  pDataParams,
uint16_t  wOption,
uint16_t  wKeyNo,
uint16_t  wKeyVer,
uint8_t pDivInput,
uint8_t  bDivInputLen,
uint8_t pEncdata,
uint16_t  wEncDataLen,
uint8_t pPlainData 
)

Decrypt SDM PICC Data.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Diversification option. 0xFFFF is for No Diversification.
[in]wKeyNo[In] Key number in Software or SAM keystore.
[in]wKeyVer[In] Key version in Software or SAM keystore.
[in]pDivInput[In] Diversification input to diversify the Key.
[in]bDivInputLen[In] Length of byte available in DivInput buffer.
[in]pEncdata[In] The Encrypted PICC data.
[in]wEncDataLen[In] Length of bytes available in EncData buffer.
[out]pPlainData[Out] The decrypted SDM PICC data.