summaryrefslogtreecommitdiffstats
path: root/crypto/rand/rand.h
diff options
context:
space:
mode:
authorUlf Möller <ulf@openssl.org>2000-01-13 20:59:17 +0000
committerUlf Möller <ulf@openssl.org>2000-01-13 20:59:17 +0000
commiteb952088f0d5da59e569ae2aa33e9b96bc3b586d (patch)
tree1d722a423148a6b568a1e6d42f01943aed6cfb2a /crypto/rand/rand.h
parent22e219d90f1ea5d3b2f4abb72c846a436ea33eff (diff)
Precautions against using the PRNG uninitialized: RAND_bytes() now
returns int (1 = ok, 0 = not seeded). New function RAND_add() is the same as RAND_seed() but takes an estimate of the entropy as an additional argument.
Diffstat (limited to 'crypto/rand/rand.h')
-rw-r--r--crypto/rand/rand.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/crypto/rand/rand.h b/crypto/rand/rand.h
index fd8ee38366..35a3bb6e10 100644
--- a/crypto/rand/rand.h
+++ b/crypto/rand/rand.h
@@ -66,24 +66,41 @@ extern "C" {
typedef struct rand_meth_st
{
void (*seed)(const void *buf, int num);
- void (*bytes)(unsigned char *buf, int num);
+ int (*bytes)(unsigned char *buf, int num);
void (*cleanup)(void);
+ void (*add)(const void *buf, int num, int entropy);
} RAND_METHOD;
void RAND_set_rand_method(RAND_METHOD *meth);
RAND_METHOD *RAND_get_rand_method(void );
RAND_METHOD *RAND_SSLeay(void);
void RAND_cleanup(void );
-void RAND_bytes(unsigned char *buf,int num);
+int RAND_bytes(unsigned char *buf,int num);
void RAND_seed(const void *buf,int num);
+void RAND_add(const void *buf,int num,int entropy);
int RAND_load_file(const char *file,long max_bytes);
int RAND_write_file(const char *file);
char *RAND_file_name(char *file,int num);
#ifdef WINDOWS
void RAND_screen(void);
#endif
+void ERR_load_RAND_strings(void);
+
+/* BEGIN ERROR CODES */
+/* The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+
+/* Error codes for the RAND functions. */
+
+/* Function codes. */
+#define RAND_F_SSLEAY_RAND_BYTES 100
+
+/* Reason codes. */
+#define RAND_R_PRNG_NOT_SEEDED 100
+
#ifdef __cplusplus
}
#endif
-
#endif
+