Skip to content

Commit

Permalink
mod_md: Fix/axe incorrect MD_USE_OPENSSL_PRE_1_1_API definition.
Browse files Browse the repository at this point in the history
Borrowed from mod_ssl, now fixed there (r1908537) so follow up in mod_md..



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1913837 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
ylavic committed Nov 16, 2023
1 parent 0b06bfa commit a692cfe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
27 changes: 7 additions & 20 deletions modules/md/md_crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,11 @@
#include <process.h>
#endif

#if defined(LIBRESSL_VERSION_NUMBER)
/* Missing from LibreSSL */
#define MD_USE_OPENSSL_PRE_1_1_API (LIBRESSL_VERSION_NUMBER < 0x2070000f)
#else /* defined(LIBRESSL_VERSION_NUMBER) */
#define MD_USE_OPENSSL_PRE_1_1_API (OPENSSL_VERSION_NUMBER < 0x10100000L)
#endif

#if (defined(LIBRESSL_VERSION_NUMBER) && (LIBRESSL_VERSION_NUMBER < 0x3050000fL)) || (OPENSSL_VERSION_NUMBER < 0x10100000L)
#if !defined(OPENSSL_NO_CT) \
&& OPENSSL_VERSION_NUMBER >= 0x10100000L \
&& (!defined(LIBRESSL_VERSION_NUMBER) \
|| LIBRESSL_VERSION_NUMBER >= 0x3050000fL)
/* Missing from LibreSSL < 3.5.0 and only available since OpenSSL v1.1.x */
#ifndef OPENSSL_NO_CT
#define OPENSSL_NO_CT
#endif
#endif

#ifndef OPENSSL_NO_CT
#include <openssl/ct.h>
#endif

Expand Down Expand Up @@ -955,12 +945,9 @@ apr_status_t md_pkey_gen(md_pkey_t **ppkey, apr_pool_t *p, md_pkey_spec_t *spec)
}
}

#if MD_USE_OPENSSL_PRE_1_1_API || (defined(LIBRESSL_VERSION_NUMBER) && \
LIBRESSL_VERSION_NUMBER < 0x2070000f)

#ifndef NID_tlsfeature
#define NID_tlsfeature 1020
#endif
#if OPENSSL_VERSION_NUMBER < 0x10100000L \
|| (defined(LIBRESSL_VERSION_NUMBER) \
&& LIBRESSL_VERSION_NUMBER < 0x2070000f)

static void RSA_get0_key(const RSA *r,
const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
Expand Down
11 changes: 3 additions & 8 deletions modules/md/md_ocsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@
#include <openssl/pem.h>
#include <openssl/x509v3.h>

#if defined(LIBRESSL_VERSION_NUMBER)
/* Missing from LibreSSL */
#define MD_USE_OPENSSL_PRE_1_1_API (LIBRESSL_VERSION_NUMBER < 0x2070000f)
#else /* defined(LIBRESSL_VERSION_NUMBER) */
#define MD_USE_OPENSSL_PRE_1_1_API (OPENSSL_VERSION_NUMBER < 0x10100000L)
#endif

#include "md.h"
#include "md_crypt.h"
#include "md_event.h"
Expand Down Expand Up @@ -563,7 +556,9 @@ static const char *single_resp_summary(OCSP_SINGLERESP* resp, apr_pool_t *p)
ASN1_GENERALIZEDTIME *bup = NULL, *bnextup = NULL;
md_timeperiod_t valid;

#if MD_USE_OPENSSL_PRE_1_1_API
#if OPENSSL_VERSION_NUMBER < 0x10100000L \
|| (defined(LIBRESSL_VERSION_NUMBER) \
&& LIBRESSL_VERSION_NUMBER < 0x2070000f)
certid = resp->certId;
#else
certid = OCSP_SINGLERESP_get0_id(resp);
Expand Down

0 comments on commit a692cfe

Please sign in to comment.