NXP Reader Library  v17.1.0.2535

Implementation of SAM commands used for ICODE and UCODE communication in S-Mode. More...

Collaboration diagram for 12_ICODE_UCODE:

Modules

 Defines
 Definitions for SAM commands used for MIFARE Common communication in S-Mode.
 

Functions

phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticateTAM1 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t *pData, uint8_t bDataLen, uint8_t **ppIChallange, uint16_t *pIChallangeLen)
 Generates 10 bytes of random challange to be given to Tag. More...
 
phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticateTAM2 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t *pData, uint8_t bDataLen, uint8_t bBlockSize, uint8_t bBlockCount, uint8_t bProtMode, uint8_t **ppResponse, uint16_t *pRespLen)
 Generates 10 bytes of random challange to be given to Tag. More...
 
phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticateMAM1 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t *pData, uint8_t bDataLen, uint8_t bPurposeMAM2, uint8_t **ppIChallange, uint16_t *pIChallangeLen)
 Generates 10 bytes of random challange to be given to Tag. More...
 
phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticateMAM2 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t *pData, uint8_t bDataLen, uint8_t **ppIResponse, uint16_t *pIResponseLen)
 Decrypts the TResponse received from Tag and verifies the decrypted data for authenticity. More...
 

Detailed Description

Implementation of SAM commands used for ICODE and UCODE communication in S-Mode.

Function Documentation

◆ phhalHw_Sam_Cmd_SAM_AuthenticateTAM1()

phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticateTAM1 ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t  bKeyNo,
uint8_t  bKeyVer,
uint8_t pData,
uint8_t  bDataLen,
uint8_t **  ppIChallange,
uint16_t pIChallangeLen 
)

Generates 10 bytes of random challange to be given to Tag.

Also Decrypts the TResponse received from Tag and verifies the decrypted data for authenticity.

Return values
PH_ERR_SUCCESSOperation successful when bOption is Exchange TResponse.
PH_ERR_SUCCESS_CHAININGOperation successful with chaining status when bOption is Get IChallange.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpData and pIChallangeLen are NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] The command to be framed for SAM.
[in]bKeyNo[In] Key number to be used from SAM. One of the following,
  • NVM Key: 0x00 - 0x7F
  • RAM Key: 0xE0 - 0xE3
[in]bKeyVer[In] Key version to be used from SAM.
[in]pData[In] Diversification Input or TResponse received from Tag.
[in]bDataLen[In] Length of bytes available in pData buffer
[out]ppIChallange[Out] The IChallange to be sent to Tag. This will contain 10 bytes of random challange data.
[out]pIChallangeLen[Out] Length of bytes available in ppIChallange buffer.

◆ phhalHw_Sam_Cmd_SAM_AuthenticateTAM2()

phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticateTAM2 ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t  bKeyNo,
uint8_t  bKeyVer,
uint8_t pData,
uint8_t  bDataLen,
uint8_t  bBlockSize,
uint8_t  bBlockCount,
uint8_t  bProtMode,
uint8_t **  ppResponse,
uint16_t pRespLen 
)

Generates 10 bytes of random challange to be given to Tag.

Also Decrypts the TResponse received from Tag and verifies the decrypted data for authenticity and provides the custom data received form Tag.

Return values
PH_ERR_SUCCESSOperation successful when bOption is Exchange TResponse.
PH_ERR_SUCCESS_CHAININGOperation successful with chaining status when bOption is Get IChallange.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpData and pIChallangeLen are NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] The command to be framed for SAM.
[in]bKeyNo[In] Key number to be used from SAM. One of the following,
  • NVM Key: 0x00 - 0x7F
  • RAM Key: 0xE0 - 0xE3
[in]bKeyVer[In] Key version to be used from SAM.
[in]pData[In] Diversification Input or TResponse received from Tag.
[in]bDataLen[In] Length of bytes available in pData buffer.
[in]bBlockSize[In] To select the size of custom data block to be used. The value should either be 0x00 for 16 bit block size or 0x01 for 64 bit block size. As per ISO 29167
[in]bBlockCount[In] To select the custom data block to be used from the offset specified. The BlockCount range is from 1 - 16.
[in]bProtMode[In] To specify the mode of operation to be used for encryption /decryption. The ProtMode ranges form 0 - 3. As per ISO 29167
[out]ppResponse[Out] The IChallange to be sent to Tag. This will contain 10 bytes of random challange data. Or the Custom Data received from Tag.
[out]pRespLen[Out] Length of bytes available in ppResponse buffer.

◆ phhalHw_Sam_Cmd_SAM_AuthenticateMAM1()

phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticateMAM1 ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bKeyNo,
uint8_t  bKeyVer,
uint8_t pData,
uint8_t  bDataLen,
uint8_t  bPurposeMAM2,
uint8_t **  ppIChallange,
uint16_t pIChallangeLen 
)

Generates 10 bytes of random challange to be given to Tag.

Return values
PH_ERR_SUCCESS_CHAININGOperation successful with chaining status
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpData and pIChallangeLen are NULL.
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 from SAM. One of the following,
  • NVM Key: 0x00 - 0x7F
  • RAM Key: 0xE0 - 0xE3
[in]bKeyVer[In] Key version to be used from SAM.
[in]pData[In] Diversification Input.
[in]bDataLen[In] Length of bytes available in pData buffer.
[in]bPurposeMAM2[In] Purpose MAM 2 data. A 4 bit value.
[out]ppIChallange[Out] The IChallange to be sent to Tag. This will contain 10 bytes of random challange data.
[out]pIChallangeLen[Out] Length of bytes available in ppIChallange buffer.

◆ phhalHw_Sam_Cmd_SAM_AuthenticateMAM2()

phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticateMAM2 ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t pData,
uint8_t  bDataLen,
uint8_t **  ppIResponse,
uint16_t pIResponseLen 
)

Decrypts the TResponse received from Tag and verifies the decrypted data for authenticity.

Also frames the IResponse with will be sent to the Tag.

Return values
PH_ERR_SUCCESSOperation successful
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpData and pIResponseLen are NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pData[In] TResponse received from Tag.
[in]bDataLen[In] Length of bytes available in pData buffer
[out]ppIResponse[Out] The IResponse generated by SAM that will be sent to Tag. This will contain 16 bytes of data.
[out]pIResponseLen[Out] Length of bytes available in ppIResponse buffer.