NXP Reader Library  v17.1.0.2535
CryptoSym

This is only a wrapper layer to abstract the different CryptoSym implementations. With this wrapper it is possible to support more than one CryptoSym implementation in parallel, by adapting this wrapper. More...

Collaboration diagram for CryptoSym:

Modules

 Component : Software
 Software implementation of the Symmetric Cryptography interface.
 
 Component : Stub
 Initialize the CryptoSym with Stub as sub-component.
 
 Component : mBedTLS
 Initialize the CryptoSym with mBedTLS as sub-component.
 
 Component : DUT
 DUT implementation of the CryptoSym interface.
 
 Defines
 These are common definitions for most of the Crypto commands.
 

Functions

phStatus_t phCryptoSym_InvalidateKey (void *pDataParams)
 Invalidate the currently loaded key. More...
 
phStatus_t phCryptoSym_Encrypt (void *pDataParams, uint16_t wOption, const uint8_t *pPlainBuffer, uint16_t wBufferLength, uint8_t *pEncryptedBuffer)
 Perform Encryption with one of the supported crypto modes. More...
 
phStatus_t phCryptoSym_Decrypt (void *pDataParams, uint16_t wOption, uint8_t *pEncryptedBuffer, uint16_t wBufferLength, uint8_t *pPlainBuffer)
 Perform Decryption with one of the supported crypto modes. More...
 
phStatus_t phCryptoSym_Decrypt_VariableIV (void *pDataParams, uint16_t wOption, uint8_t *pIv, uint8_t wIvSize, const uint8_t *pEncryptedBuffer, uint16_t wBufferLength, uint8_t *pPlainBuffer)
 Perform Decryption with one of the supported crypto modes. More...
 
phStatus_t phCryptoSym_CalculateMac (void *pDataParams, uint16_t wOption, const uint8_t *pData, uint16_t wDataLength, uint8_t *pMac, uint8_t *pMacLength)
 Calculate MAC with one of the supported MAC modes. More...
 
phStatus_t phCryptoSym_LoadIv (void *pDataParams, const uint8_t *pIV, uint8_t bIVLength)
 Load Initialization vector. More...
 
phStatus_t phCryptoSym_LoadNonce (void *pDataParams, uint8_t bCipher, const uint8_t *pNonce, uint8_t bNonceLen)
 Load Initialization vector (Nonce). More...
 
phStatus_t phCryptoSym_LoadAdditionalData (void *pDataParams, const uint8_t *pAddData, uint16_t wAddData_Len)
 Load Additional Data Field. More...
 
phStatus_t phCryptoSym_LoadKey (void *pDataParams, uint16_t wKeyNo, uint16_t wKeyVersion, uint16_t wKeyType)
 Load Key. More...
 
phStatus_t phCryptoSym_LoadKeyDirect (void *pDataParams, const uint8_t *pKey, uint16_t wKeyType)
 Direct Load Key. More...
 
phStatus_t phCryptoSym_DiversifyKey (void *pDataParams, uint16_t wOption, uint16_t wKeyNo, uint16_t wKeyVersion, uint8_t *pDivInput, uint8_t bLenDivInput, uint8_t *pDiversifiedKey)
 Diversify Key - Note: This function invalidates the currently loaded key. More...
 
phStatus_t phCryptoSym_DiversifyDirectKey (void *pDataParams, uint16_t wOption, uint8_t *pKey, uint16_t wKeyType, uint8_t *pDivInput, uint8_t bLenDivInput, uint8_t *pDiversifiedKey)
 Diversify Direct Key - Note: This function invalidates the currently loaded key. More...
 
phStatus_t phCryptoSym_ApplyPadding (uint8_t bOption, const uint8_t *pDataIn, uint16_t wDataInLength, uint8_t bBlockSize, uint16_t wDataOutBufSize, uint8_t *pDataOut, uint16_t *pDataOutLength)
 Apply Padding to a given data buffer. More...
 
phStatus_t phCryptoSym_RemovePadding (uint8_t bOption, const uint8_t *pDataIn, uint16_t wDataInLength, uint8_t bBlockSize, uint16_t wDataOutBufSize, uint8_t *pDataOut, uint16_t *pDataOutLength)
 Remove Padding to a given data buffer. More...
 
phStatus_t phCryptoSym_SetConfig (void *pDataParams, uint16_t wConfig, uint16_t wValue)
 Set configuration parameter. More...
 
phStatus_t phCryptoSym_GetConfig (void *pDataParams, uint16_t wConfig, uint16_t *pValue)
 Get configuration parameter. More...
 
phStatus_t phCryptoSym_SetAuthenticationTag (void *pDataParams, const uint8_t *pTag, uint8_t bTag_Len)
 Load Authentication Tag information. More...
 
phStatus_t phCryptoSym_GetAuthenticationTag (void *pDataParams, uint8_t *pTag, uint8_t *pTag_Len)
 Get Authentication Tag information. More...
 
phStatus_t phCryptoSym_GetLastStatus (void *pDataParams, uint16_t wStatusMsgLen, int8_t *pStatusMsg, int32_t *pStatusCode)
 Returns the status code and respective message. More...
 
uint16_t phCryptoSym_GetKeySize (uint16_t wKeyType)
 Gets the size of the key. More...
 

Detailed Description

This is only a wrapper layer to abstract the different CryptoSym implementations. With this wrapper it is possible to support more than one CryptoSym implementation in parallel, by adapting this wrapper.

Important hints for users of this component:

Note
The following are applicable when CryptoSym is initialized to use mBedTLS as underlying layer.
  • LRP (Leakage Resilient Primitive) feature is not supported.
  • CMAC implementation of mBedTLS library is not utilized due to below mentioned reason(s)
    • When using MIFARE DESFire AL component, CMAC computation leaving the first call requires IV of the last subsequent calls. Here the IV is only zero for the first call and non zero for the rest of the calls. This behavior is required for EV1 Secure messaging of MIFARE DESFire product.
    • Its not possible to update the IV for intermediate / final calls provide by mBedTLS.
    • To over come this, CMAC is implemented directly in this component using cipher interfaces of mBedTLS.
    • The above limitation is valid only for CalculateMac interface.
  • CMAC implementation of mBedTLS library is not utilized due to below mentioned reason(s)
    • CMAC implementation provided by mBedTLS library do not support 3DES-2Key key diversification.
    • Based on AN10922 CryptoSym should support diversification of 3DES-2Key but mBedTLS CMAC library do not support this key type.
    • To over come this, CMAC is implemented directly in this component using cipher interfaces of mBedTLS.
    • The above limitation is valid only for below mentioned interfaces.

Function Documentation

◆ phCryptoSym_InvalidateKey()

phStatus_t phCryptoSym_InvalidateKey ( void *  pDataParams)

Invalidate the currently loaded key.

Resets the key, the IV, the keep IV flag and the key Type.

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

◆ phCryptoSym_Encrypt()

phStatus_t phCryptoSym_Encrypt ( void *  pDataParams,
uint16_t  wOption,
const uint8_t pPlainBuffer,
uint16_t  wBufferLength,
uint8_t pEncryptedBuffer 
)

Perform Encryption with one of the supported crypto modes.

The wOption word specifies the operation mode to use, Authentication Tag information for Encryption and the update behavior of the IV.

Note
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_INVALID_PARAMETERAn unsupported key is loaded (or no key is loaded) or wBufferLength is not a multiple of the current block size.
PH_ERR_UNSUPPORTED_PARAMETERAn unknown cipher option wOption is specified.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Option byte specifying the cipher mode and the update behavior of the IV. Refer description for usage of this parameter.
[in]pPlainBuffer[In] Plain data buffer.
  • Should always be in multiple of current block size.
  • If not of current block size then Apply Padding needs to be used to make it upto current block size.
  • For CCM or CCM* cipher modes multiple of block size is not applicable.
[in]wBufferLength[In] Length of plain and encrypted data buffer - needs to be a multiple of the current block size
[out]pEncryptedBuffer[Out] Encrypted data buffer.
  • Allocation should be Should be equal to pPlainBuffer.
  • For CCM or CCM* cipher modes,

◆ phCryptoSym_Decrypt()

phStatus_t phCryptoSym_Decrypt ( void *  pDataParams,
uint16_t  wOption,
uint8_t pEncryptedBuffer,
uint16_t  wBufferLength,
uint8_t pPlainBuffer 
)

Perform Decryption with one of the supported crypto modes.

The wOption word specifies the operation mode to use, Authentication Tag information for Encryption and the update behavior of the IV.

Note
  • The input data length (pPlainBuffer and wBufferLength) needs to be a multiple of the current block size
  • The output buffer (pEncryptedBuffer) buffer allocation should be equal to input buffer (pPlainBuffer)
  • If CCM or CCM* cipher is used,
    • wOption = Authentication Tag not available
      • Tag information should be configured using Set Authentication Tag interface.
      • Plain buffer should have the Encrypted information only. Authentication Tag information should not be available.
    • wOption = Authentication Tag Available
      • Input buffer should be Input Length + Tag Length and Output buffer should be equal to Input buffer length.
      • Output Buffer will have Plain data followed by Tag data. User should discard the last bytes based on Tag Length and capture only the deciphered data.
      • Tag length should first be configured using GetConfig with Tag Length as configuration identifier.
    • Only PH_EXCHANGE_DEFAULT flag is supported.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_INVALID_PARAMETERAn unsupported key is loaded (or no key is loaded) or wBufferLength is not a multiple of the current block size.
PH_ERR_UNSUPPORTED_PARAMETERAn unknown cipher option wOption is specified.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Option byte specifying the cipher mode and the update behavior of the IV. Refer description for usage of this parameter.
[in]pEncryptedBuffer[In] Encrypted data buffer.
  • Should always be in multiple of current block size.
  • If not of current block size then Apply Padding needs to be used to make it upto current block size.
  • For CCM or CCM* cipher modes multiple of block size is not applicable.
[in]wBufferLength[In] Length of plain and encrypted data buffer - needs to be a multiple of the current block size.
[out]pPlainBuffer[Out] Plain data buffer.
  • Shall be in multiple of current block size. Plain data may be padded with zeros if not current block size and needs to be removed using Remove Padding interface.
  • For CCM or CCM* cipher modes,

◆ phCryptoSym_Decrypt_VariableIV()

phStatus_t phCryptoSym_Decrypt_VariableIV ( void *  pDataParams,
uint16_t  wOption,
uint8_t pIv,
uint8_t  wIvSize,
const uint8_t pEncryptedBuffer,
uint16_t  wBufferLength,
uint8_t pPlainBuffer 
)

Perform Decryption with one of the supported crypto modes.

The option word specifies the operation mode to use and the update behavior of the IV. All modes of operation are coded in the LSB, the flags in the MSB.

Note: The input data length needs to be a multiple of the current block size

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_INVALID_PARAMETERAn unsupported key is loaded (or no key is loaded) or wBufferLength is not a multiple of the current block size.
PH_ERR_UNSUPPORTED_PARAMETERAn unknown cipher option wOption is specified.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Option byte specifying the cipher mode and the update behavior of the IV.
[in]pIv[In] The IV information to be used while decrypting the information.
[in]wIvSize[In] Length of bytes available in IV buffer.
[in]pEncryptedBuffer[In] Encrypted data buffer
[in]wBufferLength[In] Length of plain and encrypted data buffer - needs to be a multiple of the current block size
[out]pPlainBuffer[Out] Plain data buffer

◆ phCryptoSym_CalculateMac()

phStatus_t phCryptoSym_CalculateMac ( void *  pDataParams,
uint16_t  wOption,
const uint8_t pData,
uint16_t  wDataLength,
uint8_t pMac,
uint8_t pMacLength 
)

Calculate MAC with one of the supported MAC modes.

The option word specifies the MAC mode to use and the update behavior of the IV as well as the completion behavior. All modes of operation are coded in the LSB, the flags in the MSB.

Note: If PH_EXCHANGE_BUFFERED_BIT is set, the input length needs to be a multiple of the block length!

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_INVALID_PARAMETERAn unsupported key is loaded (or no key is loaded) or wDataLength is not a multiple of the current block size and the option PH_EXCHANGE_BUFFERED_BIT is set.
PH_ERR_UNSUPPORTED_PARAMETERAn unknown mac option wOption is specified.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Option byte specifying the MAC mode and the update behavior of the IV and the completion flag.
[in]pData[In] Input data on which the MAC needs to be computed. Input will be always be in multiple of current block size if wOption is
[in]wDataLength[In] number of input data bytes
[out]pMac[Out] Output MAC block; uint8_t[16]
[out]pMacLength[Out] Length of MAC

◆ phCryptoSym_LoadIv()

phStatus_t phCryptoSym_LoadIv ( void *  pDataParams,
const uint8_t pIV,
uint8_t  bIVLength 
)

Load Initialization vector.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_INVALID_PARAMETERbIVLength does not match the current block size.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pIV[In] Initialization vector to use. Should of current block size.
[in]bIVLength[In] Length of bytes available in pIV buffer.

◆ phCryptoSym_LoadNonce()

phStatus_t phCryptoSym_LoadNonce ( void *  pDataParams,
uint8_t  bCipher,
const uint8_t pNonce,
uint8_t  bNonceLen 
)

Load Initialization vector (Nonce).

Can be used for below cipher modes

Note
: Support is available for mBedTLS component only or based on DUT feature support.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_INVALID_PARAMETER
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bCipher[In] One of the cipher modes mentioned in the description.
[in]pNonce[In] Initialization vector to use. Should based on cipher mode.
[in]bNonceLen[In] Length of bytes available in pNonce buffer.

◆ phCryptoSym_LoadAdditionalData()

phStatus_t phCryptoSym_LoadAdditionalData ( void *  pDataParams,
const uint8_t pAddData,
uint16_t  wAddData_Len 
)

Load Additional Data Field.

This will be used by Encrypt and Decrypt when Cipher Mode is CCM and CCM*.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_INVALID_PARAMETERpAddData is Null
PH_ERR_PARAMETER_SIZEwAddData_Len is higher than the maximum allowed one.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pAddData[In] Additional Data to use for CCM cipher mode.
[in]wAddData_Len[In] Length of bytes available in pAddData buffer. Maximum size should be less than 2^16 - 2^8 = 65280.

◆ phCryptoSym_LoadKey()

phStatus_t phCryptoSym_LoadKey ( void *  pDataParams,
uint16_t  wKeyNo,
uint16_t  wKeyVersion,
uint16_t  wKeyType 
)

Load Key.

This function uses the key storage provided at component initialization to retrieve the key identified by wKeyNo and wKeyVersion. After retrieving the key is loaded into the internal key storage array to be prepared for subsequent cipher operations.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
  • No KeyStore specified at initialization.
PH_ERR_UNSUPPORTED_PARAMETERKey Type not supported.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wKeyNo[In] Key number in KeyStore to be loaded.
[in]wKeyVersion[In] Key Version in KeyStore to be loaded.
[in]wKeyType[In] Type of Key to be loaded. Supported ones are

◆ phCryptoSym_LoadKeyDirect()

phStatus_t phCryptoSym_LoadKeyDirect ( void *  pDataParams,
const uint8_t pKey,
uint16_t  wKeyType 
)

Direct Load Key.

The key provided in the pKey parameter is loaded into the internal key storage array to be prepared for subsequent cipher operations.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_UNSUPPORTED_PARAMETERKey Type not supported.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pKey[In] Key to be loaded. Number of bytes should be based on the key type mentioned in wKeyType parameter.
[in]wKeyType[In] Type of Key to be loaded. Supported ones are

◆ phCryptoSym_DiversifyKey()

phStatus_t phCryptoSym_DiversifyKey ( void *  pDataParams,
uint16_t  wOption,
uint16_t  wKeyNo,
uint16_t  wKeyVersion,
uint8_t pDivInput,
uint8_t  bLenDivInput,
uint8_t pDiversifiedKey 
)

Diversify Key - Note: This function invalidates the currently loaded key.

Using the key stored in the KeyStore passed at initialization of the component and identified by wKeyNo and wKeyVersion this function calculates a diversified key according to the wOption specified that can be used in different applications.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
  • No KeyStore specified at Initialization.
PH_ERR_UNSUPPORTED_PARAMETERKey Type not supported (for key diversification).
PH_ERR_LENGTH_ERRORLength of diversification input is wrong.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Option to specify the diversification method. One of the below mentioned information.
[in]wKeyNo[In] Key number in KeyStore to be loaded
[in]wKeyVersion[In] Key Version in KeyStore to be loaded
[in]pDivInput[In] Diversification Input used to diversify the key.
[in]bLenDivInput[In] Length of diversification input used to diversify the key. If 0, no diversification is performed.
[out]pDiversifiedKey[Out] Diversified key. Will be of current block size.

◆ phCryptoSym_DiversifyDirectKey()

phStatus_t phCryptoSym_DiversifyDirectKey ( void *  pDataParams,
uint16_t  wOption,
uint8_t pKey,
uint16_t  wKeyType,
uint8_t pDivInput,
uint8_t  bLenDivInput,
uint8_t pDiversifiedKey 
)

Diversify Direct Key - Note: This function invalidates the currently loaded key.

Using the key passed in the pKey parameter this function calculates a diversified key according to the wOption specified that can be used in different applications.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_UNSUPPORTED_PARAMETERKey Type not supported (for key diversification).
PH_ERR_LENGTH_ERRORLength of diversification input is wrong.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Option to specify the diversification method. One of the below mentioned information.
[in]pKey[In] Key to be loaded. Number of bytes should be based on the key type mentioned in wKeyType parameter.
[in]wKeyType[In] Type of Key to be loaded. Supported ones are
[in]pDivInput[In] Diversification Input used to diversify the key.
[in]bLenDivInput[In] Length of diversification input used to diversify the key. If 0, no diversification is performed.
[out]pDiversifiedKey[Out] Diversified key. Will be of current block size.

◆ phCryptoSym_ApplyPadding()

phStatus_t phCryptoSym_ApplyPadding ( uint8_t  bOption,
const uint8_t pDataIn,
uint16_t  wDataInLength,
uint8_t  bBlockSize,
uint16_t  wDataOutBufSize,
uint8_t pDataOut,
uint16_t pDataOutLength 
)

Apply Padding to a given data buffer.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_BUFFER_OVERFLOWwDataOutBufSize is too small.
PH_ERR_INVALID_PARAMETERUnsupported bOption.
OtherDepending on implementation and underlying component.
Parameters
[in]bOption[In] Specifies padding mode
[in]pDataIn[In] Input data for which padding is required.
[in]wDataInLength[In] Length of bytes available in pDataIn buffer.
[in]bBlockSize[In] Block size to be used for padding.
[in]wDataOutBufSize[In] Size of output data buffer.
[out]pDataOut[Out] Output data containing the information with padded bytes added.
[out]pDataOutLength[Out] Length of bytes available in pDataOut buffer.

◆ phCryptoSym_RemovePadding()

phStatus_t phCryptoSym_RemovePadding ( uint8_t  bOption,
const uint8_t pDataIn,
uint16_t  wDataInLength,
uint8_t  bBlockSize,
uint16_t  wDataOutBufSize,
uint8_t pDataOut,
uint16_t pDataOutLength 
)

Remove Padding to a given data buffer.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_PARAMETERUnsupported bOption or wDataInLength is not a multiple of the bBlockSize parameter.
PH_ERR_FRAMING_ERRORPadding byte wrong. Expected 80h as the first padding byte if bOption = Zero Padding with MSB Bit Set.
OtherDepending on implementation and underlying component.
Parameters
[in]bOption[In] Specifies padding mode
[in]pDataIn[In] Input data from which padding should be removed.
[in]wDataInLength[In] Length of bytes available in pDataIn buffer
[in]bBlockSize[In] Block size to be used for padding
[in]wDataOutBufSize[In] Size of output data buffer
[out]pDataOut[Out] Output data containing the information with padded bytes removed.
[out]pDataOutLength[Out] Length of bytes available in pDataOut buffer

◆ phCryptoSym_SetConfig()

phStatus_t phCryptoSym_SetConfig ( void *  pDataParams,
uint16_t  wConfig,
uint16_t  wValue 
)

Set configuration parameter.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_INVALID_PARAMETERValid wConfig but invalid wValue for that config.
PH_ERR_UNSUPPORTED_PARAMETERInvalid (Unsupported) wConfig.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wConfig[In] Configuration Identifier. One of the below mentioned ones,
[in]wValue[In] Configuration Value for the provided configuration identifier.

◆ phCryptoSym_GetConfig()

phStatus_t phCryptoSym_GetConfig ( void *  pDataParams,
uint16_t  wConfig,
uint16_t pValue 
)

Get configuration parameter.

Return values
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_INVALID_PARAMETERValue behind wConfig not valid at the moment.
PH_ERR_UNSUPPORTED_PARAMETERInvalid (Unsupported) wConfig.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wConfig[In] Configuration Identifier. One of the below mentioned ones,
[out]pValue[Out] Configuration Value for the provided configuration identifier.

◆ phCryptoSym_SetAuthenticationTag()

phStatus_t phCryptoSym_SetAuthenticationTag ( void *  pDataParams,
const uint8_t pTag,
uint8_t  bTag_Len 
)

Load Authentication Tag information.

This will be used by Decrypt when Cipher Mode is CCM and CCM*. Refer Decrypt for more information.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_INVALID_PARAMETER
  • pTag is Null
  • bTag_Len is higher than the maximum allowed one which is 16 bytes.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pTag[In] Authentication tag to use for CCM or CCM* decryption.
[in]bTag_Len[In] Length of bytes available in pTag buffer.

◆ phCryptoSym_GetAuthenticationTag()

phStatus_t phCryptoSym_GetAuthenticationTag ( void *  pDataParams,
uint8_t pTag,
uint8_t pTag_Len 
)

Get Authentication Tag information.

This will be used by Encrypt when Cipher Mode is CCM and CCM*. Refer Encrypt for more information.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMS
  • If the interface context (pDataparams) is not holding this layer ID.
  • If the component context holds a different sub-component ID that is not supported by this layer.
PH_ERR_INVALID_PARAMETERpTag and pTag_Len is Null
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pTag[In] Authentication tag generated for CCM or CCM* encryption.
[in]pTag_Len[In] Length of bytes available in pTag buffer.

◆ phCryptoSym_GetLastStatus()

phStatus_t phCryptoSym_GetLastStatus ( void *  pDataParams,
uint16_t  wStatusMsgLen,
int8_t pStatusMsg,
int32_t pStatusCode 
)

Returns the status code and respective message.

This interfaces is supported only if CryptoSym component is initialized with mBedTLS Initialization.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wStatusMsgLen[In] Size of bytes allocated for pStatusMsg parameter.
[out]pStatusMsg[Out] The equivalent status message for the information available in pStatusCode.
[out]pStatusCode[Out] The status code returned by the underlying Crypto library.

◆ phCryptoSym_GetKeySize()

uint16_t phCryptoSym_GetKeySize ( uint16_t  wKeyType)

Gets the size of the key.

Returns
Status code
Return values
0: If the wKeyType is not supported.
AnyValue: Size for the mentioned wKeyType information.