NXP Reader Library  v17.1.0.2535

SAM commands used for MIFARE Classic S communication. More...

Collaboration diagram for S Mode:

Macros

#define PHHAL_HW_SAMAV3_CMD_SAM_AUTH_MIFARE_LC_MIN   13U
 Minimun Length of LC data for SAM_AuthenticateMifare command.
 
#define PHHAL_HW_SAMAV3_CMD_SAM_CHANGE_KEY_MIFARE_DUMP_CMD_SIZE   13U
 Macro to represent the SAM_ChangeKeyMIFAREDump command size.
 
#define PHHAL_HW_SAMAV3_CMD_SAM_CHANGE_KEY_MIFARE_DUMP_LC_MIN   3U
 Minimun Length of LC data for SAM_ChangeKeyMIFAREDump command.
 

Functions

phStatus_t phhalHw_SamAV3_Cmd_SAM_AuthenticateMIFARE_Part1 (phhalHw_SamAV3_DataParams_t *pDataParams, uint8_t bOption, uint8_t *pMFUID, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t bKeyType, uint8_t bMFBlockNo, uint8_t bDivBlockNo, uint8_t *pNumberRB, uint8_t bNumRBLen, uint8_t **ppEncToken, uint16_t *pEncTokenLen)
 Performs the MIFARE Classic authentication in S mode. More...
 
phStatus_t phhalHw_SamAV3_Cmd_SAM_AuthenticateMIFARE_Part2 (phhalHw_SamAV3_DataParams_t *pDataParams, uint8_t *pEncToken, uint8_t bEncTokenLen)
 Performs the MIFARE Classic authentication in S mode. More...
 
phStatus_t phhalHw_SamAV3_Cmd_SAM_ChangeKeyMIFARE (phhalHw_SamAV3_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyVerA, uint8_t bKeyVerB, uint8_t *pAccCond, uint8_t *pMFUID, uint8_t bDivBlockNo, uint8_t **ppProtData, uint16_t *pProtDataLen)
 Performs the MIFARE Classic key change in S mode. More...
 
phStatus_t phhalHw_SamAV3_Cmd_SAM_ChangeKeyMIFAREDump (phhalHw_SamAV3_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t bKeyType, uint8_t *pMFUID, uint8_t bDivBlockNo, uint8_t **ppSecretKey, uint16_t *pSecretKeyLen)
 Performs the MIFARE Classic key dump in S mode. More...
 

Sam AV3 command code for MIFARE Classic NonX features.

#define PHHAL_HW_SAMAV3_CMD_SAM_AUTHENTICATE_MIFARE_INS   0x1C
 Sam AV3 Instruction code for Cmd.SAM_AuthenticateMifare command.
 
#define PHHAL_HW_SAMAV3_CMD_SAM_CHANGE_KEY_MIFARE_INS   0xC5
 Sam AV3 Instruction code for Cmd.SAM_ChangeKeyMIFARE command.
 

Option macros for Sam AV3 MIFARE Change Key Crypto.

#define PHHAL_HW_SAMAV3_CMD_CHANGE_KEY_MIFARE_PLAIN   0x00
 Option mask to disable the encryption of SecretKey given by SAM.
 
#define PHHAL_HW_SAMAV3_CMD_CHANGE_KEY_MIFARE_ENCRYPT   0x01
 Option mask to enable the encryption of SecretKey given by SAM.
 

Detailed Description

SAM commands used for MIFARE Classic S communication.

Function Documentation

◆ phhalHw_SamAV3_Cmd_SAM_AuthenticateMIFARE_Part1()

phStatus_t phhalHw_SamAV3_Cmd_SAM_AuthenticateMIFARE_Part1 ( phhalHw_SamAV3_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t pMFUID,
uint8_t  bKeyNo,
uint8_t  bKeyVer,
uint8_t  bKeyType,
uint8_t  bMFBlockNo,
uint8_t  bDivBlockNo,
uint8_t pNumberRB,
uint8_t  bNumRBLen,
uint8_t **  ppEncToken,
uint16_t pEncTokenLen 
)

Performs the MIFARE Classic authentication in S mode.

This interfaces exchanges the first part of random challange received from PICC to Sam hardware.

Returns
Status code
Return values
PH_ERR_SUCCESS_CHAININGOperation successful, chaining ongoing.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Specify whether diversification block number should be exchanged or not.
[in]pMFUID[In] MIFARE classic UID. Here the last four bytes of the UID should be passed regardless of 4 or 7 byte UID.
[in]bKeyNo[In] Key number of MIFARE key available in Sam keystore.
[in]bKeyVer[In] Key Version of MIFARE key available in Sam keystore.
[in]bKeyType[In] Type of key to be used.
[in]bMFBlockNo[In] MIFARE block number used for authentication.
[in]bDivBlockNo[In] Block number to be used for Key diversification in Sam.
[in]pNumberRB[In] Should have the 5bytes (4 bytes of Rnd + 1 byte of Parity) of information (Token RB) returned by PICC.
[in]bNumRBLen[In] Length of Number RB returned by PICC.
[out]ppEncToken[Out] The encrypted (Token AB) information to be send to PICC. This will have 9 bytes (8 bytes of encrypted information + 1 byte of Parity)
[out]pEncTokenLen[Out] Length of encrypted token returned.

◆ phhalHw_SamAV3_Cmd_SAM_AuthenticateMIFARE_Part2()

phStatus_t phhalHw_SamAV3_Cmd_SAM_AuthenticateMIFARE_Part2 ( phhalHw_SamAV3_DataParams_t pDataParams,
uint8_t pEncToken,
uint8_t  bEncTokenLen 
)

Performs the MIFARE Classic authentication in S mode.

This interfaces exchanges the second part of random challange received from PICC to Sam hardware.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pEncToken[In] Should have the 5bytes (4 bytes of Rnd + 1 byte of Parity) of information (Token BA) returned by PICC.
[in]bEncTokenLen[In] Length of Enc token returned by PICC.

◆ phhalHw_SamAV3_Cmd_SAM_ChangeKeyMIFARE()

phStatus_t phhalHw_SamAV3_Cmd_SAM_ChangeKeyMIFARE ( phhalHw_SamAV3_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t  bKeyNo,
uint8_t  bKeyVerA,
uint8_t  bKeyVerB,
uint8_t pAccCond,
uint8_t pMFUID,
uint8_t  bDivBlockNo,
uint8_t **  ppProtData,
uint16_t pProtDataLen 
)

Performs the MIFARE Classic key change in S mode.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Specify whether diversification block number and UID should be exchanged or not.
[in]bKeyNo[In] Key number of MIFARE key available in Sam keystore.
[in]bKeyVerA[In] Key Version of MIFARE key A available in Sam keystore.
[in]bKeyVerB[In] Key Version of MIFARE key B available in Sam keystore.
[in]pAccCond[In] MIFARE classic access conditions.
[in]pMFUID[In] MIFARE classic UID. Here the last four bytes of the UID should be passed regardless of 4 or 7 byte UID.
[in]bDivBlockNo[In] Block number to be used for Key diversification in Sam.
[out]ppProtData[Out] The protected information to be sent to PICC.
[out]pProtDataLen[Out] Length of protected information returned.

◆ phhalHw_SamAV3_Cmd_SAM_ChangeKeyMIFAREDump()

phStatus_t phhalHw_SamAV3_Cmd_SAM_ChangeKeyMIFAREDump ( phhalHw_SamAV3_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t  bKeyNo,
uint8_t  bKeyVer,
uint8_t  bKeyType,
uint8_t pMFUID,
uint8_t  bDivBlockNo,
uint8_t **  ppSecretKey,
uint16_t pSecretKeyLen 
)

Performs the MIFARE Classic key dump in S mode.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Specify whether diversification block number and UID should be exchanged or not.
[in]bKeyNo[In] Key number of MIFARE key available in Sam keystore.
[in]bKeyVer[In] Key Version of MIFARE key available in Sam keystore.
[in]bKeyType[In] Key Version of MIFARE key B available in Sam keystore. Type of key to be used.
[in]pMFUID[In] MIFARE classic UID. Here the last four bytes of the UID should be passed regardless of 4 or 7 byte UID.
[in]bDivBlockNo[In] Block number to be used for Key diversification in Sam.
[out]ppSecretKey[Out] The Secret key information to be sent to PICC.
[out]pSecretKeyLen[Out] Length of Secret key information returned.