NXP Reader Library  v17.1.0.2535

Utility implementations. More...

Collaboration diagram for Utils:

Functions

phStatus_t phhalHw_SamAV3_Utils_GetCheckLcLe (uint8_t *pCmd, uint16_t wCmdLen, uint8_t *pIsLcPresent, uint8_t *pLcLen, uint8_t *pIsLePresent)
 Get the length of LC and also check is LC and LE are present in the command frame. More...
 
phStatus_t phhalHw_SamAV3_Utils_TruncateMacBuffer (uint8_t *pIoBuffer, uint8_t *pMacLen)
 Truncate a 16-Bytes MAC buffer into a 8-Bytes Buffer. More...
 
phStatus_t phhalHw_SamAV3_Utils_UpdateLc (phhalHw_SamAV3_DataParams_t *pDataParams)
 Update LC byte according to data already available in Buffer. More...
 
phStatus_t phhalHw_SamAV3_Utils_UpdateP1 (phhalHw_SamAV3_DataParams_t *pDataParams, uint8_t p1)
 Update P1 byte according to data already available in Buffer. More...
 
phStatus_t phhalHw_SamAV3_Utils_UpdateP2 (phhalHw_SamAV3_DataParams_t *pDataParams, uint8_t p2)
 Update P1byte according to data already available in Buffer. More...
 
phStatus_t phhalHw_SamAV3_Utils_ResolveErrorCode (uint8_t *pSw1Sw2)
 Parse Status Word Sw1Sw2 from the SAM and assign a equivalent custom code. More...
 
phStatus_t phhalHw_SamAV3_Utils_GenerateHostAuthSessionKey (phhalHw_SamAV3_DataParams_t *pDataParams, uint8_t bKeyType, uint8_t *pRnd1, uint8_t *pRnd2, uint8_t *pSessionKey, uint8_t *pKeyLen)
 Session key generation for LockUnlock command. More...
 
phStatus_t phhalHw_SamAV3_Utils_GenerateSessionKey (phhalHw_SamAV3_DataParams_t *pDataParams, uint8_t bKeyType, uint8_t *pRnd1, uint8_t *pRnd2, uint8_t *pSessionEncKey, uint8_t *pSessionMacKey, uint8_t *pKeyLen)
 Session key generation for AuthenticateHost command. More...
 
phStatus_t phhalHw_SamAV3_Utils_GetSessionUploadKey (phhalHw_SamAV3_DataParams_t *pDataParams, uint8_t bMode, uint16_t wUploadCtr, uint8_t bKeyNo, uint8_t bKeyVer, uint8_t *pSessionKey, uint8_t *pKeyType)
 Session key generation for the command PLUpload. More...
 

Macros to indicate the method to be used for session key generation.

#define PHHAL_HW_CMD_SAMAV3_SESSION_KEY_ENC   0U
 Macro to represent the mode to generate Session ENC keys.
 
#define PHHAL_HW_CMD_SAMAV3_SESSION_KEY_MAC   1U
 Macro to represent the mode to generate Session MAC keys.
 

Detailed Description

Utility implementations.

Function Documentation

◆ phhalHw_SamAV3_Utils_GetCheckLcLe()

phStatus_t phhalHw_SamAV3_Utils_GetCheckLcLe ( uint8_t pCmd,
uint16_t  wCmdLen,
uint8_t pIsLcPresent,
uint8_t pLcLen,
uint8_t pIsLePresent 
)

Get the length of LC and also check is LC and LE are present in the command frame.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in]pCmd[In] Address of buffer that contains the command.
[in]wCmdLen[In] Length of the command.
[out]pIsLcPresent[Out] LC byte presence indicator.
[out]pLcLen[Out] Length of the payload of the command.
[out]pIsLePresent[Out] LE byte presence indicator.

◆ phhalHw_SamAV3_Utils_TruncateMacBuffer()

phStatus_t phhalHw_SamAV3_Utils_TruncateMacBuffer ( uint8_t pIoBuffer,
uint8_t pMacLen 
)

Truncate a 16-Bytes MAC buffer into a 8-Bytes Buffer.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in,out]pIoBuffer[In, Out] The 16 bytes of computed MAC as input and 8 bytes of truncated MAC as output.
[in,out]pMacLen[In, Out] Non-Truncated MAC length as input and Truncated MAC length as output.

◆ phhalHw_SamAV3_Utils_UpdateLc()

phStatus_t phhalHw_SamAV3_Utils_UpdateLc ( phhalHw_SamAV3_DataParams_t pDataParams)

Update LC byte according to data already available in Buffer.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.

◆ phhalHw_SamAV3_Utils_UpdateP1()

phStatus_t phhalHw_SamAV3_Utils_UpdateP1 ( phhalHw_SamAV3_DataParams_t pDataParams,
uint8_t  p1 
)

Update P1 byte according to data already available in Buffer.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]p1[In] Value for P1.

◆ phhalHw_SamAV3_Utils_UpdateP2()

phStatus_t phhalHw_SamAV3_Utils_UpdateP2 ( phhalHw_SamAV3_DataParams_t pDataParams,
uint8_t  p2 
)

Update P1byte according to data already available in Buffer.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]p2[In] Value for P1.

◆ phhalHw_SamAV3_Utils_ResolveErrorCode()

phStatus_t phhalHw_SamAV3_Utils_ResolveErrorCode ( uint8_t pSw1Sw2)

Parse Status Word Sw1Sw2 from the SAM and assign a equivalent custom code.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
Parameters
[in]pSw1Sw2[In] Pointer to the status code sent by the SAM.

◆ phhalHw_SamAV3_Utils_GenerateHostAuthSessionKey()

phStatus_t phhalHw_SamAV3_Utils_GenerateHostAuthSessionKey ( phhalHw_SamAV3_DataParams_t pDataParams,
uint8_t  bKeyType,
uint8_t pRnd1,
uint8_t pRnd2,
uint8_t pSessionKey,
uint8_t pKeyLen 
)

Session key generation for LockUnlock command.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bKeyType[In] The key type to be used (AES128 or AES192)
[in]pRnd1[In] Pointer to Rnd1 data.
[in]pRnd2[In] Pointer to Rnd2 data.
[out]pSessionKey[Out] The generated session key.
[out]pKeyLen[Out] Length of the Session key.

◆ phhalHw_SamAV3_Utils_GenerateSessionKey()

phStatus_t phhalHw_SamAV3_Utils_GenerateSessionKey ( phhalHw_SamAV3_DataParams_t pDataParams,
uint8_t  bKeyType,
uint8_t pRnd1,
uint8_t pRnd2,
uint8_t pSessionEncKey,
uint8_t pSessionMacKey,
uint8_t pKeyLen 
)

Session key generation for AuthenticateHost command.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bKeyType[In] The key type to be used (AES128 or AES192)
[in]pRnd1[In] Pointer to Rnd1 data.
[in]pRnd2[In] Pointer to Rnd2 data.
[out]pSessionEncKey[Out] The generate session encryption key.
[out]pSessionMacKey[Out] The generate session mac key.
[out]pKeyLen[Out] Length of the Session key.

◆ phhalHw_SamAV3_Utils_GetSessionUploadKey()

phStatus_t phhalHw_SamAV3_Utils_GetSessionUploadKey ( phhalHw_SamAV3_DataParams_t pDataParams,
uint8_t  bMode,
uint16_t  wUploadCtr,
uint8_t  bKeyNo,
uint8_t  bKeyVer,
uint8_t pSessionKey,
uint8_t pKeyType 
)

Session key generation for the command PLUpload.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bMode[In] Mode to use for session key generation. Can be one of the below options.
[in]wUploadCtr[In] The upload counter value.
[in]bKeyNo[In] Key number using which the key will be taken from keystore for macing the session vectors.
[in]bKeyVer[In] Key version to be used.
[out]pSessionKey[Out] The generated session key.
[out]pKeyType[Out] The type of key used for session key generation.