NXP Reader Library  v17.1.0.2535

SAM commands used for DESFire and ULC card communication in Non-X-Mode. More...

Collaboration diagram for DESFire and ULC in Non-X Mode:

Macros

#define PHHAL_HW_SAMAV2_CMD_AUTHENTICATE_PICC_MIN_DATA_LENGTH   0x02
 Minimum CMD length of AuthenticatePICCPartOne command.
 
#define PHHAL_HW_SAMAV2_CMD_ISO_AUTHENTICATE_PICC_MIN_DATA_LENGTH   0x02
 Minimum CMD length of IsoAuthenticatePICCPartOne command.
 
#define PHHAL_HW_SAMAV2_CMD_CHANGE_KEY_MIN_DATA_LENGTH   0x04
 Minimum CMD length of AuthenticatePICCPartOne command.
 

Functions

phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticatePICC_Part1 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t bAuthMode, uint8_t bKeyNo, uint8_t bKeyV, uint8_t *pEncRndB, uint8_t bEncRndBLength, uint8_t *pDivInput, uint8_t bDivInputLength, uint8_t *pEncRndAB, uint8_t *pEncRndABLength)
 First part of an authentication procedure between SAM and DESFire or ULC. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticatePICC_Part2 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t *pEncRndA, uint8_t bEncRndALength)
 Second part of an authentication procedure between SAM and DESFire. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_IsoAuthenticatePICC_Part1 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t bAuthMode, uint8_t bKeyNo, uint8_t bKeyV, uint8_t *pRndCard, uint8_t pRndCardLength, uint8_t *pDivInput, uint8_t bDivInputLength, uint8_t *pEncRnd, uint8_t *pEncRndLength)
 First part of an ISO authentication procedure between SAM and DESFire. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_IsoAuthenticatePICC_Part2 (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t *pRnd, uint8_t bRndLength)
 Second part of an ISO authentication procedure between SAM and DESFire. More...
 
phStatus_t phhalHw_SamAV2_Cmd_SAM_ChangeKeyPICC (phhalHw_SamAV2_DataParams_t *pDataParams, uint8_t bKeyCompMeth, uint8_t bCfg, uint8_t bKeyNoCurrent, uint8_t bKeyVCurrent, uint8_t bKeyNoNew, uint8_t bKeyVNew, uint8_t *pDivInput, uint8_t bDivInputLength, uint8_t *pEncStream, uint8_t *pEncStreamLength)
 Change a key of a DESFire PICC. More...
 

Sam AV2 command code for Sam MIFARE DESFire and Ultralight Non-X feature.

#define PHHAL_HW_SAMAV2_CMD_AUTHENTICATE_PICC_INS   0x0A
 CMD Byte for AuthenticatePICC command.
 
#define PHHAL_HW_SAMAV2_CMD_ISO_AUTHENTICATE_PICC_INS   0x8E
 CMD Byte for IsoAuthenticatePICC command.
 
#define PHHAL_HW_SAMAV2_CMD_CHANGE_KEY_PICC_INS   0xC4
 CMD Byte for ChangeKeyPICC command.
 

Detailed Description

SAM commands used for DESFire and ULC card communication in Non-X-Mode.

See also
Data Processing

Function Documentation

◆ phhalHw_SamAV2_Cmd_SAM_AuthenticatePICC_Part1()

phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticatePICC_Part1 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t  bAuthMode,
uint8_t  bKeyNo,
uint8_t  bKeyV,
uint8_t pEncRndB,
uint8_t  bEncRndBLength,
uint8_t pDivInput,
uint8_t  bDivInputLength,
uint8_t pEncRndAB,
uint8_t pEncRndABLength 
)

First part of an authentication procedure between SAM and DESFire or ULC.

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]bAuthMode[In] Authentication mode used.
[in]bKeyNo[In] DESFire key number or key reference number (depends on SAM_SelectApplication done or not).
[in]bKeyV[In] Key version.
[in]pEncRndB[In] Encoded random B (received from PICC).
[in]bEncRndBLength[In] Encoded random B length.
[in]pDivInput[In] Diversification input data.
[in]bDivInputLength[In] Diversification input data length (00h in case of no diversification).
[out]pEncRndAB[Out] Buffer containing the encoded random numbers to be sent to the PICC. This buffer has to be 32 bytes long.
[out]pEncRndABLength[Out] Amount of valid data bytes in encoded pEncRndAB.

◆ phhalHw_SamAV2_Cmd_SAM_AuthenticatePICC_Part2()

phStatus_t phhalHw_SamAV2_Cmd_SAM_AuthenticatePICC_Part2 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t pEncRndA,
uint8_t  bEncRndALength 
)

Second part of an authentication procedure between SAM and DESFire.

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]pEncRndA[In] Encoded random A (received from PICC - 08h or 10h bytes).
[in]bEncRndALength[In] Encoded random A length.

◆ phhalHw_SamAV2_Cmd_SAM_IsoAuthenticatePICC_Part1()

phStatus_t phhalHw_SamAV2_Cmd_SAM_IsoAuthenticatePICC_Part1 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t  bAuthMode,
uint8_t  bKeyNo,
uint8_t  bKeyV,
uint8_t pRndCard,
uint8_t  pRndCardLength,
uint8_t pDivInput,
uint8_t  bDivInputLength,
uint8_t pEncRnd,
uint8_t pEncRndLength 
)

First part of an ISO authentication procedure between SAM and DESFire.

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]bAuthMode[In] Authentication mode used.
[in]bKeyNo[In] DESFire key number or key reference number (depends on SAM_SelectApplication done or not).
[in]bKeyV[In] Key version.
[in]pRndCard[In] Random number received from card.
[in]pRndCardLength[In] Random number length (8 bytes for (3)DES or 16 bytes for 3K3DES and AES).
[in]pDivInput[In] Diversification input data.
[in]bDivInputLength[In] Diversification input data length.
[out]pEncRnd[Out] Buffer containing two encoded and one plain random number. This buffer has to be 24 or 48 bytes long.
[out]pEncRndLength[Out] Amount of valid data bytes in encoded pEncRnd.

◆ phhalHw_SamAV2_Cmd_SAM_IsoAuthenticatePICC_Part2()

phStatus_t phhalHw_SamAV2_Cmd_SAM_IsoAuthenticatePICC_Part2 ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t pRnd,
uint8_t  bRndLength 
)

Second part of an ISO authentication procedure between SAM and DESFire.

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]pRnd[In] RPCD2 received from card.
[in]bRndLength[In] RPCD2 length.

◆ phhalHw_SamAV2_Cmd_SAM_ChangeKeyPICC()

phStatus_t phhalHw_SamAV2_Cmd_SAM_ChangeKeyPICC ( phhalHw_SamAV2_DataParams_t pDataParams,
uint8_t  bKeyCompMeth,
uint8_t  bCfg,
uint8_t  bKeyNoCurrent,
uint8_t  bKeyVCurrent,
uint8_t  bKeyNoNew,
uint8_t  bKeyVNew,
uint8_t pDivInput,
uint8_t  bDivInputLength,
uint8_t pEncStream,
uint8_t pEncStreamLength 
)

Change a key of a DESFire PICC.

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]bKeyCompMeth[In] Bit mask defining the key compilation method.
[in]bCfg[In] Bit mask defining the change key configuration.
[in]bKeyNoCurrent[In] Current Key Number.
[in]bKeyVCurrent[In] Current Key Version.
[in]bKeyNoNew[In] New Key Number.
[in]bKeyVNew[In] New Key Version.
[in]pDivInput[In] Diversification input data.
[in]bDivInputLength[In] Diversification input data length. No diversification in case of 00h.
[out]pEncStream[Out] Buffer containing the stream to be sent to the PICC. The buffer has to be 32 bytes long.
[out]pEncStreamLength[Out] Amount of valid data bytes in pEncStream.