NXP Reader Library  v17.1.0.2535
CryptoRng

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

Collaboration diagram for CryptoRng:

Modules

 Component : Software
 Software implementation of the Random Number interface.
 
 Component : Stub
 Stub implementation of the Random Number interface.
 
 Component : mBedTLS
 mBedTLS implementation of the Random Number interface
 
 Component : DUT
 DUT implementation of the Random Number interface.
 

Functions

phStatus_t phCryptoRng_Seed (void *pDataParams, uint8_t *pSeed, uint8_t bSeedLength)
 Seeds the random number generator with the given seed. More...
 
phStatus_t phCryptoRng_Rnd (void *pDataParams, uint16_t wNoOfRndBytes, uint8_t *pRnd)
 Obtains random bytes from the random source. More...
 
phStatus_t phCryptoRng_GetLastStatus (void *pDataParams, uint16_t wStatusMsgLen, int8_t *pStatusMsg, int32_t *pStatusCode)
 Returns the status code and respective message. More...
 

Detailed Description

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

Important hints for users of this component:

Function Documentation

◆ phCryptoRng_Seed()

phStatus_t phCryptoRng_Seed ( void *  pDataParams,
uint8_t pSeed,
uint8_t  bSeedLength 
)

Seeds the random number generator with the given seed.

The seed length is dependent on the underlaying implementation. Further details can be found in the detailed description of the underlying layers.

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.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pSeed[In] Seed
[in]bSeedLength[In] Size of the seed.

◆ phCryptoRng_Rnd()

phStatus_t phCryptoRng_Rnd ( void *  pDataParams,
uint16_t  wNoOfRndBytes,
uint8_t pRnd 
)

Obtains random bytes from the random source.

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_PARAMETERIf the buffer is null.
OtherDepending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wNoOfRndBytes[In] Number of random bytes to generate.
[out]pRnd[Out] Generated bytes; uint8_t[wNoOfRndBytes]

◆ phCryptoRng_GetLastStatus()

phStatus_t phCryptoRng_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.
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.