1From fc2136969adfb926eed610b8ed0a74b2030b48ed Mon Sep 17 00:00:00 2001
2From: Rosen Penev <rosenp@gmail.com>
3Date: Tue, 21 Aug 2018 19:29:07 -0700
4Subject: [PATCH] lanplus: Fix compile with deprecated APIs disabled.
5
6From the man page:
7
8EVP_CIPHER_CTX was made opaque in OpenSSL 1.1.0. As a result,
9EVP_CIPHER_CTX_reset() appeared and EVP_CIPHER_CTX_cleanup() disappeared.
10EVP_CIPHER_CTX_init() remains as an alias for EVP_CIPHER_CTX_reset().
11
12Upstream: https://github.com/ipmitool/ipmitool/commit/a8862d7508fb138b1c286eea958700cca63c9476
13
14Signed-off-by: Rosen Penev <rosenp@gmail.com>
15Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
16---
17 src/plugins/lanplus/lanplus_crypt_impl.c | 8 ++++++++
18 1 file changed, 8 insertions(+)
19
20diff --git a/src/plugins/lanplus/lanplus_crypt_impl.c b/src/plugins/lanplus/lanplus_crypt_impl.c
21index 9652a5e..e94401e 100644
22--- a/src/plugins/lanplus/lanplus_crypt_impl.c
23+++ b/src/plugins/lanplus/lanplus_crypt_impl.c
24@@ -183,7 +183,11 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv,
25 		lprintf(LOG_DEBUG, "ERROR: EVP_CIPHER_CTX_new() failed");
26 		return;
27 	}
28+#if OPENSSL_VERSION_NUMBER < 0x10100000L
29 	EVP_CIPHER_CTX_init(ctx);
30+#else
31+	EVP_CIPHER_CTX_reset(ctx);
32+#endif
33 	EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
34 	EVP_CIPHER_CTX_set_padding(ctx, 0);
35
36@@ -262,7 +266,11 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv,
37 		lprintf(LOG_DEBUG, "ERROR: EVP_CIPHER_CTX_new() failed");
38 		return;
39 	}
40+#if OPENSSL_VERSION_NUMBER < 0x10100000L
41 	EVP_CIPHER_CTX_init(ctx);
42+#else
43+	EVP_CIPHER_CTX_reset(ctx);
44+#endif
45 	EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv);
46 	EVP_CIPHER_CTX_set_padding(ctx, 0);
47
48--
491.9.1
50
51