wok-current view qupzilla/stuff/openssl-1.1-support.patch @ rev 25698

Fix ntfs-3g receipt
author Stanislas Leduc <shann@slitaz.org>
date Tue Apr 16 19:01:01 2024 +0000 (5 months ago)
parents
children
line source
1 --- a/src/lib/tools/aesinterface.cpp
2 +++ b/src/lib/tools/aesinterface.cpp
3 @@ -39,14 +39,18 @@
4 : QObject(parent)
5 , m_ok(false)
6 {
7 - EVP_CIPHER_CTX_init(&m_encodeCTX);
8 - EVP_CIPHER_CTX_init(&m_decodeCTX);
9 + m_encodeCTX = EVP_CIPHER_CTX_new();
10 + m_decodeCTX = EVP_CIPHER_CTX_new();
11 + EVP_CIPHER_CTX_init(m_encodeCTX);
12 + EVP_CIPHER_CTX_init(m_decodeCTX);
13 }
15 AesInterface::~AesInterface()
16 {
17 - EVP_CIPHER_CTX_cleanup(&m_encodeCTX);
18 - EVP_CIPHER_CTX_cleanup(&m_decodeCTX);
19 + EVP_CIPHER_CTX_cleanup(m_encodeCTX);
20 + EVP_CIPHER_CTX_cleanup(m_decodeCTX);
21 + EVP_CIPHER_CTX_free(m_encodeCTX);
22 + EVP_CIPHER_CTX_free(m_decodeCTX);
23 }
25 bool AesInterface::isOk()
26 @@ -78,10 +82,10 @@
27 int result = 0;
28 if (evpMode == EVP_PKEY_MO_ENCRYPT) {
29 m_iVector = createRandomData(EVP_MAX_IV_LENGTH);
30 - result = EVP_EncryptInit_ex(&m_encodeCTX, EVP_aes_256_cbc(), NULL, key, (uchar*)m_iVector.constData());
31 + result = EVP_EncryptInit_ex(m_encodeCTX, EVP_aes_256_cbc(), NULL, key, (uchar*)m_iVector.constData());
32 }
33 else if (evpMode == EVP_PKEY_MO_DECRYPT) {
34 - result = EVP_DecryptInit_ex(&m_decodeCTX, EVP_aes_256_cbc(), NULL, key, (uchar*)iVector.constData());
35 + result = EVP_DecryptInit_ex(m_decodeCTX, EVP_aes_256_cbc(), NULL, key, (uchar*)iVector.constData());
36 }
38 if (result == 0) {
39 @@ -106,14 +110,14 @@
40 uchar* ciphertext = (uchar*)malloc(cipherlength);
42 // allows reusing of 'm_encodeCTX' for multiple encryption cycles
43 - EVP_EncryptInit_ex(&m_encodeCTX, NULL, NULL, NULL, NULL);
44 + EVP_EncryptInit_ex(m_encodeCTX, NULL, NULL, NULL, NULL);
46 // update ciphertext, c_len is filled with the length of ciphertext generated,
47 // dataLength is the size of plaintext in bytes
48 - EVP_EncryptUpdate(&m_encodeCTX, ciphertext, &cipherlength, (uchar*)plainData.data(), dataLength);
49 + EVP_EncryptUpdate(m_encodeCTX, ciphertext, &cipherlength, (uchar*)plainData.data(), dataLength);
51 // update ciphertext with the final remaining bytes
52 - EVP_EncryptFinal_ex(&m_encodeCTX, ciphertext + cipherlength, &finalLength);
53 + EVP_EncryptFinal_ex(m_encodeCTX, ciphertext + cipherlength, &finalLength);
55 dataLength = cipherlength + finalLength;
56 QByteArray out((char*)ciphertext, dataLength);
57 @@ -163,9 +167,9 @@
58 // because we have padding ON, we must allocate an extra cipher block size of memory
59 uchar* plainText = (uchar*)malloc(plainTextLength + AES_BLOCK_SIZE);
61 - EVP_DecryptInit_ex(&m_decodeCTX, NULL, NULL, NULL, NULL);
62 - EVP_DecryptUpdate(&m_decodeCTX, plainText, &plainTextLength, cipherText, cipherLength);
63 - int success = EVP_DecryptFinal_ex(&m_decodeCTX, plainText + plainTextLength, &finalLength);
64 + EVP_DecryptInit_ex(m_decodeCTX, NULL, NULL, NULL, NULL);
65 + EVP_DecryptUpdate(m_decodeCTX, plainText, &plainTextLength, cipherText, cipherLength);
66 + int success = EVP_DecryptFinal_ex(m_decodeCTX, plainText + plainTextLength, &finalLength);
68 cipherLength = plainTextLength + finalLength;
70 --- a/src/lib/tools/aesinterface.h
71 +++ b/src/lib/tools/aesinterface.h
72 @@ -50,8 +50,8 @@
73 private:
74 bool init(int evpMode, const QByteArray &password, const QByteArray &iVector = QByteArray());
76 - EVP_CIPHER_CTX m_encodeCTX;
77 - EVP_CIPHER_CTX m_decodeCTX;
78 + EVP_CIPHER_CTX *m_encodeCTX;
79 + EVP_CIPHER_CTX *m_decodeCTX;
81 bool m_ok;
82 QByteArray m_iVector;