|
|
#include <sys/types.h> #include <sys/macro.h> #include <sys/security.h> #include <sys/audit.h> #include <sys/param.h> #include <sys/filsys.h> #include <prot.h>long get_seed (prpwd) struct pr_passwd *prpwd;
void set_seed (seed) long seed;
set_seed- set seed for random number generator
These routines handle seed management for users of the random number generator used in the Authentication subsystem. They exist to centralize control so that multiple seed algorithms can be handled together and so that different routines do not all set an initial seed (the randomness desired is promoted here).
The get_seed routine uses an automatic seed generation algorithm to choose a value to return. Currently, it does not use the argument prpwd, but to be compatible with more secure versions of the system, it should pass in the pointer to the user of interest's protected password structure. If no user is relevant to setting the seed, prpwd should be set to NULL.
The set_seed routine primes the program's random number generator (using drand48(S)) to the seed passed in. The routine ignores all requests except the first one, so that the generator is not reset after its initial invocation.