heimdal  7.7.0
About: Heimdal is a free implementation of Kerberos 5 (a system for authenticating users and services on a network).
  Fossies Dox: heimdal-7.7.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

RAND crypto functions

See the RAND - random number for description and examples. More...

Functions

void RAND_seed (const void *indata, size_t size)
 
int RAND_bytes (void *outdata, size_t size)
 
void RAND_cleanup (void)
 
void RAND_add (const void *indata, size_t size, double entropi)
 
int RAND_pseudo_bytes (void *outdata, size_t size)
 
int RAND_status (void)
 
int RAND_set_rand_method (const RAND_METHOD *meth)
 
const RAND_METHODRAND_get_rand_method (void)
 
int RAND_set_rand_engine (ENGINE *engine)
 
int RAND_load_file (const char *filename, size_t size)
 
int RAND_write_file (const char *filename)
 
const char * RAND_file_name (char *filename, size_t size)
 

Detailed Description

See the RAND - random number for description and examples.

Function Documentation

◆ RAND_add()

void RAND_add ( const void indata,
size_t  size,
double  entropi 
)

Seed that random number generator. Secret material can securely be feed into the function, they will never be returned.

Parameters
indatathe input data.
sizesize of in data.
entropientropi in data.

Definition at line 143 of file rand.c.

References init_method(), selected_meth, and size.

Referenced by seed_something().

◆ RAND_bytes()

◆ RAND_cleanup()

void RAND_cleanup ( void  )

Reset and free memory used by the random generator.

Definition at line 116 of file rand.c.

References ENGINE, ENGINE_finish(), RAND_METHOD, selected_engine, and selected_meth.

◆ RAND_file_name()

const char* RAND_file_name ( char *  filename,
size_t  size 
)

Return the default random state filename for a user to use for RAND_load_file(), and RAND_write_file().

Parameters
filenamebuffer to hold file name.
sizesize of buffer filename.
Returns
the buffer filename or NULL on failure.

Definition at line 348 of file rand.c.

References _hc_unix_device_fd(), fd, filename, issuid(), ret, and size.

Referenced by main(), and seed_something().

◆ RAND_get_rand_method()

const RAND_METHOD* RAND_get_rand_method ( void  )

Get the default random method.

Returns
Returns a RAND_METHOD

Definition at line 215 of file rand.c.

References init_method(), and selected_meth.

◆ RAND_load_file()

int RAND_load_file ( const char *  filename,
size_t  size 
)

Load a a file and feed it into RAND_seed().

Parameters
filenamename of file to read.
sizeminimum size to read.
Returns
Returns the number of seed bytes loaded (0 indicates failure)

Definition at line 273 of file rand.c.

References buf, fd, filename, len, O_BINARY, RAND_seed(), rfc3454::read(), rk_cloexec(), size, and slen.

Referenced by main().

◆ RAND_pseudo_bytes()

int RAND_pseudo_bytes ( void outdata,
size_t  size 
)

Get a random block from the random generator, should NOT be used for key material.

Parameters
outdatarandom data
sizelength random data
Returns
1 on success, 0 on failure.

Definition at line 161 of file rand.c.

References init_method(), selected_meth, and size.

◆ RAND_seed()

void RAND_seed ( const void indata,
size_t  size 
)

Seed that random number generator. Secret material can securely be feed into the function, they will never be returned.

Parameters
indataseed data
sizelength seed data

Definition at line 84 of file rand.c.

References init_method(), selected_meth, and size.

Referenced by hc_DES_init_random_number_generator(), hc_DES_set_random_generator_seed(), and RAND_load_file().

◆ RAND_set_rand_engine()

int RAND_set_rand_engine ( ENGINE engine)

Set the default random method from engine.

Parameters
engineuse engine, if NULL is passed it, old method and engine is cleared.
Returns
1 on success, 0 on failure.

Definition at line 232 of file rand.c.

References ENGINE_finish(), ENGINE_get_RAND(), ENGINE_up_ref(), RAND_METHOD, selected_engine, and selected_meth.

◆ RAND_set_rand_method()

int RAND_set_rand_method ( const RAND_METHOD meth)

Set the default random method.

Parameters
methset the new default method.
Returns
1 on success.

Definition at line 193 of file rand.c.

References ENGINE_finish(), RAND_METHOD, selected_engine, and selected_meth.

Referenced by main().

◆ RAND_status()

int RAND_status ( void  )

Return status of the random generator

Returns
1 if the random generator can deliver random data.

Definition at line 176 of file rand.c.

References init_method(), and selected_meth.

Referenced by info(), main(), seed_something(), and test_BN_rand().

◆ RAND_write_file()

int RAND_write_file ( const char *  filename)

Write of random numbers to a file to store for later initiation with RAND_load_file().

Parameters
filenamename of file to write.
Returns
1 on success and non-one on failure.

Definition at line 307 of file rand.c.

References buf, fd, filename, len, O_BINARY, RAND_bytes(), RAND_FILE_SIZE, res, and rk_cloexec().

Referenced by main(), and seed_something().