random number generator definition
Definition
struct rng_alg {
int (* generate) (struct crypto_rng *tfm,const u8 *src, unsigned int slen,u8 *dst, unsigned int dlen);
int (* seed) (struct crypto_rng *tfm, const u8 *seed, unsigned int slen);
void (* set_ent) (struct crypto_rng *tfm, const u8 *data,unsigned int len);
unsigned int seedsize;
struct crypto_alg base;
};
Members
The random number generator API is used with the ciphers of type CRYPTO_ALG_TYPE_RNG (listed as type “rng” in /proc/crypto)
Parameters
Description
Allocate a cipher handle for a random number generator. The returned struct crypto_rng is the cipher handle that is required for any subsequent API invocation for that random number generator.
For all random number generators, this call creates a new private copy of the random number generator that does not share a state with other instances. The only exception is the “krng” random number generator which is a kernel crypto API use case for the get_random_bytes() function of the /dev/random driver.
Return
Parameters
Description
Return the generic name (cra_name) of the initialized random number generator
Return
generic name string
zeroize and free RNG handle
Parameters
get random number
Parameters
Description
This function fills the caller-allocated buffer with random numbers using the random number generator referenced by the cipher handle.
Return
0 function was successful; < 0 if an error occurred
get random number
Parameters
Description
This function fills the caller-allocated buffer with random numbers using the random number generator referenced by the cipher handle.
Return
0 function was successful; < 0 if an error occurred
re-initialize the RNG
Parameters
Description
The reset function completely re-initializes the random number generator referenced by the cipher handle by clearing the current state. The new state is initialized with the caller provided seed or automatically, depending on the random number generator type (the ANSI X9.31 RNG requires caller-provided seed, the SP800-90A DRBGs perform an automatic seeding). The seed is provided as a parameter to this function call. The provided seed should have the length of the seed size defined for the random number generator as defined by crypto_rng_seedsize.
Return
0 if the setting of the key was successful; < 0 if an error occurred
obtain seed size of RNG
Parameters
Description
The function returns the seed size for the random number generator referenced by the cipher handle. This value may be zero if the random number generator does not implement or require a reseeding. For example, the SP800-90A DRBGs implement an automated reseeding after reaching a pre-defined threshold.
Return
seed size for the random number generator