random.c File Reference

Random module implementation file. More...

#include "random.h"
#include "mcl/mcl_random.h"
#include "memory.h"
#include "security.h"
#include "definitions.h"
#include "log_util.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

E_MCL_ERROR_CODE mcl_random_generate_guid (char **guid)
 Generates globally unique identifier. More...
 
E_MCL_ERROR_CODE random_generate_number (mcl_uint32_t *random_number)
 Generates random integer number. More...
 
mcl_uint8_trandom_generate_array (mcl_size_t size)
 Generates an array of random numbers. More...
 
E_MCL_ERROR_CODE random_generate_guid (string_t **guid)
 Generates random guid. More...
 

Detailed Description

Random module implementation file.


Date
Aug 15, 2016

Definition in file random.c.

Macro Definition Documentation

#define GUID_LENGTH   36

Definition at line 25 of file random.c.

Referenced by random_generate_guid().

Function Documentation

E_MCL_ERROR_CODE mcl_random_generate_guid ( char **  guid)

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 42 of file random.c.

References ASSERT_CODE_MESSAGE, ASSERT_NOT_NULL, string_t::buffer, DEBUG_ENTRY, DEBUG_LEAVE, MCL_FREE, MCL_NULL, MCL_OK, and random_generate_guid().

Here is the call graph for this function:

mcl_uint8_t* random_generate_array ( mcl_size_t  size)

Generates an array of random numbers.

Generates an array in given size and fills with random numbers.

Parameters
[in]sizeThe size of the array to be created.
Returns
Returns the generated array of random numbers.

Definition at line 71 of file random.c.

References ASSERT_MESSAGE, ASSERT_STATEMENT_MESSAGE, DEBUG_ENTRY, DEBUG_LEAVE, MCL_FREE, MCL_MALLOC, MCL_NULL, MCL_OK, and security_generate_random_bytes().

Here is the call graph for this function:

E_MCL_ERROR_CODE random_generate_guid ( string_t **  guid)

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 86 of file random.c.

References ASSERT_CODE_MESSAGE, ASSERT_STATEMENT_CODE_MESSAGE, guid_t::clk_seq_hi_res, guid_t::clk_seq_low, DEBUG_ENTRY, DEBUG_LEAVE, GUID_LENGTH, MCL_FREE, MCL_MALLOC, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, guid_t::node, guid_t::rnd, security_generate_random_bytes(), string_initialize_dynamic(), string_util_snprintf(), guid_t::time_hi_and_version, guid_t::time_low, and guid_t::time_mid.

Referenced by _initialize_payload(), event_initialize(), 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:

E_MCL_ERROR_CODE random_generate_number ( mcl_uint32_t random_number)

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 61 of file random.c.

References DEBUG_ENTRY, DEBUG_LEAVE, and security_generate_random_bytes().

Referenced by _generate_random_boundary().

Here is the call graph for this function:

Here is the caller graph for this function: