#include <stdio.h>
#include <string.h>
#include <openssl/engine.h>
+#include <openssl/rand.h>
+#include <openssl/err.h>
#if (defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
defined(__x86_64) || defined(__x86_64__) || \
size_t OPENSSL_ia32_rdrand(void);
-static int get_random_bytes (unsigned char *buf, size_t num)
+static int get_random_bytes (unsigned char *buf, int num)
{
size_t rnd;
- while (num>=sizeof(size_t)) {
+ while (num>=(int)sizeof(size_t)) {
if ((rnd = OPENSSL_ia32_rdrand()) == 0) return 0;
*((size_t *)buf) = rnd;
void ENGINE_load_rdrand (void)
{
- extern OPENSSL_ia32cap_P[];
+ extern unsigned int OPENSSL_ia32cap_P[];
if (OPENSSL_ia32cap_P[1] & (1<<(62-32)))
{