Reduce header interdependencies, initially in engine.h (the rest of the
[openssl.git] / crypto / rand / rand.h
index d4d8fbe9102a56fc522330499b7f9b95bfebad0f..6f544994ce2ed3a31cac921a2ff5632daad28248 100644 (file)
 #ifndef HEADER_RAND_H
 #define HEADER_RAND_H
 
+#include <stdlib.h>
+#include <openssl/ossl_typ.h>
 #include <openssl/e_os2.h>
 
-#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
+#if defined(OPENSSL_SYS_WINDOWS)
 #include <windows.h>
-#else
-#include <sys/types.h>
 #endif
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
-typedef struct rand_meth_st
+/* Already defined in ossl_typ.h */
+/* typedef struct rand_meth_st RAND_METHOD; */
+
+struct rand_meth_st
        {
        void (*seed)(const void *buf, int num);
        int (*bytes)(unsigned char *buf, int num);
@@ -79,16 +82,17 @@ typedef struct rand_meth_st
        void (*add)(const void *buf, int num, double entropy);
        int (*pseudorand)(unsigned char *buf, int num);
        int (*status)(void);
-       } RAND_METHOD;
+       };
 
 #ifdef BN_DEBUG
 extern int rand_predictable;
 #endif
 
-struct engine_st;
-
-int RAND_set_rand_method(struct engine_st *meth);
-RAND_METHOD *RAND_get_rand_method(void );
+int RAND_set_rand_method(const RAND_METHOD *meth);
+const RAND_METHOD *RAND_get_rand_method(void);
+#ifndef OPENSSL_NO_ENGINE
+int RAND_set_rand_engine(ENGINE *engine);
+#endif
 RAND_METHOD *RAND_SSLeay(void);
 void RAND_cleanup(void );
 int  RAND_bytes(unsigned char *buf,int num);
@@ -102,7 +106,6 @@ int RAND_status(void);
 int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes);
 int RAND_egd(const char *path);
 int RAND_egd_bytes(const char *path,int bytes);
-void ERR_load_RAND_strings(void);
 int RAND_poll(void);
 
 #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
@@ -112,22 +115,22 @@ int RAND_event(UINT, WPARAM, LPARAM);
 
 #endif
 
-#ifdef  __cplusplus
-}
-#endif
-
 /* 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.
  */
+void ERR_load_RAND_strings(void);
 
 /* Error codes for the RAND functions. */
 
 /* Function codes. */
+#define RAND_F_RAND_GET_RAND_METHOD                     101
 #define RAND_F_SSLEAY_RAND_BYTES                        100
 
 /* Reason codes. */
 #define RAND_R_PRNG_NOT_SEEDED                          100
 
+#ifdef  __cplusplus
+}
+#endif
 #endif
-