Use RAND_METHOD for implementing RAND_status.
[openssl.git] / crypto / rand / rand_lib.c
index 2eb5e1218278dd0a5c46ad4c86e64355daddf67f..7da74aab0ef3364b58c31a4593818225ccdc1e41 100644 (file)
@@ -57,9 +57,8 @@
  */
 
 #include <stdio.h>
-#include <sys/types.h>
 #include <time.h>
-#include "rand.h"
+#include <openssl/rand.h>
 
 #ifdef NO_RAND
 static RAND_METHOD *rand_meth=NULL;
@@ -90,9 +89,29 @@ void RAND_seed(const void *buf, int num)
                rand_meth->seed(buf,num);
        }
 
-void RAND_bytes(unsigned char *buf, int num)
+void RAND_add(const void *buf, int num, double entropy)
        {
        if (rand_meth != NULL)
-               rand_meth->bytes(buf,num);
+               rand_meth->add(buf,num,entropy);
        }
 
+int RAND_bytes(unsigned char *buf, int num)
+       {
+       if (rand_meth != NULL)
+               return rand_meth->bytes(buf,num);
+       return(-1);
+       }
+
+int RAND_pseudo_bytes(unsigned char *buf, int num)
+       {
+       if (rand_meth != NULL)
+               return rand_meth->pseudorand(buf,num);
+       return(-1);
+       }
+
+int RAND_status(void)
+       {
+       if (rand_meth != NULL)
+               return rand_meth->status();
+       return 0;
+       }