1From 1ad09f56d461e78ad83c77b654fb65467a68388b Mon Sep 17 00:00:00 2001 2From: Dennis Schridde <dennis.schridde@uni-heidelberg.de> 3Date: Wed, 30 Nov 2016 17:33:00 +0100 4Subject: [PATCH] ID:461 - OpenSSL 1.1 compatibility - "error: storage size 5 of 'ctx' isn't known" 6 7In OpenSSL 1.1 EVP_CIPHER_CTX became opaque, cf. `man 3ssl EVP_EncryptInit` 8 9Fixes: ID:461 10 11Upstream: https://github.com/ipmitool/ipmitool/commit/b57487e360916ab3eaa50aa6d021c73b6337a4a0 12 13Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com> 14--- 15 src/plugins/lanplus/lanplus_crypt_impl.c | 28 ++++++++++++++-------------- 16 1 file changed, 14 insertions(+), 14 deletions(-) 17 18diff --git a/src/plugins/lanplus/lanplus_crypt_impl.c b/src/plugins/lanplus/lanplus_crypt_impl.c 19index d5fac37..3c0df23 100644 20--- a/src/plugins/lanplus/lanplus_crypt_impl.c 21+++ b/src/plugins/lanplus/lanplus_crypt_impl.c 22@@ -164,10 +164,10 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv, 23 uint8_t * output, 24 uint32_t * bytes_written) 25 { 26- EVP_CIPHER_CTX ctx; 27- EVP_CIPHER_CTX_init(&ctx); 28- EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv); 29- EVP_CIPHER_CTX_set_padding(&ctx, 0); 30+ EVP_CIPHER_CTX* ctx; 31+ EVP_CIPHER_CTX_init(ctx); 32+ EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv); 33+ EVP_CIPHER_CTX_set_padding(ctx, 0); 34 35 36 *bytes_written = 0; 37@@ -191,7 +191,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv, 38 assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0); 39 40 41- if(!EVP_EncryptUpdate(&ctx, output, (int *)bytes_written, input, input_length)) 42+ if(!EVP_EncryptUpdate(ctx, output, (int *)bytes_written, input, input_length)) 43 { 44 /* Error */ 45 *bytes_written = 0; 46@@ -201,7 +201,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv, 47 { 48 uint32_t tmplen; 49 50- if(!EVP_EncryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen)) 51+ if(!EVP_EncryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen)) 52 { 53 *bytes_written = 0; 54 return; /* Error */ 55@@ -210,7 +210,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv, 56 { 57 /* Success */ 58 *bytes_written += tmplen; 59- EVP_CIPHER_CTX_cleanup(&ctx); 60+ EVP_CIPHER_CTX_cleanup(ctx); 61 } 62 } 63 } 64@@ -239,10 +239,10 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv, 65 uint8_t * output, 66 uint32_t * bytes_written) 67 { 68- EVP_CIPHER_CTX ctx; 69- EVP_CIPHER_CTX_init(&ctx); 70- EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv); 71- EVP_CIPHER_CTX_set_padding(&ctx, 0); 72+ EVP_CIPHER_CTX* ctx; 73+ EVP_CIPHER_CTX_init(ctx); 74+ EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv); 75+ EVP_CIPHER_CTX_set_padding(ctx, 0); 76 77 78 if (verbose >= 5) 79@@ -266,7 +266,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv, 80 assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0); 81 82 83- if (!EVP_DecryptUpdate(&ctx, output, (int *)bytes_written, input, input_length)) 84+ if (!EVP_DecryptUpdate(ctx, output, (int *)bytes_written, input, input_length)) 85 { 86 /* Error */ 87 lprintf(LOG_DEBUG, "ERROR: decrypt update failed"); 88@@ -277,7 +277,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv, 89 { 90 uint32_t tmplen; 91 92- if (!EVP_DecryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen)) 93+ if (!EVP_DecryptFinal_ex(ctx, output + *bytes_written, (int *)&tmplen)) 94 { 95 char buffer[1000]; 96 ERR_error_string(ERR_get_error(), buffer); 97@@ -290,7 +290,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv, 98 { 99 /* Success */ 100 *bytes_written += tmplen; 101- EVP_CIPHER_CTX_cleanup(&ctx); 102+ EVP_CIPHER_CTX_cleanup(ctx); 103 } 104 } 105 106-- 1071.9.1 108 109