Implementation of SAM Key Management commands. More...

Modules | |
| Defines | |
| Definitions for SAM Key Management commands. | |
Functions | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_ChangeKeyEntry (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bKeyNo, uint8_t bProMas, uint8_t *pKeyData, uint8_t bKeyDataLen) |
| Change a symmetric key entry in the key table of the SAM. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_ChangeKeyEntryOffline (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bKeyNo, uint8_t bProMas, uint16_t wChangeCtr, uint8_t *pOfflineCrypto, uint8_t bOfflineCryptoLen, uint8_t bEnableOfflineAck, uint8_t **ppOfflineAck, uint16_t *pOfflineAckLen) |
| Change a Offline symmetric key entry in the key entry table of the SAM. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_ChangeKUCEntry (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bKucNo, uint8_t bProMas, uint8_t *pKucData, uint8_t bKucDataLen) |
| Change the key usage counter (KUC). More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_ChangeKUCEntryOffline (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bKucNo, uint8_t bProMas, uint16_t wChangeCtr, uint8_t *pOfflineCrypto, uint8_t bOfflineCryptoLen, uint8_t bEnableOfflineAck, uint8_t **ppOfflineAck, uint16_t *pOfflineAckLen) |
| Change a Offline KUC entry in the key entry table of the SAM. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_DisableKeyEntry (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bKeyNo) |
| Disable a key entry. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_DisableKeyEntryOffline (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bKeyNo, uint16_t wChangeCtr, uint8_t *pOfflineCrypto, uint8_t bOfflineCryptoLen, uint8_t bEnableOfflineAck, uint8_t **ppOfflineAck, uint16_t *pOfflineAckLen) |
| Disable a key entry using offline cryptogram. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_EncipherKeyEntry (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bPersoKeyNo, uint8_t bKeyNo, uint8_t bOption, uint16_t wPersoCtr, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t **ppOfflineCrypto, uint16_t *pOfflineCryptoLen) |
| The SAM_EncipherKeyEntry is a Personalization SAM command used to prepare a cryptogram (according to Offline change protection) for the OfflineChange key on a target SAM. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_GetKeyEntry (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bKeyNo, uint8_t bMode, uint8_t **ppKeyEntry, uint16_t *pKeyEntryLen) |
| Get information about a key entry. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_GetKUCEntry (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bKucNo, uint8_t **ppKucEntry, uint16_t *pKucEntryLen) |
| Get information about a key usage counter (KUC). More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_DumpSessionKey (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bDumpMode, uint8_t **ppSessionKey, uint16_t *pSessionKeyLen) |
| Dump the current session key. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_DumpSecretKey (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bDumpMode, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t *pDivInput, uint8_t bDivInputLen, uint8_t **ppSecretKey, uint16_t *pSecretKeyLen) |
| Retrive a PICC or OfflineCrypto key stored in the key table. More... | |
| phStatus_t | phhalHw_Sam_Cmd_SAM_DeriveKey (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bSrcKeyNo, uint8_t bSrcKeyVer, uint8_t bDstKeyNo, uint8_t *pDeriveIn, uint8_t bDeriveInLen) |
| Is used to derive a key from a source key (in other contexts often called master key) based on a CMAC operation. More... | |
Implementation of SAM Key Management commands.
| phStatus_t phhalHw_Sam_Cmd_SAM_ChangeKeyEntry | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bKeyNo, | ||
| uint8_t | bProMas, | ||
| uint8_t * | pKeyData, | ||
| uint8_t | bKeyDataLen | ||
| ) |
Change a symmetric key entry in the key table of the SAM.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pKeyData is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bKeyNo | [In] Reference number of the key entry to be changed. One of the following,
|
| [in] | bProMas | [In] Program mask indicating the fields that should be changed. All the below option can be combined by using bitwise OR operator.
|
| [in] | pKeyData | [In] Buffer containing the key data information to be updated. |
| [in] | bKeyDataLen | [In] Length of bytes available in pKeyData buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_ChangeKeyEntryOffline | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bKeyNo, | ||
| uint8_t | bProMas, | ||
| uint16_t | wChangeCtr, | ||
| uint8_t * | pOfflineCrypto, | ||
| uint8_t | bOfflineCryptoLen, | ||
| uint8_t | bEnableOfflineAck, | ||
| uint8_t ** | ppOfflineAck, | ||
| uint16_t * | pOfflineAckLen | ||
| ) |
Change a Offline symmetric key entry in the key entry table of the SAM.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pOfflineCrypto and pOfflineAck is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bKeyNo | [In] Reference number of the key entry to be changed. One of the following,
|
| [in] | bProMas | [In] Program mask indicating the fields that should be changed. All the below option can be combined by using bitwise OR operator.
|
| [in] | wChangeCtr | [In] Change Counter to avoid replay attacks. |
| [in] | pOfflineCrypto | [In] Offline Cryptogram exchanged to SAM (EncKeyEntry + OfflineMAC)
|
| [in] | bOfflineCryptoLen | [In] Length of bytes available in pOfflineCrypto buffer |
| [in] | bEnableOfflineAck | [In] To Enable reception of Offline Acknowledge
|
| [out] | ppOfflineAck | [Out] Offline Acknowledge information received from SAM. Will be based on
|
| [out] | pOfflineAckLen | [Out] Length of bytes available in ppOfflineAck buffer |
| phStatus_t phhalHw_Sam_Cmd_SAM_ChangeKUCEntry | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bKucNo, | ||
| uint8_t | bProMas, | ||
| uint8_t * | pKucData, | ||
| uint8_t | bKucDataLen | ||
| ) |
Change the key usage counter (KUC).
Selection is done by its reference number.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pKucData is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bKucNo | [In] Reference number of the key usage counter to be updated (00h to 0Fh). |
| [in] | bProMas | [In] Program mask indicating the fields that should be changed. All the below option can be combined by using bitwise OR operator. |
| [in] | pKucData | [In] Buffer containing the Key Usage Counter data. |
| [in] | bKucDataLen | [In] Length of bytes available in pKucData buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_ChangeKUCEntryOffline | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bKucNo, | ||
| uint8_t | bProMas, | ||
| uint16_t | wChangeCtr, | ||
| uint8_t * | pOfflineCrypto, | ||
| uint8_t | bOfflineCryptoLen, | ||
| uint8_t | bEnableOfflineAck, | ||
| uint8_t ** | ppOfflineAck, | ||
| uint16_t * | pOfflineAckLen | ||
| ) |
Change a Offline KUC entry in the key entry table of the SAM.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pOfflineCrypto and pOfflineAck is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bKucNo | [In] Reference number of the key usage counter to be updated (00h to 0Fh). |
| [in] | bProMas | [In] Program mask indicating the fields that should be changed. All the below option can be combined by using bitwise OR operator. |
| [in] | wChangeCtr | [In] Change Counter to avoid replay attacks. |
| [in] | pOfflineCrypto | [In] Offline Cryptogram exchanged to SAM (EncKUCEntry + OfflineMAC)
|
| [in] | bOfflineCryptoLen | [In] Length of bytes available in pOfflineCrypto buffer |
| [in] | bEnableOfflineAck | [In] To Enable reception of Offline Acknowledge
|
| [out] | ppOfflineAck | [Out] Offline Acknowledge information received from SAM. Will be based on
|
| [out] | pOfflineAckLen | [Out] Length of bytes available in ppOfflineAck buffer |
| phStatus_t phhalHw_Sam_Cmd_SAM_DisableKeyEntry | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bKeyNo | ||
| ) |
Disable a key entry.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bKeyNo | [In] Key reference number of the key entry to disable. One of the following,
|
| phStatus_t phhalHw_Sam_Cmd_SAM_DisableKeyEntryOffline | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bKeyNo, | ||
| uint16_t | wChangeCtr, | ||
| uint8_t * | pOfflineCrypto, | ||
| uint8_t | bOfflineCryptoLen, | ||
| uint8_t | bEnableOfflineAck, | ||
| uint8_t ** | ppOfflineAck, | ||
| uint16_t * | pOfflineAckLen | ||
| ) |
Disable a key entry using offline cryptogram.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pOfflineCrypto and pOfflineAck is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bKeyNo | [In] Key reference number of the key entry to disable. One of the following,
|
| [in] | wChangeCtr | [In] Change Counter to avoid replay attacks. |
| [in] | pOfflineCrypto | [In] Offline Cryptogram exchanged to SAM (EncKUCEntry + OfflineMAC)
|
| [in] | bOfflineCryptoLen | [In] Length of bytes available in pOfflineCrypto buffer |
| [in] | bEnableOfflineAck | [In] To Enable reception of Offline Acknowledge
|
| [out] | ppOfflineAck | [Out] Offline Acknowledge information received from SAM. Will be based on
|
| [out] | pOfflineAckLen | [Out] Length of bytes available in ppOfflineAck buffer |
| phStatus_t phhalHw_Sam_Cmd_SAM_EncipherKeyEntry | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bPersoKeyNo, | ||
| uint8_t | bKeyNo, | ||
| uint8_t | bOption, | ||
| uint16_t | wPersoCtr, | ||
| uint8_t * | pDivInput, | ||
| uint8_t | bDivInputLen, | ||
| uint8_t ** | ppOfflineCrypto, | ||
| uint16_t * | pOfflineCryptoLen | ||
| ) |
The SAM_EncipherKeyEntry is a Personalization SAM command used to prepare a cryptogram (according to Offline change protection) for the OfflineChange key on a target SAM.
The target Offline change counter (Perso_Ctr) are included in the generated cryptogram. It is only relevant for the target SAM and it shall not be compared to the (local) Change_Ctr.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pDivInput and pOfflineCryptoLen is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bPersoKeyNo | [In] Key reference number of the KST Key Entry to include in the cryptogram. One of the following,
|
| [in] | bKeyNo | [In] Key reference number of the KSTKeyEntry in the target SAM (00h to 7Fh). |
| [in] | bOption | [In] Option to include Key diversification and SAM UID in command. |
| [in] | wPersoCtr | [In] Change Counter to avoid replay attacks |
| [in] | pDivInput | [In] Diversification Input used to diversify the key. |
| [in] | bDivInputLen | [In] Length of bytes available in pDivInput buffer. |
| [out] | ppOfflineCrypto | [Out] Offline crypto information received from SAM.
|
| [out] | pOfflineCryptoLen | [Out] Length of bytes available in ppOfflineCrypto buffer |
| phStatus_t phhalHw_Sam_Cmd_SAM_GetKeyEntry | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bKeyNo, | ||
| uint8_t | bMode, | ||
| uint8_t ** | ppKeyEntry, | ||
| uint16_t * | pKeyEntryLen | ||
| ) |
Get information about a key entry.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pKeyEntryLen is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bKeyNo | [In] Key reference number of the key entry to get. One of the following,
|
| [in] | bMode | [In] Key entry format to be used. Not applicable for RAM Keys |
| [out] | ppKeyEntry | [Out] Buffer containing the information about the key entry. |
| [out] | pKeyEntryLen | [Out] Length of bytes available in ppKeyEntry buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_GetKUCEntry | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bKucNo, | ||
| uint8_t ** | ppKucEntry, | ||
| uint16_t * | pKucEntryLen | ||
| ) |
Get information about a key usage counter (KUC).
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pKucEntryLen is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bKucNo | [In] Reference number of the key usage counter to be returned (00h to 0Fh). |
| [out] | ppKucEntry | [Out] Buffer containing the KUC entry. |
| [out] | pKucEntryLen | [Out] Length of bytes available in ppKucEntry buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_DumpSessionKey | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bDumpMode, | ||
| uint8_t ** | ppSessionKey, | ||
| uint16_t * | pSessionKeyLen | ||
| ) |
Dump the current session key.
| PH_ERR_SUCCESS | Operation successful. |
| PHHAL_HW_SAM_ERR_OK_CHAINING_ACTIVE | Correct execution - more data available in response. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pSessionKeyLen is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bDumpMode | [In] Dump Mode. |
| [out] | ppSessionKey | [Out] Buffer containing Current session key information. |
| [out] | pSessionKeyLen | [Out] Length of bytes available in ppSessionKey buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_DumpSecretKey | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bDumpMode, | ||
| uint8_t | bKeyNo, | ||
| uint8_t | bKeyVer, | ||
| uint8_t * | pDivInput, | ||
| uint8_t | bDivInputLen, | ||
| uint8_t ** | ppSecretKey, | ||
| uint16_t * | pSecretKeyLen | ||
| ) |
Retrive a PICC or OfflineCrypto key stored in the key table.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pDivInput and pSecretKeyLen is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bDumpMode | [In] Dump Mode. |
| [in] | bKeyNo | [In] Reference number of the key entry to be dumped. One of the following
|
| [in] | bKeyVer | [In] Reference version of the key entry to be dumped. |
| [in] | pDivInput | [In] Diversification Input used to diversify the key. |
| [in] | bDivInputLen | [In] Length of bytes available in pDivInput buffer. |
| [out] | ppSecretKey | [Out] Buffer containing the plain secret key. |
| [out] | pSecretKeyLen | [Out] Length of bytes available in ppSecretKey buffer. |
| phStatus_t phhalHw_Sam_Cmd_SAM_DeriveKey | ( | phhalHw_Sam_DataParams_t * | pDataParams, |
| uint8_t | bSrcKeyNo, | ||
| uint8_t | bSrcKeyVer, | ||
| uint8_t | bDstKeyNo, | ||
| uint8_t * | pDeriveIn, | ||
| uint8_t | bDeriveInLen | ||
| ) |
Is used to derive a key from a source key (in other contexts often called master key) based on a CMAC operation.
In a MIFARE context, this command can be used to support session key generations for the Transaction MAC and Secure Dynamic Messaging features, for back-end (and / or reader) interpretation and validation of the cryptograms created by the PICC.
| PH_ERR_SUCCESS | Operation successful. |
| PH_ERR_INVALID_DATA_PARAMS | pDataParams is NULL. |
| PH_ERR_INVALID_PARAMETER | pDeriveIn is NULL. |
| Other | Depending on implementation and underlaying component. |
| [in] | pDataParams | [In] Pointer to this layer's parameter structure. |
| [in] | bSrcKeyNo | [In] Key number of the source key. One of the following,
|
| [in] | bSrcKeyVer | [In] Key version of the source key (00h to FFh). |
| [in] | bDstKeyNo | [In] Key number of the destination key entry, only RAM Keys: 0xE0 - 0xE3 |
| [in] | pDeriveIn | [In] The derivation input for deriving the key. |
| [in] | bDeriveInLen | [In] Length of derivation input used to derive the key. |