NXP Reader Library  v17.1.0.2535

SAM commands used for MIFARE Plus card communication in Non-X Mode. More...

Collaboration diagram for MFP in Non-X Mode:

Macros

#define PHHAL_HW_SAMAV2_CMD_READ_MFP_COMMAND   0x00
 data parameter is a command
 
#define PHHAL_HW_SAMAV2_CMD_READ_MFP_RESPONSE   0x01
 data parameter is a response
 
#define PHHAL_HW_SAMAV2_CMD_CHANGE_KEY_MFP_CMD_MIN_DATA_LENGTH   0x05
 Minimum CMD length of ChangeKeyMFP command.
 

Functions

phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticateMfp_Part1 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyV, uint8_t *pRndB, uint8_t *pDivInput, uint8_t bDivInputLength, uint8_t *pRndARndB, uint8_t *pRndARndBLength)
 First part of MFP Authenticate. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticateMfp_Part2 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t *pEncData, uint8_t bEncDataLength, uint8_t *pPdCap, uint8_t *pPcdCap)
 Second part of MFP Authenticate. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_CombinedReadMfp (phhalHw_SamAV2_DataParams_t *pDataParams, uint16_t wOption, uint8_t *pData, uint8_t bDataLength, uint8_t **ppOutput, uint16_t *pOutputLength)
 MFP CombinedRead command. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_CombinedWriteMfp (phhalHw_SamAV2_DataParams_t *pDataParams, uint16_t wOption, uint8_t *pData, uint8_t bDataLength, uint8_t **ppOutput, uint16_t *pOutputLength)
 MFP CombinedWrite command. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_ChangeKeyMfp_Part1 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t bCmd, uint16_t wBlockNo, uint8_t bKeyNo, uint8_t bKeyV, uint8_t *pDivInput, uint8_t bDivInputLength, uint8_t **ppOutput, uint16_t *pOutputLength)
 Prepare the MFP command for key change. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_ChangeKeyMfp_Part2 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t *pDataIn, uint8_t bDataInLength)
 Process the response to a key change command. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_VirtualCardSupportMfp (phhalHw_SamAV2_DataParams_t *pDataParams, uint16_t wOption, uint8_t *pData, uint8_t bDataLength, uint8_t *pPcdCapabilities, uint8_t bPcdCapabilitiesLength, uint8_t **pSupportedCardInfo, uint16_t *pSupportedCardInfoLength)
 MFP Virtual Card Support command. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_SelectVirtualCardMfp (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t bKeyNo, uint8_t bKeyV, uint8_t *pRndQ, uint8_t *pDivInput, uint8_t bDivInputLength, uint8_t *pMac)
 MFP Select Virtual Card Select command. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_ProximityCheckMfp_Part1 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t bKeyNo, uint8_t bKeyV, uint8_t bPpse, uint8_t *pRndRC, uint8_t *pDivInput, uint8_t bDivInputLength, uint8_t *pMac)
 First part of the MFP Proximity Check command. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_ProximityCheckMfp_Part2 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t *pMac)
 Second part of the MFP Proximity Check command. More...
 

Sam AV2 command code for Sam MIFARE Plus Non-X feature.

#define PHHAL_HW_SAMAV2_CMD_AUTHENTICATE_MFP   0xA3
 CMD Byte for SAM_AuthenticateMFP command.
 
#define PHHAL_HW_SAMAV2_CMD_READ_MFP   0x33
 CMD Byte for SAM_CombinedReadMFP command.
 
#define PHHAL_HW_SAMAV2_CMD_WRITE_MFP   0x34
 CMD Byte for SAM_CombinedWriteMFP command.
 
#define PHHAL_HW_SAMAV2_CMD_CHANGE_KEY_MFP_INS   0x35
 CMD Byte for ChangeKeyMFP command.
 
#define PHHAL_HW_SAMAV2_CMD_VIRTUAL_CARD_SUPPORT   0x41
 CMD Byte for SAM_VirtualCardSupport command.
 
#define PHHAL_HW_SAMAV2_CMD_SELECT_VIRTUAL_CARD   0x43
 CMD Byte for SAM_SelectVirtualCard command.
 
#define PHHAL_HW_SAMAV2_CMD_VERIFY_PROXIMITY_CHECK   0xFE
 CMD Byte for SAM_ProximityCheck command.
 

Option macros for Sam AV2 MIFARE Plus Non-X Authenticate command.

#define PHHAL_HW_SAMAV2_CMD_SAM_AUTHENTICATE_MFP_AUTH_FIRST   0x01
 Option mask for a first MFP Authentication.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_AUTHENTICATE_MFP_MF_ENCIPHERED   0x02
 Option mask for a MFP Authentication after a MIFARE Authentication.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_AUTHENTICATE_MFP_NO_KDF   0x00
 Option mask for a MFP Authentication with no KDF.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_AUTHENTICATE_MFP_SL2_KDF   0x04
 Option mask for a MFP Authentication with SL2 KDF.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_AUTHENTICATE_MFP_SL3_KDF   0x08
 Option mask for a MFP Authentication with SL3 KDF.
 

Option macros for Sam AV2 MIFARE Plus Non-X CombinedRead command.

#define PHHAL_HW_SAMAV2_CMD_SAM_COMBINED_READ_MFP_COMMAND   0x0000
 Option mask for a combined read - command.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_COMBINED_READ_MFP_RESPONSE   0x0004
 Option mask for a combined read - response.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_COMBINED_READ_MFP_COMMAND_RESPONSE   0x0008
 Option mask for a combined read - command + response.
 

Option macros for Sam AV2 MIFARE Plus Non-X CombinedWrite command.

#define PHHAL_HW_SAMAV2_CMD_SAM_COMBINED_WRITE_MFP_COMMAND   0x0000
 Option mask for a combined write - command.
 
#define PHHAL_HW_SAMAV2_CMD_SAM_COMBINED_WRITE_MFP_RESPONSE   0x0004
 Option mask for a combined write - response.
 

Detailed Description

SAM commands used for MIFARE Plus card communication in Non-X Mode.

See also
Data Processing

Function Documentation

◆ phhalHw_SamAV2_Cmd_SAM_AuthenticateMfp_Part1()

phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticateMfp_Part1 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t  bKeyNo,
uint8_t  bKeyV,
uint8_t pRndB,
uint8_t pDivInput,
uint8_t  bDivInputLength,
uint8_t pRndARndB,
uint8_t pRndARndBLength 
)

First part of MFP Authenticate.

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] Option for Authenticate MFP:
[in]bKeyNo[In] Key number to be used in authentication.
[in]bKeyV[In] Key version to be used in authentication.
[in]pRndB[In] Encrypted RND B received from the card. This buffer has to be 22 bytes longs in case of an active MFC authentication; in all other cases 16 bytes.
[in]pDivInput[In] Diversification input.
[in]bDivInputLength[In] Length of diversification input. If it is set to 00h no diversification is used.
[out]pRndARndB[Out] Buffer containing encrypted RndA || RndB to be sent to the card. This buffer has to be 40 bytes long.
[out]pRndARndBLength[Out] Amount of valid bytes in encrypted RNDA || RndB buffer.

◆ phhalHw_SamAV2_Cmd_SAM_AuthenticateMfp_Part2()

phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticateMfp_Part2 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t pEncData,
uint8_t  bEncDataLength,
uint8_t pPdCap,
uint8_t pPcdCap 
)

Second part of MFP Authenticate.

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]pEncData[In] Encrypted RND A' including TI.
[in]bEncDataLength[In] Length of pEncData (16 or 32 bytes).
[out]pPdCap[Out] Buffer containing PD Caps received from card. The buffer has to be 6 bytes long.
[out]pPcdCap[Out] Buffer containing PCD Caps received from card. The buffer has to be 6 bytes long.

◆ phhalHw_SamAV2_Cmd_SAM_CombinedReadMfp()

phStatus_t phhalHw_SamAV2_Cmd_SAM_CombinedReadMfp ( phhalHw_SamAV2_DataParams_t pDataParams,
uint16_t  wOption,
uint8_t pData,
uint8_t  bDataLength,
uint8_t **  ppOutput,
uint16_t pOutputLength 
)

MFP CombinedRead command.

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]wOption[In] Option parameter:
[in]pData[In] Input Data Stream.
[in]bDataLength[In] Length of input data stream.
[out]ppOutput[Out] Encrypted command or decrypted response.
[out]pOutputLength[Out] Length of encrypted command or decrypted response.

◆ phhalHw_SamAV2_Cmd_SAM_CombinedWriteMfp()

phStatus_t phhalHw_SamAV2_Cmd_SAM_CombinedWriteMfp ( phhalHw_SamAV2_DataParams_t pDataParams,
uint16_t  wOption,
uint8_t pData,
uint8_t  bDataLength,
uint8_t **  ppOutput,
uint16_t pOutputLength 
)

MFP CombinedWrite command.

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]wOption[In] Option flag to buffer the payload information.
[in]pData[In] Input data stream.
[in]bDataLength[In] Length of input data stream.
[out]ppOutput[Out] Encrypted command or decrypted response.
[out]pOutputLength[Out] Length of encrypted command or decrypted response.

◆ phhalHw_SamAV2_Cmd_SAM_ChangeKeyMfp_Part1()

phStatus_t phhalHw_SamAV2_Cmd_SAM_ChangeKeyMfp_Part1 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t  bCmd,
uint16_t  wBlockNo,
uint8_t  bKeyNo,
uint8_t  bKeyV,
uint8_t pDivInput,
uint8_t  bDivInputLength,
uint8_t **  ppOutput,
uint16_t pOutputLength 
)

Prepare the MFP command for key change.

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]bCmd[In] Command used to perform the change.
[in]wBlockNo[In] Block Number.
[in]bKeyNo[In] Key number to be used.
[in]bKeyV[In] Key version to be used.
[in]pDivInput[In] Pointer to diversification input data.
[in]bDivInputLength[In] Diversification input length. If it is 00h no diversification is used.
[out]ppOutput[Out] Output data from SAM.
[out]pOutputLength[Out] Output data length.

◆ phhalHw_SamAV2_Cmd_SAM_ChangeKeyMfp_Part2()

phStatus_t phhalHw_SamAV2_Cmd_SAM_ChangeKeyMfp_Part2 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t pDataIn,
uint8_t  bDataInLength 
)

Process the response to a key change command.

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]pDataIn[In] Pointer to input data (response from PICC).
[in]bDataInLength[In] Input data length.

◆ phhalHw_SamAV2_Cmd_SAM_VirtualCardSupportMfp()

phStatus_t phhalHw_SamAV2_Cmd_SAM_VirtualCardSupportMfp ( phhalHw_SamAV2_DataParams_t pDataParams,
uint16_t  wOption,
uint8_t pData,
uint8_t  bDataLength,
uint8_t pPcdCapabilities,
uint8_t  bPcdCapabilitiesLength,
uint8_t **  pSupportedCardInfo,
uint16_t pSupportedCardInfoLength 
)

MFP Virtual Card Support command.

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]wOption[In] Option parameter:
[in]pData[In] Buffer containing the data set field.
[in]bDataLength[In] Length of the data set buffer.
[in]pPcdCapabilities[In] PcdCapabilities sent to the card. This buffer has to be bPcdCapabilitiesLength bytes long.
[in]bPcdCapabilitiesLength[In] Length of PcdCapabilities.
[out]pSupportedCardInfo[Out] Pointer to buffer containing the card info of supported cards
[out]pSupportedCardInfoLength[Out] Amount of valid bytes in pSupportedCardInfo.

◆ phhalHw_SamAV2_Cmd_SAM_SelectVirtualCardMfp()

phStatus_t phhalHw_SamAV2_Cmd_SAM_SelectVirtualCardMfp ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t  bKeyNo,
uint8_t  bKeyV,
uint8_t pRndQ,
uint8_t pDivInput,
uint8_t  bDivInputLength,
uint8_t pMac 
)

MFP Select Virtual Card Select command.

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]bKeyNo[In] Key number to be used in SVC command.
[in]bKeyV[In] Key version to be used in SVC command.
[in]pRndQ[In] RndQ sent to the card. This buffer has to be 12 bytes long.
[in]pDivInput[In] Diversification input.
[in]bDivInputLength[In] Length of diversification input. If 00h no diversification is used.
[out]pMac[Out] MAC to be sent to the card. This buffer has to be 8 bytes long.

◆ phhalHw_SamAV2_Cmd_SAM_ProximityCheckMfp_Part1()

phStatus_t phhalHw_SamAV2_Cmd_SAM_ProximityCheckMfp_Part1 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t  bKeyNo,
uint8_t  bKeyV,
uint8_t  bPpse,
uint8_t pRndRC,
uint8_t pDivInput,
uint8_t  bDivInputLength,
uint8_t pMac 
)

First part of the MFP Proximity Check command.

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]bKeyNo[In] Key number to be used in authentication.
[in]bKeyV[In] Key version to be used in authentication.
[in]bPpse[In] PPSE byte used.
[in]pRndRC[In] RND number in correct format for MAC verification.
[in]pDivInput[In] Diversification input.
[in]bDivInputLength[In] Length of diversification input. If 00h no diversification is used.
[out]pMac[Out] Input in case of response MAC verification, output in case of command MAC generation. The buffer has to be 8 bytes long.

◆ phhalHw_SamAV2_Cmd_SAM_ProximityCheckMfp_Part2()

phStatus_t phhalHw_SamAV2_Cmd_SAM_ProximityCheckMfp_Part2 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t pMac 
)

Second part of the MFP Proximity Check command.

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]pMac[In] Input in case of response MAC verification, output in case of command MAC generation. The buffer has to be 8 bytes long.