summarylogtreecommitdiffstats
path: root/openssl-1.1.X.patch
blob: 6b7160a1e799443d133430ae9eedbcf754396c12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
diff -ruN karlyriceditor-2.2/src/kfn_file_parser.cpp karlyriceditor-2.2-fixed/src/kfn_file_parser.cpp
--- karlyriceditor-2.2/src/kfn_file_parser.cpp	2013-02-05 08:52:34.795945000 +0700
+++ karlyriceditor-2.2-fixed/src/kfn_file_parser.cpp	2017-07-11 02:04:10.331059063 +0700
@@ -314,10 +314,9 @@
 
 #if defined (KFN_SUPPORT_ENCRYPTION)
 	// A file is encrypted, decrypt it
-	EVP_CIPHER_CTX ctx;
-	EVP_CIPHER_CTX_init( &ctx );
+	EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
 
-	EVP_DecryptInit_ex( &ctx, EVP_aes_128_ecb(), 0, (const unsigned char*) m_aesKey.data(), 0 );
+	EVP_DecryptInit_ex( ctx, EVP_aes_128_ecb(), 0, (const unsigned char*) m_aesKey.data(), 0 );
 
 	QByteArray array( entry.length_out, 0 );
 	int total_in = 0, total_out = 0;
@@ -335,15 +334,15 @@
 
 		if ( bytesRead != toRead )
 		{
-			EVP_CIPHER_CTX_cleanup( &ctx );
+			EVP_CIPHER_CTX_free(ctx);
 			m_errorMsg = "File truncated";
 			return QByteArray();
 		}
 
 		// Decrypt the content
-		if ( !EVP_DecryptUpdate( &ctx, (unsigned char*) outbuf, &toWrite, (unsigned char*) buffer, bytesRead ) )
+		if ( !EVP_DecryptUpdate( ctx, (unsigned char*) outbuf, &toWrite, (unsigned char*) buffer, bytesRead ) )
 		{
-			EVP_CIPHER_CTX_cleanup( &ctx );
+			EVP_CIPHER_CTX_free(ctx);
 			m_errorMsg = "Decryption failed";
 			return QByteArray();
 		}
@@ -353,7 +352,7 @@
 		total_in += bytesRead;
 	}
 
-	EVP_CIPHER_CTX_cleanup( &ctx );
+	EVP_CIPHER_CTX_free(ctx);
 	return array;
 #else
 	m_errorMsg = "File is encrypted, but decryption support is not compiled in";