NXP Reader Library  v17.1.0.2535

Implementation of SAM commands used for MIFARE Ultralight communication in X-Mode. More...

Collaboration diagram for X_Mode:

Modules

 Defines
 Definitions for SAM commands used for MIFARE Ultralight communication in X-Mode.
 

Functions

phStatus_t phhalHw_Sam_Cmd_UL_PwdAuthPICC (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t *pStatusCode)
 The UL_PwdAuthPICC supports the X-mode procedure to perform the Password Authentication on the MIFARE Ultralight EV1 PICC. More...
 
phStatus_t phhalHw_Sam_Cmd_UL_AuthenticatePICC (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t *pStatusCode)
 Performs AuthenticatePICC command execution in X mode. More...
 
phStatus_t phhalHw_Sam_Cmd_MF_Read (phhalHw_Sam_DataParams_t *pDataParams, uint8_t *pBlocks, uint8_t bBlocksLen, uint8_t **ppData, uint16_t *pDataLen)
 Perform a MIFARE Ultralight Read command in X mode. More...
 
phStatus_t phhalHw_Sam_Cmd_MF_Write (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t *pData, uint8_t bDataLen)
 Perform a MIFARE Ultralight Write command in X mode. More...
 
phStatus_t phhalHw_Sam_Cmd_UL_SMExchange (phhalHw_Sam_DataParams_t *pDataParams, uint8_t *pData, uint8_t bDataLen, uint8_t **ppResponse, uint16_t *pRespLen)
 The UL_SMExchange command is used to apply the MIFARE Ultralight AES CMAC-based secure messaging in X-mode on PICC commands. More...
 

Detailed Description

Implementation of SAM commands used for MIFARE Ultralight communication in X-Mode.

Function Documentation

◆ phhalHw_Sam_Cmd_UL_PwdAuthPICC()

phStatus_t phhalHw_Sam_Cmd_UL_PwdAuthPICC ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bKeyNo,
uint8_t  bKeyVer,
uint8_t pDivInput,
uint8_t  bDivInputLen,
uint8_t pStatusCode 
)

The UL_PwdAuthPICC supports the X-mode procedure to perform the Password Authentication on the MIFARE Ultralight EV1 PICC.

The command generates the password and password acknowledgment bytes and performs the password authentication with the MIFARE Ultralight EV1 PICC. Finally, the command compares the generated password acknowledgment bytes with the PACK bytes returned from the MIFARE Ultralight EV1 PICC.

Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpDivInput and pStatusCode 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]pDivInput[In] Diversification input for key diversification. (1 to 31 byte(s) input).
[in]bDivInputLen[In] Length of bytes available in pDivInput buffer.
[out]pStatusCode[Out] Status code returned by PICC.

◆ phhalHw_Sam_Cmd_UL_AuthenticatePICC()

phStatus_t phhalHw_Sam_Cmd_UL_AuthenticatePICC ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t  bKeyNo,
uint8_t  bKeyVer,
uint8_t pDivInput,
uint8_t  bDivInputLen,
uint8_t pStatusCode 
)

Performs AuthenticatePICC command execution in X mode.

Includes the header, Key number, Key Version,Diversification input based on bOption parameter.

Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpDivInput and pStatusCode are NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Options for Key diversification selection and Exchanging LE to SAM. The options can be combined by bitwise OR.
[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]pDivInput[In] Diversification input for key diversification. (1 to 15 byte(s) input).
[in]bDivInputLen[In] Length of bytes available in pDivInput buffer.
[out]pStatusCode[Out] Status code returned by PICC.

◆ phhalHw_Sam_Cmd_MF_Read()

phStatus_t phhalHw_Sam_Cmd_MF_Read ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t pBlocks,
uint8_t  bBlocksLen,
uint8_t **  ppData,
uint16_t pDataLen 
)

Perform a MIFARE Ultralight Read command in X mode.

  • In X-mode, MF_Read reads blocks of a MIFARE Ultralight or MIFARE Ultralight C card in plain and return the data. The MIFARE SAM AV4 constructs the READ command (Cmd 0x30) and sends it to the card.
  • If more than one block address is issued, the MIFARE SAM AV4 accesses the blocks in the same order as addresses listed in the command data field. The order of the returned data is the same as the order of addresses in the data field.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpBlocks and pDataLen are NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pBlocks[In] The block numbers from where the data should be read. Should be holding an array of block numbers like BNR_1, BNR_2, BNR_3, ..., BNR_N
[in]bBlocksLen[In] Length pf bytes available in pBlocks parameter.
[out]ppData[Out] Data returned by Sam.
[out]pDataLen[Out] Length pf bytes available in ppData parameter.

◆ phhalHw_Sam_Cmd_MF_Write()

phStatus_t phhalHw_Sam_Cmd_MF_Write ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t pData,
uint8_t  bDataLen 
)

Perform a MIFARE Ultralight Write command in X mode.

  • In X-mode, MF_Write writes one or several blocks a MIFARE Ultralight or MIFARE Ultralight C card . The command supports writing 16 bytes or 4 bytes plain. The length can be selected by bit 0 of parameter byte P2. If 4 byte data blocks is chosen, the MIFARE SAM AV4 constructs the WRITE command (Cmd 0xA2). If 16 byte data blocks, the COMPATIBILITY_WRITE(Cmd 0xA0) is used.
  • If more than one block is written, the MIFARE SAM AV4 accesses the blocks in the same order as addresses listed in the command data field.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpData is NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] One of the below options. For Updating the P1 information byte.
[in]pData[In] Buffer containing the Block and Data pair to be written . to card by Sam hardware. Should be holding an array of block number and data like.
BNR_1 + Data, BNR_2 + Data, BNR_3 + Data, ..., BNR_N + Data
Data could be 4 bytes or 16 bytes depending on the option specified.
[in]bDataLen[In] Length pf bytes available in pData parameter.

◆ phhalHw_Sam_Cmd_UL_SMExchange()

phStatus_t phhalHw_Sam_Cmd_UL_SMExchange ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t pData,
uint8_t  bDataLen,
uint8_t **  ppResponse,
uint16_t pRespLen 
)

The UL_SMExchange command is used to apply the MIFARE Ultralight AES CMAC-based secure messaging in X-mode on PICC commands.

  • The user is responsible for providing the plain command data including the PICC command code, and if applicable additional parameters and data.
  • Supports the following command or MIFARE Ultralight AES product.
    • GET_VERSION
    • READ
    • FAST_READ
    • WRITE
    • READ_CNT
    • INCR_CNT
    • READ_SIG
    • WRITE_SIG
    • LOCK_SIG
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpData and pRespLen are NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pData[In] Plain command data of PICC. SAM will apply SM and exchange to PICC.
[in]bDataLen[In] Length pf bytes available in pData parameter.
[out]ppResponse[Out] Plain Data returned by Sam.
[out]pRespLen[Out] Length pf bytes available in ppResponse parameter.