summaryrefslogtreecommitdiff
path: root/entropy.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-02-27 09:20:57 +1100
committerDamien Miller <djm@mindrot.org>2001-02-27 09:20:57 +1100
commit767c7fc27cac2ecbb2d8248369c0b93d8901f30f (patch)
tree641537031f8a7084af622f86502cb22eafb816ad /entropy.c
parent31a501d21ef91a84a2fe09f91dda9b6a850d8840 (diff)
- (djm) fatal() on OpenSSL version mismatch
Diffstat (limited to 'entropy.c')
-rw-r--r--entropy.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/entropy.c b/entropy.c
index 9743e598..2b983bba 100644
--- a/entropy.c
+++ b/entropy.c
@@ -26,6 +26,7 @@
#include <openssl/rand.h>
#include <openssl/sha.h>
+#include <openssl/crypto.h>
/* SunOS 4.4.4 needs this */
#ifdef HAVE_FLOATINGPOINT_H
@@ -39,7 +40,7 @@
#include "pathnames.h"
#include "log.h"
-RCSID("$Id: entropy.c,v 1.31 2001/02/26 21:39:07 djm Exp $");
+RCSID("$Id: entropy.c,v 1.32 2001/02/26 22:20:58 djm Exp $");
#ifndef offsetof
# define offsetof(type, member) ((size_t) &((type *)0)->member)
@@ -67,6 +68,14 @@ RCSID("$Id: entropy.c,v 1.31 2001/02/26 21:39:07 djm Exp $");
# define SAVED_IDS_WORK_WITH_SETEUID
#endif
+void check_openssl_version(void)
+{
+ if (SSLeay() != OPENSSL_VERSION_NUMBER)
+ fatal("OpenSSL version mismatch. Built against %x, you "
+ "have %x", OPENSSL_VERSION_NUMBER, SSLeay());
+}
+
+
#if defined(EGD_SOCKET) || defined(RANDOM_POOL)
#ifdef EGD_SOCKET
@@ -188,8 +197,10 @@ seed_rng(void)
memset(buf, '\0', sizeof(buf));
}
-/* No-op */
-void init_rng(void) {}
+void init_rng(void)
+{
+ check_openssl_version();
+}
#else /* defined(EGD_SOCKET) || defined(RANDOM_POOL) */
@@ -818,6 +829,8 @@ void init_rng(void)
{
int original_euid;
+ check_openssl_version();
+
original_uid = getuid();
original_euid = geteuid();