- (djm) fatal() on OpenSSL version mismatch

This commit is contained in:
Damien Miller 2001-02-27 09:20:57 +11:00
parent 31a501d21e
commit 767c7fc27c
2 changed files with 18 additions and 4 deletions

View File

@ -10,6 +10,7 @@
- (djm) Fix up POSIX saved uid support. Report from Mark Miller
<markm@swoon.net>
- (djm) Search for -lcrypt on FreeBSD too
- (djm) fatal() on OpenSSL version mismatch
20010226
- (bal) Fixed bsd-snprinf.c so it now honors 'BROKEN_SNPRINTF' again.
@ -4144,4 +4145,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
$Id: ChangeLog,v 1.829 2001/02/26 22:11:59 mouring Exp $
$Id: ChangeLog,v 1.830 2001/02/26 22:20:57 djm Exp $

View File

@ -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();