summaryrefslogtreecommitdiff
path: root/entropy.c
diff options
context:
space:
mode:
authordjm <djm>2001-02-26 22:20:57 +0000
committerdjm <djm>2001-02-26 22:20:57 +0000
commit92790e91b6ec9dc7a5a8537ac98a2bd33f60e3f1 (patch)
treecf303f74e8ae4668c604a13b480f9106de060f36 /entropy.c
parentc8d9fa639b51977f4d6873da380d0f1e2940f65f (diff)
downloadopenssh-92790e91b6ec9dc7a5a8537ac98a2bd33f60e3f1.tar.gz
- (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();