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...
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:
- Before use of any function, the dedicated random number implementation has to be initialized using either of the interfaces mentioned below.
- Before random numbers can be generated, the Seed function has to be called
◆ phCryptoRng_Seed()
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_SUCCESS | Operation 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.
|
| Other | Depending 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()
Obtains random bytes from the random source.
- Returns
- Status code
- Return values
-
| PH_ERR_SUCCESS | Operation 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 | If the buffer is null. |
| Other | Depending 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()
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
-
- 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. |