Browse Source

[TLS] sys-crypto.h abstraction

personal/stbuehler/fix-fdevent
Glenn Strauss 3 years ago
parent
commit
368630d925
  1. 2
      src/Makefile.am
  2. 5
      src/algo_sha1.c
  3. 3
      src/algo_sha1.h
  4. 11
      src/configfile.c
  5. 4
      src/md5.c
  6. 5
      src/mod_authn_file.c
  7. 5
      src/mod_secdownload.c
  8. 4
      src/rand.c
  9. 3
      src/server.c

2
src/Makefile.am

@ -416,7 +416,7 @@ hdr = server.h base64.h buffer.h burl.h network.h log.h http_kv.h keyvalue.h \
mod_ssi.h mod_ssi_expr.h inet_ntop_cache.h \
configparser.h mod_ssi_exprparser.h \
rand.h \
sys-endian.h sys-mmap.h sys-socket.h sys-strings.h \
sys-crypto.h sys-endian.h sys-mmap.h sys-socket.h sys-strings.h \
mod_cml.h mod_cml_funcs.h \
safe_memclear.h sock_addr.h splaytree.h status_counter.h \
mod_magnet_cache.h

5
src/algo_sha1.c

@ -1,10 +1,7 @@
#include "first.h"
typedef int innocuous_typedef_to_quiet_empty_translation_unit_compiler_warning;
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#define USE_OPENSSL_CRYPTO
#endif
#include "sys-crypto.h"
#ifndef USE_OPENSSL_CRYPTO
#include "sys-endian.h"

3
src/algo_sha1.h

@ -2,7 +2,8 @@
#define INCLUDED_ALGO_SHA1_H
#include "first.h"
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#include "sys-crypto.h"
#ifdef USE_OPENSSL_CRYPTO
#include <openssl/sha.h>

11
src/configfile.c

@ -10,6 +10,7 @@
#include "configparser.h"
#include "configfile.h"
#include "stat_cache.h"
#include "sys-crypto.h"
#include <sys/stat.h>
#include <sys/wait.h>
@ -43,7 +44,7 @@ static void config_warn_authn_module (server *srv, const char *module, size_t le
}
#endif
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#ifdef USE_OPENSSL_CRYPTO
static void config_warn_openssl_module (server *srv) {
for (size_t i = 0; i < srv->config_context->used; ++i) {
const data_config *config = (data_config const*)srv->config_context->data[i];
@ -502,14 +503,14 @@ static int config_insert(server *srv) {
if (HANDLER_ERROR == ret) break;
}
#if !(defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H)
#ifndef USE_OPENSSL_CRYPTO
if (s->ssl_enabled) {
log_error_write(srv, __FILE__, __LINE__, "s",
"ssl support is missing, recompile with --with-openssl");
"ssl support is missing, recompile with e.g. --with-openssl");
ret = HANDLER_ERROR;
break;
}
#endif
#endif
}
array_free(http_parseopts);
@ -624,7 +625,7 @@ static int config_insert(server *srv) {
}
if (append_mod_openssl) {
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#ifdef USE_OPENSSL_CRYPTO
config_warn_openssl_module(srv);
#endif
}

4
src/md5.c

@ -33,9 +33,7 @@ documentation and/or software.
#define POINTER unsigned char *
#if 0 /* Note: not defined here or in lighttpd local "md5.h" */
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#define USE_OPENSSL_CRYPTO
#endif
#include "sys-crypto.h" /* USE_OPENSSL_CRYPTO */
#endif
#ifndef USE_OPENSSL_CRYPTO

5
src/mod_authn_file.c

@ -14,10 +14,7 @@
# define HAVE_CRYPT
#endif
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#define USE_OPENSSL_CRYPTO
#endif
#include "sys-crypto.h"
#ifdef USE_OPENSSL_CRYPTO
#include <openssl/md4.h>
#endif

5
src/mod_secdownload.c

@ -11,10 +11,7 @@
#include <stdlib.h>
#include <string.h>
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#define USE_OPENSSL_CRYPTO
#endif
#include "sys-crypto.h"
#ifdef USE_OPENSSL_CRYPTO
#include <openssl/evp.h>
#include <openssl/hmac.h>

4
src/rand.c

@ -14,9 +14,7 @@
#include <time.h>
#include <unistd.h>
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#define USE_OPENSSL_CRYPTO
#endif
#include "sys-crypto.h"
#ifdef USE_OPENSSL_CRYPTO
#include <openssl/opensslv.h> /* OPENSSL_VERSION_NUMBER */
#include <openssl/rand.h>

3
src/server.c

@ -71,7 +71,8 @@
# include <sys/prctl.h>
#endif
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
#include "sys-crypto.h"
#ifdef USE_OPENSSL_CRYPTO
#define USE_SSL
#define TEXT_SSL " (ssl)"
#else

Loading…
Cancel
Save