summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2018-06-21 11:00:49 +0000
committerYann Ylavic <ylavic@apache.org>2018-06-21 11:00:49 +0000
commit1c7430f17ef2a16f32509e33f46be8484c094066 (patch)
treeb9819190ac306fe9789f59271e6e0926d11248ee /crypto
parentcb82042ea25a067f241d9b6a10463364ff4fffb9 (diff)
downloadapr-1c7430f17ef2a16f32509e33f46be8484c094066.tar.gz
apr_crypto: follow up to r1833599: simpler #ifdef-ery.
Turn multiple checks for {Open,Libre}SSL versions into a single one by: #define EVP_CIPHER_CTX_reset EVP_CIPHER_CTX_cleanup when needed. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1833995 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'crypto')
-rw-r--r--crypto/apr_crypto_openssl.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/crypto/apr_crypto_openssl.c b/crypto/apr_crypto_openssl.c
index c4b06ab05..b7bed223a 100644
--- a/crypto/apr_crypto_openssl.c
+++ b/crypto/apr_crypto_openssl.c
@@ -37,6 +37,10 @@
#define LOG_PREFIX "apr_crypto_openssl: "
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+#define EVP_CIPHER_CTX_reset EVP_CIPHER_CTX_cleanup
+#endif
+
struct apr_crypto_t {
apr_pool_t *pool;
const apr_crypto_driver_t *provider;
@@ -677,11 +681,7 @@ static apr_status_t crypto_block_encrypt(unsigned char **out,
if (!EVP_EncryptUpdate(ctx->cipherCtx, (*out), &outl,
(unsigned char *) in, inlen)) {
#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- EVP_CIPHER_CTX_cleanup(ctx->cipherCtx);
-#else
EVP_CIPHER_CTX_reset(ctx->cipherCtx);
-#endif
return APR_ECRYPT;
}
*outlen = outl;
@@ -720,11 +720,7 @@ static apr_status_t crypto_block_encrypt_finish(unsigned char *out,
else {
*outlen = len;
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- EVP_CIPHER_CTX_cleanup(ctx->cipherCtx);
-#else
EVP_CIPHER_CTX_reset(ctx->cipherCtx);
-#endif
return rc;
@@ -847,11 +843,7 @@ static apr_status_t crypto_block_decrypt(unsigned char **out,
if (!EVP_DecryptUpdate(ctx->cipherCtx, *out, &outl, (unsigned char *) in,
inlen)) {
#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- EVP_CIPHER_CTX_cleanup(ctx->cipherCtx);
-#else
EVP_CIPHER_CTX_reset(ctx->cipherCtx);
-#endif
return APR_ECRYPT;
}
*outlen = outl;
@@ -890,11 +882,7 @@ static apr_status_t crypto_block_decrypt_finish(unsigned char *out,
else {
*outlen = len;
}
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- EVP_CIPHER_CTX_cleanup(ctx->cipherCtx);
-#else
EVP_CIPHER_CTX_reset(ctx->cipherCtx);
-#endif
return rc;