random.c File Reference

Random module implementation file. More...

#include "random.h"
#include "security.h"
#include "string_util.h"
#include "mcl_core/mcl_assert.h"
#include "mcl_core/mcl_random.h"
#include "mcl_core/mcl_memory.h"
Include dependency graph for random.c:

Go to the source code of this file.

Data Structures

union  guid_t
 

Macros

#define GUID_LENGTH   36
 

Functions

mcl_error_t mcl_random_generate_guid (char **guid)
 
mcl_error_t mcl_random_generate_bytes (unsigned char *buffer, mcl_size_t size)
 
mcl_error_t random_generate_number (mcl_uint32_t *random_number)
 
mcl_error_t random_generate_guid (char **guid)
 

Detailed Description

Random module implementation file.

Definition in file random.c.

Macro Definition Documentation

#define GUID_LENGTH   36

Definition at line 20 of file random.c.

Referenced by random_generate_guid().

Function Documentation

mcl_error_t mcl_random_generate_bytes ( unsigned char *  buffer,
mcl_size_t  size 
)

This function generates random bytes.

Parameters
[out]bufferArray for random bytes.
[in]sizeSize of array in bytes.
Returns

Definition at line 53 of file random.c.

References MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, and security_generate_random_bytes().

Here is the call graph for this function:

mcl_error_t mcl_random_generate_guid ( char **  guid)

This function generates globally unique identifier.

Parameters
[out]guidRandom guid.
Returns
  • MCL_OK in case of success.
  • MCL_OUT_OF_MEMORY in case there is not enough memory in the system to proceed.
  • MCL_FAIL in case of an internal error in random number generation.

Definition at line 37 of file random.c.

References MCL_ASSERT_CODE_MESSAGE, MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, MCL_OK, and random_generate_guid().

Here is the call graph for this function:

mcl_error_t random_generate_guid ( char **  guid)

This function generates random guid.

Parameters
[out]guidRandom guid.
Returns
  • MCL_OK in case of success.
  • MCL_OUT_OF_MEMORY in case there is not enough memory in the system to proceed.
  • MCL_FAIL in case of an internal error in random number generation.

Definition at line 80 of file random.c.

References guid_t::clk_seq_hi_res, guid_t::clk_seq_low, guid_t::guid_fields, GUID_LENGTH, MCL_ASSERT_CODE_MESSAGE, MCL_ASSERT_STATEMENT_CODE_MESSAGE, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, MCL_MALLOC, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, guid_t::node, guid_t::rnd, security_generate_random_bytes(), string_util_snprintf(), guid_t::time_hi_and_version, guid_t::time_low, and guid_t::time_mid.

Referenced by _add_jwks(), mcl_random_generate_guid(), and security_handler_generate_jti().

Here is the call graph for this function:

Here is the caller graph for this function:

mcl_error_t random_generate_number ( mcl_uint32_t random_number)

This function generates random integer number.

Parameters
[out]random_numberPointer to the random number generated.
Returns
  • MCL_OK in case of success.
  • MCL_FAIL in case of an internal error in random number generation.

Definition at line 68 of file random.c.

References MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, and security_generate_random_bytes().

Here is the call graph for this function: