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

Modules | |
| Defines | |
| Definitions for SAM commands used for MIFARE DESFire communication in S-Mode. | |
Functions | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_AuthenticatePICC_Part1 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t bAuthMode, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t *pCardResponse, uint8_t bCardRespLen, uint8_t **ppSamResponse, uint16_t *pSamRespLen) |
| Performs first part of encryption and decryption of data received from PICC and to be sent to PICC. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_AuthenticatePICC_Part2 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bPiccErrorCode, uint8_t *pCardResponse, uint8_t bCardRespLen, uint8_t *pPDcap2, uint8_t *pPCDcap2, uint8_t *pStatusCode) |
| Performs second part of decryption of data received from PICC. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_IsoAuthenticatePICC_Part1 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t *pCardResponse, uint8_t bCardRespLen, uint8_t **ppSamResponse, uint16_t *pSamRespLen) |
| Performs first part of encryption and decryption of data received from PICC and to be sent to PICC. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_IsoAuthenticatePICC_Part2 (phhalHw_Sam_DataParams_t *pDataParams, uint8_t *pCardResponse, uint8_t bCardRespLen) |
| Performs second part of decryption of data received from PICC. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_ChangeKeyPICC (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bCryptoMethod, uint8_t bConfig, uint8_t bKeySetNo, uint8_t bDFKeyNo, uint8_t bCurrKeyNo, uint8_t bCurrKeyVer, uint8_t bNewKeyNo, uint8_t bNewKeyVer, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t **ppSamResponse, uint16_t *pSamRespLen) |
| Performs key change for the specified current key to a new key. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_CreateTMFilePICC (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t bFileNo, uint8_t bFileOption, uint8_t *pAccessRights, uint8_t *pTMIExclFileMap, uint8_t bTMKeyOptions, uint8_t bTSIGKeyNo, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t **ppSamResponse, uint16_t *pSamRespLen) |
| The SAM_CreateTMFilePICC command supports the procedure to create a Transaction MAC File in the PICC in S-mode from a key stored in the SAM. More... | |
Implementation of SAM commands used for MIFARE DESFire communication in S-Mode.
| phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticatePICC_Part1 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t | bKeyNo, | ||
| uint8_t | bKeyVer, | ||
| uint8_t | bAuthMode, | ||
| uint8_t * | pDivInput, | ||
| uint8_t | bDivInputLen, | ||
| uint8_t * | pCardResponse, | ||
| uint8_t | bCardRespLen, | ||
| uint8_t ** | ppSamResponse, | ||
| uint16_t * | pSamRespLen | ||
| ) |
Performs first part of encryption and decryption of data received from PICC and to be sent to PICC.
Here the Encrypted RndB data will be sent to SAM. SAM will Decrypt the data and Encrypt RndA with RndB'. This encrypted RndA and RndB' will be returned to the caller for further transmission to the PICC.
| PH_ERR_SUCCESS_CHAINING | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pDivInput, pCardResponse and pSamRespLen are NULL. |
| Other | Depending on implementation and underlaying component. |
| [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 OR.
|
| [in] | bKeyNo | [In] Key number to be used in SAM or DESFire Key number.
|
| [in] | bKeyVer | [In] Key version to be used in SAM. |
| [in] | bAuthMode | [In] The type of key to be used for EV2 authentication. |
| [in] | pDivInput | [In] Diversification Input used to diversify the key.
|
| [in] | bDivInputLen | [In] Length of bytes available in pDivInput buffer. |
| [in] | pCardResponse | [In] Encrypted Challenge (RndB) data returned by the PICC.
|
| [in] | bCardRespLen | [In] Length of bytes available in pCardResponse buffer. |
| [out] | ppSamResponse | [Out] Encrypted PCD Challenge (RndA and RndB') returned by the SAM. One of the following will be available,
|
| [out] | pSamRespLen | [Out] Length of bytes available in ppSamResponse buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_AuthenticatePICC_Part2 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bPiccErrorCode, | ||
| uint8_t * | pCardResponse, | ||
| uint8_t | bCardRespLen, | ||
| uint8_t * | pPDcap2, | ||
| uint8_t * | pPCDcap2, | ||
| uint8_t * | pStatusCode | ||
| ) |
Performs second part of decryption of data received from PICC.
Here the Encrypted RndA' data will be sent to SAM. SAM will Decrypt the data and extract PCD and PD Capabilities for EV2 First Auth and null in case of rest of Authentication modes. This PCD and PD information will be returned to the caller. Also the status code of PICC will be returned to the caller in case of error.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pCardResponse, pPDcap2 pPCDcap2 and pPiccRetCode are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bPiccErrorCode | [In] Status code returned by the PICC in case of failure else 00h for success. |
| [in] | pCardResponse | [In] Encrypted RndA' returned by the SAM. One of the following,
|
| [in] | bCardRespLen | [In] Length of bytes available in pCardResponse buffer. |
| [out] | pPDcap2 | [Out] Buffer containing the output PD capabilities. This will contain 6 bytes of PD information, if targeting EVx authentication type and first authentication. |
| [out] | pPCDcap2 | [Out] Buffer containing the output PCD capabilities. This will contain 6 bytes of PCD information, if targeting EVx authentication type and first authentication. |
| [out] | pStatusCode | [Out] Status code from MIFARE DESFire PICC if available else zero. |
| phStatus_t phhalHw_Sam_Cmd_SAM_IsoAuthenticatePICC_Part1 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t | bKeyNo, | ||
| uint8_t | bKeyVer, | ||
| uint8_t * | pDivInput, | ||
| uint8_t | bDivInputLen, | ||
| uint8_t * | pCardResponse, | ||
| uint8_t | bCardRespLen, | ||
| uint8_t ** | ppSamResponse, | ||
| uint16_t * | pSamRespLen | ||
| ) |
Performs first part of encryption and decryption of data received from PICC and to be sent to PICC.
Here the Encrypted RndB data will be sent to SAM. SAM will Decrypt the data and Encrypt RndA with RndB'. This encrypted RndA and RndB' will be returned to the caller for further transmission to the PICC.
| PH_ERR_SUCCESS_CHAINING | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pDivInput, pCardResponse and pSamRespLen are NULL. |
| Other | Depending on implementation and underlaying component. |
| [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 OR.
|
| [in] | bKeyNo | [In] Key number to be used in SAM or DESFire Key number.
|
| [in] | bKeyVer | [In] Key version to be used in SAM. |
| [in] | pDivInput | [In] Diversification Input used to diversify the key.
|
| [in] | bDivInputLen | [In] Length of bytes available in pDivInput buffer. |
| [in] | pCardResponse | [In] PICC challenge in clear as received from PICC's Cmd.ISOGetChallenge.
|
| [in] | bCardRespLen | [In] Length of bytes available in pCardResponse buffer. |
| [out] | ppSamResponse | [Out] Encrypted PCD Challenge (RndA and RndB') and response returned by the SAM. One of the following will be available.
|
| [out] | pSamRespLen | [Out] Length of bytes available in ppSamResponse buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_IsoAuthenticatePICC_Part2 | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t * | pCardResponse, | ||
| uint8_t | bCardRespLen | ||
| ) |
Performs second part of decryption of data received from PICC.
Here the Encrypted RndA' data will be sent to SAM. SAM will Decrypt the data and extract PCD and PD Capabilities for EV2 First Auth and null in case of rest of Authentication modes. This PCD and PD information will be returned to the caller. Also the status code of PICC will be returned to the caller in case of error.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pCardResponse is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | pCardResponse | [In] PICC encrypted response as received from Cmd.ISOInternalAuthenticate. One of the following,
|
| [in] | bCardRespLen | [In] Length of bytes available in pCardResponse buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_ChangeKeyPICC | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bCryptoMethod, | ||
| uint8_t | bConfig, | ||
| uint8_t | bKeySetNo, | ||
| uint8_t | bDFKeyNo, | ||
| uint8_t | bCurrKeyNo, | ||
| uint8_t | bCurrKeyVer, | ||
| uint8_t | bNewKeyNo, | ||
| uint8_t | bNewKeyVer, | ||
| uint8_t * | pDivInput, | ||
| uint8_t | bDivInputLen, | ||
| uint8_t ** | ppSamResponse, | ||
| uint16_t * | pSamRespLen | ||
| ) |
Performs key change for the specified current key to a new key.
The crypto operation of the key to be changed will be calculated by SAM hardware. This crypto data will then sent to card to perform Change Key operations.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pDivInput and pSamRespLen are NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bCryptoMethod | [In] Key compilation method. Options for P1 information byte. The options can be combined by bitwise OR.
|
| [in] | bConfig | [In] Options for P2 information byte. The options can be combined by bitwise OR.
|
| [in] | bKeySetNo | [In] If bConfig = Cmd.ChangeKeyEV2, Key set number to which the key to be changed belongs to. |
| [in] | bDFKeyNo | [In] Block number of the key available in the PICC. This will be used while exchanging the command with PICC.
|
| [in] | bCurrKeyNo | [In] Number of key entry holding the current key in SAM.
|
| [in] | bCurrKeyVer | [In] Key version of the current key in SAM. |
| [in] | bNewKeyNo | [In] Number of key entry holding the new key in SAM.
|
| [in] | bNewKeyVer | [In] Key version of new key in SAM. |
| [in] | pDivInput | [In] Diversification Input used to diversify the key.
|
| [in] | bDivInputLen | [In] Length of bytes available in pDivInput buffer. |
| [out] | ppSamResponse | [Out] Cryptogram holding key data. |
| [out] | pSamRespLen | [Out] Length of bytes available in ppSamResponse buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_CreateTMFilePICC | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bOption, | ||
| uint8_t | bKeyNo, | ||
| uint8_t | bKeyVer, | ||
| uint8_t | bFileNo, | ||
| uint8_t | bFileOption, | ||
| uint8_t * | pAccessRights, | ||
| uint8_t * | pTMIExclFileMap, | ||
| uint8_t | bTMKeyOptions, | ||
| uint8_t | bTSIGKeyNo, | ||
| uint8_t * | pDivInput, | ||
| uint8_t | bDivInputLen, | ||
| uint8_t ** | ppSamResponse, | ||
| uint16_t * | pSamRespLen | ||
| ) |
The SAM_CreateTMFilePICC command supports the procedure to create a Transaction MAC File in the PICC in S-mode from a key stored in the SAM.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pAccessRights, pDivInput and pSamRespLen 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. Options for P1 information byte. |
| [in] | bKeyNo | [In] Key number to be used in SAM. One of the following
|
| [in] | bKeyVer | [In] Key version to be used in SAM. |
| [in] | bFileNo | [In] File number of the file to be created. |
| [in] | bFileOption | [In] Options for the targeted file.
|
| [in] | pAccessRights | [In] Access conditions to be applied for the file. Refer respective product DataSheet for access rights information. This should be two bytes long. |
| [in] | pTMIExclFileMap | [In] TMI exclusion FileMap. Should be 4 byte. |
| [in] | bTMKeyOptions | [In] Option for the TransactionMAC Key.
|
| [in] | bTSIGKeyNo | [In] Key Number pointing to AppTransactionSIGKey. |
| [in] | pDivInput | [In] Diversification Input used to diversify the key. |
| [in] | bDivInputLen | [In] Length of bytes available in pDivInput buffer. |
| [out] | ppSamResponse | [Out] Cryptogram holding Transaction MAC Key data. |
| [out] | pSamRespLen | [Out] Length of bytes available in ppSamResponse buffer. |