3.6.2. Functions - 3.6.2. Functions - 5.3 English - 68552

AOCL API Guide (68552)

Document_ID
68552
Release_Date
2026-05-13
Version
5.3 English
alc_error_t alcp_rng_supported(const alc_rng_info_p pRngInfo)#

Query Library if the given configuration is supported.

This API needs to be called before any other API is called to know if RNG that is being request is supported or not

Parameters:

pRngInfo – [in] Pointer to alc_rng_info_t structure

Returns:

ALC_ERROR_NONE on success.

Uint64 alcp_rng_context_size(const alc_rng_info_p pRngInfo)#

Get the context/session size.

This API should be called before alcp_rng_request to identify the memory to be allocated for context

Note

User is expected to allocate for the session this function returns size to be allocated

Parameters:

pRngInfo – [in] Pointer to RNG configuration

Returns:

Uint64 Size of RNG context in bytes. For APIs that return alc_error_t, use alcp_is_error to check for errors.

alc_error_t alcp_rng_request(const alc_rng_info_p pRngInfo, alc_rng_handle_p pRngHandle)#

Request an handle for given RNG configuration.

This API can be called after alcp_rng_supported and before alcp_rng_finish

Note

Requested algorithm may be first checked using alcp_rng_supported and pHandle as allocated by user.

Parameters:
  • pRngInfo – [in] Pointer to RNG configuration

  • pRngHandle – [out] Library populated session handle for future rng operations.

Returns:

ALC_ERROR_NONE on success.

alc_error_t alcp_rng_gen_random(alc_rng_handle_p pRngHandle, Uint8 *pBuf, Uint64 size)#

Generate and fill buffer with random numbers.

This API can be called after alcp_rng_request and alcp_rng_init if hardware RNG requires it and before alcp_rng_finish

Parameters:
  • pRngHandle – [in] Pointer to handle

  • pBuf – [out] Output buffer to be filled with random numbers

  • size – [in] Size of pBuf in bytes

Returns:

ALC_ERROR_NONE on success.

alc_error_t alcp_rng_init(alc_rng_handle_p pRngHandle)#

Initialize a random number generator.

This API can be called after alcp_rng_request and before alcp_rng_finish

Note

Some hardware RNGs require initialization

Parameters:

pRngHandle – [in] Pointer to handle returned by alcp_rng_request()

Returns:

ALC_ERROR_NONE on success.

Warning

doxygenfunction: Cannot find function “alcp_rng_seed” in doxygen xml output for project “crypto” from directory: ./crypto-xml

alc_error_t alcp_rng_finish(alc_rng_handle_p pRngHandle)#

Seed a PRNG (or other RNG if supported)

This API can be called after alcp_rng_request and alcp_rng_init if hardware RNG requires it. This API is called to reset data so should be called after alcp_rng_request and before alcp_rng_finish

Complete a session

This API is called to free resources so should be called to free the session

Note

Completes the session which was previously requested using alcp_rng_request

Parameters:
  • pRngHandle – [in] Pointer to user allocated handle

  • seed – [in] Pointer to seed

  • size – [in] Length of seed in bytes

  • pRngHandle – [in] Pointer to handle

Returns:

ALC_ERROR_NONE on success.

Returns:

ALC_ERROR_NONE on success.