NXP Reader Library  v17.1.0.2535

Implementation of SAM commands used for Virtual Card and ProximityCheck communication in S Mode. More...

Collaboration diagram for S_Mode:

Modules

 Defines
 Definitions for SAM commands used for Virtual Card and ProximityCheck communication in S Mode.
 

Functions

phStatus_t phhalHw_Sam_Cmd_SAM_SelectVC (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bEncKeyNo, uint8_t bEncKeyVer, uint8_t bMacKeyNo, uint8_t bMacKeyVer, uint8_t *pData, uint8_t bDataLen, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t **ppResponse, uint16_t *pRespLen)
 Performs Virtual card selection based on the response of ISOSelect command. More...
 
phStatus_t phhalHw_Sam_Cmd_SAM_ProximityCheck_Part1 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t *pPPCData, uint8_t bPPCDataLen, uint8_t *pPCData, uint8_t bPCDataLen, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t **ppMac, uint16_t *pMacLen)
 Performs Proximity Check Part 1 command execution. More...
 
phStatus_t phhalHw_Sam_Cmd_SAM_ProximityCheck_Part2 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t *pData, uint8_t bDataLen, uint8_t *pPiccRetCode)
 Performs Proximity Check Part 2 command execution. More...
 

Detailed Description

Implementation of SAM commands used for Virtual Card and ProximityCheck communication in S Mode.

Function Documentation

◆ phhalHw_Sam_Cmd_SAM_SelectVC()

phStatus_t phhalHw_Sam_Cmd_SAM_SelectVC ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t  bEncKeyNo,
uint8_t  bEncKeyVer,
uint8_t  bMacKeyNo,
uint8_t  bMacKeyVer,
uint8_t pData,
uint8_t  bDataLen,
uint8_t pDivInput,
uint8_t  bDivInputLen,
uint8_t **  ppResponse,
uint16_t pRespLen 
)

Performs Virtual card selection based on the response of ISOSelect command.

  • The SAM_SelectVC command is designed to support in S-mode the VC Selection with PCD authentication, that is if the VC is configured for AuthVCMandatory.
  • The AuthVCMandatory configuration is deducted from the presence of a valid FCI (that is: expected 4-bytes TLV headers and payload size) in the response of the PICC ISOSelect command.
  • If the PICC ISOSelect command does not return a FCI or returns an invalid FCI, there is no need to execute SAM_SelectVC
  • The command supports key diversification.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpData, pDivInput and pRespLen is NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Option to update the P1 information. The options can be combined by bitwise oring.
[in]bEncKeyNo[In] KeyID.VCSelectENCKey SAM Key Number.
  • 0x00 - 0x7F: Standard (NVRam) Key
  • 0xE0 - 0xE3: RAM Key
[in]bEncKeyVer[In] KeyID.VCSelectENCKey SAM Key Version.
[in]bMacKeyNo[In] KeyID.VCSelectMACKey SAM Key Number.
  • 0x00 - 0x7F: Standard (NVRam) Key
  • 0xE0 - 0xE3: RAM Key
[in]bMacKeyVer[In] KeyID.VCSelectMACKey SAM Key Version.
[in]pData[In] ISOSelect response payload (32 Bytes) without TLV headers, including the VC related data.
[in]bDataLen[In] Length of bytes available in pData buffer.
[in]pDivInput[In] Diversification Input used to diversify the key.
[in]bDivInputLen[In] Length of bytes available in pDivInput buffer.
[out]ppResponse[Out] Response received from SAM (MAC || VCData)
  • MAC: Response to Challenge as MACt(DivKey(KVCSelMAC)), RndChal || VCData)
  • VCData: Decrypted Virtual Card (VC) Data
[out]pRespLen[Out] Length of bytes available in ppResponse buffer.

◆ phhalHw_Sam_Cmd_SAM_ProximityCheck_Part1()

phStatus_t phhalHw_Sam_Cmd_SAM_ProximityCheck_Part1 ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t  bKeyNo,
uint8_t  bKeyVer,
uint8_t pPPCData,
uint8_t  bPPCDataLen,
uint8_t pPCData,
uint8_t  bPCDataLen,
uint8_t pDivInput,
uint8_t  bDivInputLen,
uint8_t **  ppMac,
uint16_t pMacLen 
)

Performs Proximity Check Part 1 command execution.

Note
Returns
Status code
Return values
PH_ERR_SUCCESS_CHAININGOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpData, pDivInput and pRespLen is NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Use Key Diversification. Instructs SAM to Diversify the Key.
[in]bKeyNo[In] Key number to be used in SAM.
  • 0x00 - 0x7F: Standard (NVRam) Key
  • 0xE0 - 0xE3: RAM Key
[in]bKeyVer[In] Key version to be used in SAM.
[in]pPPCData[In] PICC_PreparePC response data: Option || Pub RespTime [|| PPS1] [|| ActBitRate]
[in]bPPCDataLen[In] Length of bytes available in pPPCData buffer.
[in]pPCData[In] Response and challenge bytes exchanged during the proximity check protocol as (pRndR1 || pRndC1) || ... || (pRndR8 || pRndC8)
[in]bPCDataLen[In] Length of bytes available in pPCData buffer.
[in]pDivInput[In] Diversification Input used to diversify the key.
[in]bDivInputLen[In] Length of bytes available in pDivInput buffer.
[out]ppMac[Out] The MAC to be exchanged to the PICC. MACt (KPC, code || Option || PubRespTime [|| PPS1] || (pRndR1 || pRndC1) ||...|| (pRndR8 || pRndC8))
[out]pMacLen[Out] Length of bytes available in ppMac buffer.

◆ phhalHw_Sam_Cmd_SAM_ProximityCheck_Part2()

phStatus_t phhalHw_Sam_Cmd_SAM_ProximityCheck_Part2 ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t pData,
uint8_t  bDataLen,
uint8_t pPiccRetCode 
)

Performs Proximity Check Part 2 command execution.

Note
This interface should be called only if ProximityCheck Part1 returns Chaining Status.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpData, pDivInput and pPiccRetCode is NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pData[In] The data to be exchaned to SAM hardware.
  • For PICC Error : The PICC error code should be passed and bDataLen should be 1.
  • For PICC Success: The MAC received from PICC should be passed and bDataLen should be 8.
[in]bDataLen[In] Length of bytes available in pData buffer.
[out]pPiccRetCode[Out] The PICC response code echoed back by the SAM.