Implementation of SAM commands used for MIFARE Plus communication in S-Mode. More...

Modules | |
| Defines | |
| Definitions for SAM commands used for MIFARE Plus communication in S-Mode. | |
Functions | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_AuthenticateMFP_Part1 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t *pPDChal, uint8_t bPDChalLen, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t **ppPCDChalResp, uint16_t *pPCDChalRespLen) |
| Perform a MFP Authenticate command part1. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_AuthenticateMFP_Part2 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bPiccErrCode, uint8_t *pPDResp, uint8_t bPDRespLen, uint8_t **ppPDCap2, uint8_t **ppPCDCap2, uint8_t *pPiccReturnCode) |
| Perform a MFP Authenticate command part2. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_AuthSectorSwitchMFP_Part1 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t *pPDChal, uint8_t bPDChalLen, uint16_t wSSKeyBNr, uint8_t bSSKeyNo, uint8_t bSSKeyVer, uint8_t bMSKeyNo, uint8_t bMSKeyVer, uint8_t bSectorCount, uint8_t *pKeyBlocks, uint8_t bKeyBlocksLen, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t **ppPCDChalResp, uint16_t *pPCDChalRespLen) |
| Perform a MFP Sector Switch Authenticate command part1. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_AuthSectorSwitchMFP_Part2 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bPiccErrCode, uint8_t *pPDResp, uint8_t bPDRespLen, uint8_t *pPiccReturnCode) |
| Perform a MFP Sector Switch Authenticate Authenticate command part2. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_AuthenticatePDC_Part1 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t *pPDChal, uint8_t bPDChalLen, uint8_t *pUpgradeInfo, uint8_t bLen, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t **ppPCDChalResp, uint16_t *pPCDChalRespLen) |
| Perform a Post delivery configuration Authenticate command part1. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_AuthenticatePDC_Part2 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bPiccErrCode, uint8_t *pPDResp, uint8_t bPDRespLen, uint8_t *pPiccReturnCode) |
| Perform a Post delivery configuration Authenticate command part2. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_CombinedReadMFP (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bLFI, uint16_t wOption, uint8_t *pData, uint8_t bDataLen, uint8_t **ppOutput, uint16_t *pOutputLen, uint8_t *pPiccReturnCode) |
| Perform a MIFARE Plus Combined Read command. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_CombinedWriteMFP (phhalHw_Sam_DataParams_t *pDataParams, uint16_t wOption, uint8_t *pData, uint8_t bDataLen, uint8_t **ppOutput, uint16_t *pOutputLen, uint8_t *pPiccReturnCode) |
| Perform a MFP CombinedWrite command. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_ChangeKeyMFP (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t *pData, uint8_t bDataLen, uint8_t **ppProtectedData, uint16_t *pProtectedDataLen, uint8_t *pPiccReturnCode) |
| Prepare the MFP Change Key command. More... | |
Implementation of SAM commands used for MIFARE Plus communication in S-Mode.
| phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticateMFP_Part1 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t | bKeyNo, | ||
| uint8_t | bKeyVer, | ||
| uint8_t * | pPDChal, | ||
| uint8_t | bPDChalLen, | ||
| uint8_t * | pDivInput, | ||
| uint8_t | bDivInputLen, | ||
| uint8_t ** | ppPCDChalResp, | ||
| uint16_t * | pPCDChalRespLen | ||
| ) |
Perform a MFP Authenticate command part1.
This command will generate a 16 byte random number with the one received from PICC and return an 32 byte encrypted data which will be sent to PICC.
| PH_ERR_SUCCESS_CHAINING | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pPDChal, pDivInput and pPCDChalRespLen are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOption | [In] Key diversification & authentication mode selection. Option to update the P1 information. The options can be combined by bitwise oring.
|
| [in] | bKeyNo | [In] Key number to be used from SAM. One of the following,
|
| [in] | bKeyVer | [In] Key version to be used from SAM. |
| [in] | pPDChal | [In] Buffer containing the challange generated by the PICC. E(Kx,RndB) (16 bytes). |
| [in] | bPDChalLen | [In] Length of bytes available in pPDChal buffer. |
| [in] | pDivInput | [In] Diversification Input used to diversify the key.
|
| [in] | bDivInputLen | [In] Length of bytes available in pDivInput buffer. |
| [out] | ppPCDChalResp | [Out] Buffer containing the PCD challenge response to be sent to PICC. Challenge response as E(Kx, RndA || RndB') |
| [out] | pPCDChalRespLen | [Out] Length of bytes available in ppPCDChalResp buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticateMFP_Part2 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bPiccErrCode, | ||
| uint8_t * | pPDResp, | ||
| uint8_t | bPDRespLen, | ||
| uint8_t ** | ppPDCap2, | ||
| uint8_t ** | ppPCDCap2, | ||
| uint8_t * | pPiccReturnCode | ||
| ) |
Perform a MFP Authenticate command part2.
This command will decrypt the response received from PICC and will return the PC capabilities and PCD capabilites.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PHHAL_HW_SAM_ERR_MIFARE_PLUS_GEN | In case of PICC Error exchanged. |
| PH_ERR_INVALID_PARAMETER | pPDResp and pPiccReturnCode are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bPiccErrCode | [In] Error Code sent by the MIFARE Plus PICC. For success it should be 0x90. |
| [in] | pPDResp | [In] Buffer containing the input received from PICC.
|
| [in] | bPDRespLen | [In] Length of bytes available in pPDResp buffer. |
| [out] | ppPDCap2 | [Out] Buffer containing the Output PCD capabilities. This will be of 6 bytes. |
| [out] | ppPCDCap2 | [Out] Buffer containing the Output PD capabilities. This will be of 6 bytes. |
| [out] | pPiccReturnCode | [Out] Error code returned by MIFARE Plus PICC. This will of 1 byte in length. |
| phStatus_t phhalHw_Sam_Cmd_SAM_AuthSectorSwitchMFP_Part1 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t * | pPDChal, | ||
| uint8_t | bPDChalLen, | ||
| uint16_t | wSSKeyBNr, | ||
| uint8_t | bSSKeyNo, | ||
| uint8_t | bSSKeyVer, | ||
| uint8_t | bMSKeyNo, | ||
| uint8_t | bMSKeyVer, | ||
| uint8_t | bSectorCount, | ||
| uint8_t * | pKeyBlocks, | ||
| uint8_t | bKeyBlocksLen, | ||
| uint8_t * | pDivInput, | ||
| uint8_t | bDivInputLen, | ||
| uint8_t ** | ppPCDChalResp, | ||
| uint16_t * | pPCDChalRespLen | ||
| ) |
Perform a MFP Sector Switch Authenticate command part1.
This command will generate a 16 byte random number with the one received from PICC and return an 32 byte encrypted data which will be sent to PICC.
| PH_ERR_SUCCESS_CHAINING | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pPDChal, pDivInput and pPCDChalRespLen are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOption | [In] Key diversification selection. Option to update the P1 information. The options can be combined by bitwise oring.
|
| [in] | pPDChal | [In] Buffer containing the challange generated by the PICC. PICC challenge as E ( Kn , ..., E ( K_1 , E ( Kss , RndB))...) |
| [in] | bPDChalLen | [In] Length of bytes available in pPDChal buffer. |
| [in] | wSSKeyBNr | [In] PICC Sector Switch key block number to be used for authentication. |
| [in] | bSSKeyNo | [In] Sector Switch Key number to be used from SAM (that is: Kss selection). One of the following,
|
| [in] | bSSKeyVer | [In] Sector Switch Key version to be used from SAM (that is: Kss selection) |
| [in] | bMSKeyNo | [In] Master Key number to be used from SAM One of the following,
|
| [in] | bMSKeyVer | [In] Master Key version to be used from SAM. |
| [in] | bSectorCount | [In] Number of sectors to be switched inside the PICC.
|
| [in] | pKeyBlocks | [In] Buffer containing the PICC KeyB block number and reference key number and version to be used form SAM. Should contain the following,
|
| [in] | bKeyBlocksLen | [In] Length of bytes available in pKeyBlocks buffer. It should be equal to (KeyBxBNr + [KeyNo] + [KeyVer]) * bSectorCount |
| [in] | pDivInput | [In] Buffer containing the diversification inputs to be used for diversifying the key.
|
| [in] | bDivInputLen | [In] Length of bytes available in pDivInput buffer. |
| [out] | ppPCDChalResp | [Out] Buffer containing the PCD challenge response to be sent to PICC. Challenge response as E ( K_n , ..., E ( K_1 , E ( Kss, RndA || RndB'))...) |
| [out] | pPCDChalRespLen | [Out] Length of bytes available in ppPCDChalResp buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_AuthSectorSwitchMFP_Part2 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bPiccErrCode, | ||
| uint8_t * | pPDResp, | ||
| uint8_t | bPDRespLen, | ||
| uint8_t * | pPiccReturnCode | ||
| ) |
Perform a MFP Sector Switch Authenticate Authenticate command part2.
This command will decrypt the response received from PICC and will return success status if the challanges matches.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pPDResp and pPiccReturnCode are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bPiccErrCode | [In] Error Code sent by the MFP PICC. For success it should be 0x90. |
| [in] | pPDResp | [In] Buffer containing the input received from PICC. PICC challenge response as E(Kn, ..., E(K1, E(Kss, RndA'))...) |
| [in] | bPDRespLen | [In] Length of bytes available in pPDResp buffer. |
| [out] | pPiccReturnCode | [Out] Error code returned by MIFARE Plus PICC. This will of 1 byte in length. |
| phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticatePDC_Part1 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t | bKeyNo, | ||
| uint8_t | bKeyVer, | ||
| uint8_t * | pPDChal, | ||
| uint8_t | bPDChalLen, | ||
| uint8_t * | pUpgradeInfo, | ||
| uint8_t | bLen, | ||
| uint8_t * | pDivInput, | ||
| uint8_t | bDivInputLen, | ||
| uint8_t ** | ppPCDChalResp, | ||
| uint16_t * | pPCDChalRespLen | ||
| ) |
Perform a Post delivery configuration Authenticate command part1.
This command will generate a 16 byte random number with the one received from PICC and return an 32 byte encrypted data which will be sent to PICC.
| PH_ERR_SUCCESS_CHAINING | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pPDChal, pUpgradeInfo, pDivInput and pPCDChalRespLen are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOption | [In] Key diversification selection. Option to set the P1 information byte.
|
| [in] | bKeyNo | [In] Key number to be used from SAM. One of the following,
|
| [in] | bKeyVer | [In] Key version to be used from SAM. |
| [in] | pPDChal | [In] Buffer containing the challange generated by the PICC. Authentication message from the PICC as E ( DivKey (Kx), RndB) |
| [in] | bPDChalLen | [In] Length of bytes available in pPDChal buffer. |
| [in] | pUpgradeInfo | [In] Upgrade information of the target product state. |
| [in] | bLen | [In] Length of bytes available in pUpgradeInfo buffer.
|
| [in] | pDivInput | [In] Diversification input for generating KeyID.ICUpgrade Key , ie.: VCUID. |
| [in] | bDivInputLen | [In] Length of bytes available in pDivInput buffer. |
| [out] | ppPCDChalResp | [Out] Buffer containing the PCD challenge response to be sent to PICC. Challenge response as E ( DivKey (Kx), RndA || RndB') |
| [out] | pPCDChalRespLen | [Out] Length of bytes available in ppPCDChalResp buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticatePDC_Part2 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bPiccErrCode, | ||
| uint8_t * | pPDResp, | ||
| uint8_t | bPDRespLen, | ||
| uint8_t * | pPiccReturnCode | ||
| ) |
Perform a Post delivery configuration Authenticate command part2.
This command will decrypt the response received from PICC and will return success status if the challanges matches.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pPDResp and pPiccReturnCode are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bPiccErrCode | [In] Error Code sent by the MIFARE Plus PICC. For success it should be 0x90. |
| [in] | pPDResp | [In] Buffer containing the input received from PICC. PICC authentication response as E ( DivKey (Kx), RndA') |
| [in] | bPDRespLen | [In] Length of bytes available in pPDResp buffer. |
| [out] | pPiccReturnCode | [Out] Error code returned by MIFARE Plus PICC. This will of 1 byte in length. |
| phStatus_t phhalHw_Sam_Cmd_SAM_CombinedReadMFP | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bLFI, | ||
| uint16_t | wOption, | ||
| uint8_t * | pData, | ||
| uint8_t | bDataLen, | ||
| uint8_t ** | ppOutput, | ||
| uint16_t * | pOutputLen, | ||
| uint8_t * | pPiccReturnCode | ||
| ) |
Perform a MIFARE Plus Combined Read command.
This command is used to perform GetVersion, ReadSignature and all Read related operations.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pData, pOutputLen and pPiccReturnCode are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bLFI | [In] Last Frame Indication (LFI). Option for updating the P2 information of Sam frame. |
| [in] | wOption | [In] Buffering options and Paload Type, for exchanging information to SAM. The options can be combined by bitwise oring.
|
| [in] | pData | [In] The data to be sent to SAM. Should be one of the following.
|
| [in] | bDataLen | [In] Length of bytes available in pData buffer. |
| [out] | ppOutput | [Out] The complete information received from SAM. This will be information that will be exchagned with PICC. One of the following.
|
| [out] | pOutputLen | [Out] Length bytes available in ppOutput buffer. |
| [out] | pPiccReturnCode | [Out] Error code returned by MIFARE Plus PICC. This will of 1 byte in length. |
| phStatus_t phhalHw_Sam_Cmd_SAM_CombinedWriteMFP | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint16_t | wOption, | ||
| uint8_t * | pData, | ||
| uint8_t | bDataLen, | ||
| uint8_t ** | ppOutput, | ||
| uint16_t * | pOutputLen, | ||
| uint8_t * | pPiccReturnCode | ||
| ) |
Perform a MFP CombinedWrite command.
This command is common for Write, WriteValue, Increment, Decrement, IncrementTransfer, DecrementTransfer, Transfer and Restore.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pData, pOutputLen and pPiccReturnCode are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | wOption | [In] Buffering options and Paload Type, for exchanging information to SAM. The options can be combined by bitwise oring.
|
| [in] | pData | [In] The data to be sent to SAM. Should be one of the following,
|
| [in] | bDataLen | [In] Length of bytes available in pData buffer. |
| [out] | ppOutput | [Out] The complete information received from SAM. This will be information that will be exchagned with PICC. One of the following.
|
| [out] | pOutputLen | [Out] Length bytes available in ppOutput buffer. |
| [out] | pPiccReturnCode | [Out] Error code returned by MIFARE Plus PICC. This will of 1 byte in length. |
| phStatus_t phhalHw_Sam_Cmd_SAM_ChangeKeyMFP | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t * | pData, | ||
| uint8_t | bDataLen, | ||
| uint8_t ** | ppProtectedData, | ||
| uint16_t * | pProtectedDataLen, | ||
| uint8_t * | pPiccReturnCode | ||
| ) |
Prepare the MFP Change Key command.
This command will return the protected data to be written to PICC.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pData, pProtectedDataLen and pPiccReturnCode are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bOption | [In] The below flags should be for updating the P1 information byte.
|
| [in] | pData | [In] The information to be exchanged to Sam.
|
| [in] | bDataLen | [In] Length of bytes available in pData buffer. |
| [out] | ppProtectedData | [Out] The complete information received from SAM. This will be information that will be exchagned with PICC. One of the following.
|
| [out] | pProtectedDataLen | [Out] Length of bytes available in ppProtectedData buffer. |
| [out] | pPiccReturnCode | [Out] Error code returned by MIFARE Plus PICC. This will of 1 byte in length. |