*/
#include <stdio.h>
-#include <sys/types.h>
#include <time.h>
#include <string.h>
-#include "e_os.h"
-#include "crypto.h"
+
+#include "openssl/e_os.h"
+
+#include <openssl/crypto.h>
#if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND)
-#ifndef NO_MD5
-#define USE_MD5_RAND
-#elif !defined(NO_SHA1)
+#if !defined(NO_SHA) && !defined(NO_SHA1)
#define USE_SHA1_RAND
-#elif !defined(NO_MDC2)
+#elif !defined(NO_MD5)
+#define USE_MD5_RAND
+#elif !defined(NO_MDC2) && !defined(NO_DES)
#define USE_MDC2_RAND
#elif !defined(NO_MD2)
#define USE_MD2_RAND
#else
-We need a message digest of some type
+#error No message digest algorithm available
#endif
#endif
*/
#if defined(USE_MD5_RAND)
-#include "md5.h"
+#include <openssl/md5.h>
#define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH
#define MD_CTX MD5_CTX
#define MD_Init(a) MD5_Init(a)
#define MD_Final(a,b) MD5_Final(a,b)
#define MD(a,b,c) MD5(a,b,c)
#elif defined(USE_SHA1_RAND)
-#include "sha.h"
+#include <openssl/sha.h>
#define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH
#define MD_CTX SHA_CTX
#define MD_Init(a) SHA1_Init(a)
#define MD_Final(a,b) SHA1_Final(a,b)
#define MD(a,b,c) SHA1(a,b,c)
#elif defined(USE_MDC2_RAND)
-#include "mdc2.h"
+#include <openssl/mdc2.h>
#define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH
#define MD_CTX MDC2_CTX
#define MD_Init(a) MDC2_Init(a)
#define MD_Final(a,b) MDC2_Final(a,b)
#define MD(a,b,c) MDC2(a,b,c)
#elif defined(USE_MD2_RAND)
-#include "md2.h"
+#include <openssl/md2.h>
#define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH
#define MD_CTX MD2_CTX
#define MD_Init(a) MD2_Init(a)
#define MD(a,b,c) MD2(a,b,c)
#endif
-#include "rand.h"
+#include <openssl/rand.h>
/* #define NORAND 1 */
/* #define PREDICT 1 */
if (init)
{
- init=0;
CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
/* put in some default random data, we need more than
* just this */
l=time(NULL);
RAND_seed(&l,sizeof(l));
-/* #ifdef DEVRANDOM */
+#ifdef DEVRANDOM
/*
* Use a random entropy pool device.
* Linux 1.3.x and FreeBSD-Current has
RAND_seed(tmpbuf,32);
memset(tmpbuf,0,32);
}
-/* #endif */
+#endif
#ifdef PURIFY
memset(state,0,STATE_SIZE);
memset(md,0,MD_DIGEST_LENGTH);
#endif
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
+ init=0;
}
st_idx=state_index;
#ifdef WINDOWS
#include <windows.h>
-#include <rand.h>
+#include <openssl/rand.h>
/*****************************************************************************
* Initialisation function for the SSL random generator. Takes the contents