You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2017/10/08 11:32:30 UTC
svn commit: r1811471 - in /apr/apr-util/branches/1.6.x: ./ CHANGES
crypto/apr_crypto_openssl.c
Author: ylavic
Date: Sun Oct 8 11:32:30 2017
New Revision: 1811471
URL: http://svn.apache.org/viewvc?rev=1811471&view=rev
Log:
Merge r1811470 from trunk:
apr_crypto: Fix compatibility with LibreSSL. PR 61596.
Proposed by: Bernard Spil <brnrd freebsd.org>
Reviewed by: ylavic
Modified:
apr/apr-util/branches/1.6.x/ (props changed)
apr/apr-util/branches/1.6.x/CHANGES
apr/apr-util/branches/1.6.x/crypto/apr_crypto_openssl.c
Propchange: apr/apr-util/branches/1.6.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Oct 8 11:32:30 2017
@@ -1,4 +1,4 @@
-/apr/apr/trunk:781403,781409,784519,784592,789965,794508,917837-917838,982408-982409,998533,1086937,1127053,1127648,1128838,1129433,1133587,1207704,1210524,1211987,1214516,1308087,1308131,1308318,1327636,1340286,1346865,1357761,1357772,1357780,1357966,1357968,1357979,1358295,1358480,1361811,1362241,1362248,1362252,1362255,1363076,1369681,1370626,1371811,1371817,1371919,1371923,1382174,1389154,1389169,1390461,1390477,1402870,1402897,1402903,1402907,1406088,1422413,1425356,1426442,1426448,1438960,1449308,1449314,1460185,1460243-1460244,1462219,1462224,1484271,1493715,1495887,1495889,1496407,1516261,1523479,1529554,1531009,1541054,1543399,1544846,1618843,1619438,1625247,1626561,1648830,1711657,1722547,1728958,1728963,1747941,1751567,1751806,1751898,1752008,1763665,1763667,1763669,1763672-1763673,1763842-1763843,1765378,1772414,1778153,1781391,1782042,1782045,1788335,1789947,1809394
+/apr/apr/trunk:781403,781409,784519,784592,789965,794508,917837-917838,982408-982409,998533,1086937,1127053,1127648,1128838,1129433,1133587,1207704,1210524,1211987,1214516,1308087,1308131,1308318,1327636,1340286,1346865,1357761,1357772,1357780,1357966,1357968,1357979,1358295,1358480,1361811,1362241,1362248,1362252,1362255,1363076,1369681,1370626,1371811,1371817,1371919,1371923,1382174,1389154,1389169,1390461,1390477,1402870,1402897,1402903,1402907,1406088,1422413,1425356,1426442,1426448,1438960,1449308,1449314,1460185,1460243-1460244,1462219,1462224,1484271,1493715,1495887,1495889,1496407,1516261,1523479,1529554,1531009,1541054,1543399,1544846,1618843,1619438,1625247,1626561,1648830,1711657,1722547,1728958,1728963,1747941,1751567,1751806,1751898,1752008,1763665,1763667,1763669,1763672-1763673,1763842-1763843,1765378,1772414,1778153,1781391,1782042,1782045,1788335,1789947,1809394,1811470
/apr/apr-util/branches/1.3.x:896410,1154885
/apr/apr-util/branches/1.4.x:1126217,1211211,1211219,1211223,1211330
/apr/apr-util/branches/1.5.x:1757430
Modified: apr/apr-util/branches/1.6.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.6.x/CHANGES?rev=1811471&r1=1811470&r2=1811471&view=diff
==============================================================================
--- apr/apr-util/branches/1.6.x/CHANGES [utf-8] (original)
+++ apr/apr-util/branches/1.6.x/CHANGES [utf-8] Sun Oct 8 11:32:30 2017
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with APR-util 1.6.1
+ *) apr_crypto: Fix compatibility with LibreSSL. PR 61596.
+ [Bernard Spil <brnrd freebsd.org>, Yann Ylavic]
+
*) sdbm: better database/page validation to fail cleanly when corrupted.
[Yann Ylavic]
Modified: apr/apr-util/branches/1.6.x/crypto/apr_crypto_openssl.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.6.x/crypto/apr_crypto_openssl.c?rev=1811471&r1=1811470&r2=1811471&view=diff
==============================================================================
--- apr/apr-util/branches/1.6.x/crypto/apr_crypto_openssl.c (original)
+++ apr/apr-util/branches/1.6.x/crypto/apr_crypto_openssl.c Sun Oct 8 11:32:30 2017
@@ -31,10 +31,23 @@
#if APU_HAVE_CRYPTO
#include <openssl/evp.h>
+#include <openssl/rand.h>
#include <openssl/engine.h>
#define LOG_PREFIX "apr_crypto_openssl: "
+#ifndef APR_USE_OPENSSL_PRE_1_1_API
+#if defined(LIBRESSL_VERSION_NUMBER)
+/* LibreSSL declares OPENSSL_VERSION_NUMBER == 2.0 but does not include most
+ * changes from OpenSSL >= 1.1 (new functions, macros, deprecations, ...), so
+ * we have to work around this...
+ */
+#define APR_USE_OPENSSL_PRE_1_1_API (1)
+#else
+#define APR_USE_OPENSSL_PRE_1_1_API (OPENSSL_VERSION_NUMBER < 0x10100000L)
+#endif
+#endif
+
struct apr_crypto_t {
apr_pool_t *pool;
const apr_crypto_driver_t *provider;
@@ -117,8 +130,8 @@ static apr_status_t crypto_shutdown_help
static apr_status_t crypto_init(apr_pool_t *pool, const char *params,
const apu_err_t **result)
{
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
- CRYPTO_malloc_init();
+#if APR_USE_OPENSSL_PRE_1_1_API
+ (void)CRYPTO_malloc_init();
#else
OPENSSL_malloc_init();
#endif
@@ -721,7 +734,7 @@ static apr_status_t crypto_block_encrypt
if (!EVP_EncryptUpdate(ctx->cipherCtx, (*out), &outl,
(unsigned char *) in, inlen)) {
#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if APR_USE_OPENSSL_PRE_1_1_API
EVP_CIPHER_CTX_cleanup(ctx->cipherCtx);
#else
EVP_CIPHER_CTX_reset(ctx->cipherCtx);
@@ -764,7 +777,7 @@ static apr_status_t crypto_block_encrypt
else {
*outlen = len;
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if APR_USE_OPENSSL_PRE_1_1_API
EVP_CIPHER_CTX_cleanup(ctx->cipherCtx);
#else
EVP_CIPHER_CTX_reset(ctx->cipherCtx);
@@ -891,7 +904,7 @@ static apr_status_t crypto_block_decrypt
if (!EVP_DecryptUpdate(ctx->cipherCtx, *out, &outl, (unsigned char *) in,
inlen)) {
#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if APR_USE_OPENSSL_PRE_1_1_API
EVP_CIPHER_CTX_cleanup(ctx->cipherCtx);
#else
EVP_CIPHER_CTX_reset(ctx->cipherCtx);
@@ -934,7 +947,7 @@ static apr_status_t crypto_block_decrypt
else {
*outlen = len;
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if APR_USE_OPENSSL_PRE_1_1_API
EVP_CIPHER_CTX_cleanup(ctx->cipherCtx);
#else
EVP_CIPHER_CTX_reset(ctx->cipherCtx);