DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

seed(S-osr5)


seed: get_seed, set_seed -- obtain or set seed for random number generator

Syntax

cc . . . -lprot

#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;

Description

get_seed- obtain seed for random number generator

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-osr5)) 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.

Return value

Upon successful completion, the get_seed routine returns an integer value calculated by an automatic seed generator. If an error occurs during seed generation, get_seed will return a value of -1. No return value or errors are defined for the set_seed routine.

Notes

The drand48(S-osr5) routines used on an implementation should be tested to produce good uniformity, a long period, and a large name space since not all ports test for this. Poor performance of these routines translates into predictable results in such vital operations as password generation.

See also

drand48(S-osr5)

Standards conformance

The get_seed and set_seed routines are an extension of AT&T System V provided by the Santa Cruz Operation.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005