NAME
RANDsetrandmethod, RANDgetrandmethod, RANDSSLeay - select RAND
methodSYNOPSIS
#include
void RANDsetrandmethod(const RANDMETHOD *meth); const RANDMETHOD *RANDgetrandmethod(void); RANDMETHOD *RANDSSLeay(void);DESCRIPTION
A RRAANNDDMMEETTHHOODD specifies the functions that OpenSSL uses for random number generation. By modifying the method, alternative implementationssuch as hardware RNGs may be used. IMPORTANT: See the NOTES section for
important information about how these RAND API functions are affected by the use of EENNGGIINNEE API calls. Initially, the default RANDMETHOD is the OpenSSL internal implementation, as returned by RANDSSLeay(). RANDsetdefaultmethod() makes mmeetthh the method for PRNG use. NNBB: This is true only whilst no ENGINE has been set as a default for RAND, so this function is no longer recommended. RANDgetdefaultmethod() returns a pointer to the current RANDMETHOD. However, the meaningfulness of this result is dependant on whether the ENGINE API is being used, so this function is no longer recommended. TTHHEE RRAANNDDMMEETTHHOODD SSTTRRUUCCTTUURREE typedef struct randmethst { void (*seed)(const void *buf, int num); int (*bytes)(unsigned char *buf, int num); void (*cleanup)(void); void (*add)(const void *buf, int num, int entropy); int (*pseudorand)(unsigned char *buf, int num); int (*status)(void); } RANDMETHOD; The components point to the implementation of RANDseed(), RANDbytes(), RANDcleanup(), RANDadd(), RANDpseudorand() and RANDstatus(). Each component may be NULL if the function is not implemented.RETURN VALUES
RANDsetrandmethod() returns no value. RANDgetrandmethod() and RANDSSLeay() return pointers to the respective methods. NNOOTTEESS As of version 0.9.7, RANDMETHOD implementations are grouped together with other algorithmic APIs (eg. RSAMETHOD, EVPCIPHER, etc) in EENNGGIINNEE modules. If a default ENGINE is specified for RAND functionality using an ENGINE API function, that will override any RAND defaults set using the RAND API (ie. RANDsetrandmethod()). For this reason, the ENGINE API is the recommended way to control default implementations for use in RAND and other cryptographic algorithms.SEE ALSO
rand(3), engine(3) HISTORY RANDsetrandmethod(), RANDgetrandmethod() and RANDSSLeay() are available in all versions of OpenSSL. In the engine version of version 0.9.6, RANDsetrandmethod() was altered to take an ENGINE pointer as its argument. As of version 0.9.7, that has been reverted as the ENGINE API transparently overrides RAND defaults if used, otherwise RAND API functions work as before. RANDsetrandengine() was also introduced in version 0.9.7.0.9.7l 2002-08-05 RANDsetrandmethod(3)