diff options
Diffstat (limited to 'secure/lib/libcrypto/man/rand.3')
-rw-r--r-- | secure/lib/libcrypto/man/rand.3 | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/secure/lib/libcrypto/man/rand.3 b/secure/lib/libcrypto/man/rand.3 index 26790cf..02bbce0 100644 --- a/secure/lib/libcrypto/man/rand.3 +++ b/secure/lib/libcrypto/man/rand.3 @@ -1,8 +1,7 @@ -.\" Automatically generated by Pod::Man version 1.15 -.\" Wed Mar 17 09:38:44 2004 +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 .\" .\" Standard preamble: -.\" ====================================================================== +.\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp @@ -15,12 +14,6 @@ .if t .sp .5v .if n .sp .. -.de Ip \" List item -.br -.ie \\n(.$>=3 .ne \\$3 -.el .ne 3 -.IP "\\$1" \\$2 -.. .de Vb \" Begin verbatim text .ft CW .nf @@ -28,15 +21,14 @@ .. .de Ve \" End verbatim text .ft R - .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a -.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used -.\" to do unbreakable dashes and therefore won't be available. \*(C` and -.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<> +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ @@ -56,10 +48,10 @@ . ds R" '' 'br\} .\" -.\" If the F register is turned on, we'll generate index entries on stderr -.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and -.\" index entries marked with X<> in POD. Of course, you'll have to process -.\" the output yourself in some meaningful fashion. +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" @@ -68,14 +60,13 @@ . rr F .\} .\" -.\" For nroff, turn off justification. Always turn off hyphenation; it -.\" makes way too many mistakes in technical documents. +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. -.bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 @@ -135,46 +126,53 @@ . ds Ae AE .\} .rm #[ #] #H #V #F C -.\" ====================================================================== +.\" ======================================================================== .\" .IX Title "rand 3" -.TH rand 3 "0.9.7d" "2004-03-17" "OpenSSL" -.UC +.TH rand 3 "2005-02-24" "0.9.7d" "OpenSSL" .SH "NAME" -rand \- pseudo-random number generator +rand \- pseudo\-random number generator .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include <openssl/rand.h> .Ve +.PP .Vb 1 \& int RAND_set_rand_engine(ENGINE *engine); .Ve +.PP .Vb 2 \& int RAND_bytes(unsigned char *buf, int num); \& int RAND_pseudo_bytes(unsigned char *buf, int num); .Ve +.PP .Vb 3 \& void RAND_seed(const void *buf, int num); \& void RAND_add(const void *buf, int num, int entropy); \& int RAND_status(void); .Ve +.PP .Vb 3 \& int RAND_load_file(const char *file, long max_bytes); \& int RAND_write_file(const char *file); \& const char *RAND_file_name(char *file, size_t num); .Ve +.PP .Vb 1 \& int RAND_egd(const char *path); .Ve +.PP .Vb 3 \& void RAND_set_rand_method(const RAND_METHOD *meth); \& const RAND_METHOD *RAND_get_rand_method(void); \& RAND_METHOD *RAND_SSLeay(void); .Ve +.PP .Vb 1 \& void RAND_cleanup(void); .Ve +.PP .Vb 3 \& /* For Win32 only */ \& void RAND_screen(void); @@ -202,11 +200,11 @@ need randomness. .PP A cryptographic \s-1PRNG\s0 must be seeded with unpredictable data such as mouse movements or keys pressed at random by the user. This is -described in RAND_add(3). Its state can be saved in a seed file -(see RAND_load_file(3)) to avoid having to go through the +described in \fIRAND_add\fR\|(3). Its state can be saved in a seed file +(see \fIRAND_load_file\fR\|(3)) to avoid having to go through the seeding process whenever the application is started. .PP -RAND_bytes(3) describes how to obtain random data from the +\&\fIRAND_bytes\fR\|(3) describes how to obtain random data from the \&\s-1PRNG\s0. .SH "INTERNALS" .IX Header "INTERNALS" @@ -217,14 +215,14 @@ The following description of its design is based on the SSLeay documentation: .PP First up I will state the things I believe I need for a good \s-1RNG\s0. -.Ip "1" 4 +.IP "1" 4 .IX Item "1" A good hashing algorithm to mix things up and to convert the \s-1RNG\s0 'state' to random numbers. -.Ip "2" 4 +.IP "2" 4 .IX Item "2" An initial source of random 'state'. -.Ip "3" 4 +.IP "3" 4 .IX Item "3" The state should be very large. If the \s-1RNG\s0 is being used to generate 4096 bit \s-1RSA\s0 keys, 2 2048 bit random strings are required (at a minimum). @@ -233,12 +231,12 @@ search space to 128 bits, not 2048. I'm probably getting a little carried away on this last point but it does indicate that it may not be a bad idea to keep quite a lot of \s-1RNG\s0 state. It should be easier to break a cipher than guess the \s-1RNG\s0 seed data. -.Ip "4" 4 +.IP "4" 4 .IX Item "4" Any \s-1RNG\s0 seed data should influence all subsequent random numbers generated. This implies that any random seed data entered will have an influence on all subsequent random numbers generated. -.Ip "5" 4 +.IP "5" 4 .IX Item "5" When using data to seed the \s-1RNG\s0 state, the data used should not be extractable from the \s-1RNG\s0 state. I believe this should be a @@ -246,11 +244,11 @@ requirement because one possible source of 'secret' semi random data would be a private key or a password. This data must not be disclosed by either subsequent random numbers or a \&'core' dump left by a program crash. -.Ip "6" 4 +.IP "6" 4 .IX Item "6" Given the same initial 'state', 2 systems should deviate in their \s-1RNG\s0 state (and hence the random numbers generated) over time if at all possible. -.Ip "7" 4 +.IP "7" 4 .IX Item "7" Given the random number output stream, it should not be possible to determine the \s-1RNG\s0 state or the next random number. @@ -274,7 +272,7 @@ The result of this is kept in 'md' and also xored into the \&'state' at the same locations that were used as input into the hash function. I believe this system addresses points 1 (hash function; currently -\&\s-1SHA-1\s0), 3 (the 'state'), 4 (via the 'md'), 5 (by the use of a hash +\&\s-1SHA\-1\s0), 3 (the 'state'), 4 (via the 'md'), 5 (by the use of a hash function and xor). .PP When bytes are extracted from the \s-1RNG\s0, the following process is used. @@ -291,17 +289,17 @@ Finally, after we have finished 'num' random bytes for the caller, \&'count' (which is incremented) and the local and global 'md' are fed into the hash function and the results are kept in the global 'md'. .PP -I believe the above addressed points 1 (use of \s-1SHA-1\s0), 6 (by hashing +I believe the above addressed points 1 (use of \s-1SHA\-1\s0), 6 (by hashing into the 'state' the 'old' data from the caller that is about to be overwritten) and 7 (by not using the 10 bytes given to the caller to update the 'state', but they are used to update 'md'). .PP So of the points raised, only 2 is not addressed (but see -RAND_add(3)). +\&\fIRAND_add\fR\|(3)). .SH "SEE ALSO" .IX Header "SEE ALSO" -BN_rand(3), RAND_add(3), -RAND_load_file(3), RAND_egd(3), -RAND_bytes(3), -RAND_set_rand_method(3), -RAND_cleanup(3) +\&\fIBN_rand\fR\|(3), \fIRAND_add\fR\|(3), +\&\fIRAND_load_file\fR\|(3), \fIRAND_egd\fR\|(3), +\&\fIRAND_bytes\fR\|(3), +\&\fIRAND_set_rand_method\fR\|(3), +\&\fIRAND_cleanup\fR\|(3) |