Link Here
|
1 |
--- src/engine/openssl/ossl_bc.cpp.orig 2018-10-15 00:16:53 UTC |
1 |
--- src/engine/openssl/ossl_bc.cpp.orig 2017-10-02 06:00:00 UTC |
2 |
+++ src/engine/openssl/ossl_bc.cpp |
2 |
+++ src/engine/openssl/ossl_bc.cpp |
3 |
@@ -8,10 +8,6 @@ |
3 |
@@ -8,10 +8,6 @@ |
4 |
#include <botan/internal/openssl_engine.h> |
4 |
#include <botan/internal/openssl_engine.h> |
Link Here
|
11 |
namespace Botan { |
11 |
namespace Botan { |
12 |
|
12 |
|
13 |
namespace { |
13 |
namespace { |
14 |
@@ -44,7 +40,7 @@ |
14 |
@@ -44,7 +40,7 @@ class EVP_BlockCipher : public BlockCipher |
15 |
size_t block_sz; |
15 |
size_t block_sz; |
16 |
Key_Length_Specification cipher_key_spec; |
16 |
Key_Length_Specification cipher_key_spec; |
17 |
std::string cipher_name; |
17 |
std::string cipher_name; |
Link Here
|
20 |
}; |
20 |
}; |
21 |
|
21 |
|
22 |
/* |
22 |
/* |
23 |
@@ -59,14 +55,14 @@ |
23 |
@@ -59,14 +55,15 @@ EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* alg |
24 |
if(EVP_CIPHER_mode(algo) != EVP_CIPH_ECB_MODE) |
24 |
if(EVP_CIPHER_mode(algo) != EVP_CIPH_ECB_MODE) |
25 |
throw Invalid_Argument("EVP_BlockCipher: Non-ECB EVP was passed in"); |
25 |
throw Invalid_Argument("EVP_BlockCipher: Non-ECB EVP was passed in"); |
26 |
|
26 |
|
27 |
- EVP_CIPHER_CTX_init(&encrypt); |
27 |
- EVP_CIPHER_CTX_init(&encrypt); |
28 |
- EVP_CIPHER_CTX_init(&decrypt); |
28 |
- EVP_CIPHER_CTX_init(&decrypt); |
29 |
+ EVP_CIPHER_CTX_init(encrypt); |
29 |
+ if ((encrypt = EVP_CIPHER_CTX_new()) == NULL) |
30 |
+ EVP_CIPHER_CTX_init(decrypt); |
30 |
+ throw Invalid_Argument("EVP_BlockCipher: EVP_CIPHER_CTX_new failed"); |
|
|
31 |
+ EVP_EncryptInit_ex(encrypt, algo, 0, 0, 0); |
32 |
+ EVP_CIPHER_CTX_set_padding(encrypt, 0); |
31 |
|
33 |
|
32 |
- EVP_EncryptInit_ex(&encrypt, algo, 0, 0, 0); |
34 |
- EVP_EncryptInit_ex(&encrypt, algo, 0, 0, 0); |
33 |
- EVP_DecryptInit_ex(&decrypt, algo, 0, 0, 0); |
35 |
- EVP_DecryptInit_ex(&decrypt, algo, 0, 0, 0); |
34 |
+ EVP_EncryptInit_ex(encrypt, algo, 0, 0, 0); |
36 |
- |
35 |
+ EVP_DecryptInit_ex(decrypt, algo, 0, 0, 0); |
|
|
36 |
|
37 |
- EVP_CIPHER_CTX_set_padding(&encrypt, 0); |
37 |
- EVP_CIPHER_CTX_set_padding(&encrypt, 0); |
38 |
- EVP_CIPHER_CTX_set_padding(&decrypt, 0); |
38 |
- EVP_CIPHER_CTX_set_padding(&decrypt, 0); |
39 |
+ EVP_CIPHER_CTX_set_padding(encrypt, 0); |
39 |
+ if ((decrypt = EVP_CIPHER_CTX_new()) == NULL) |
|
|
40 |
+ throw Invalid_Argument("EVP_BlockCipher: EVP_CIPHER_CTX_new failed"); |
41 |
+ EVP_DecryptInit_ex(decrypt, algo, 0, 0, 0); |
40 |
+ EVP_CIPHER_CTX_set_padding(decrypt, 0); |
42 |
+ EVP_CIPHER_CTX_set_padding(decrypt, 0); |
41 |
} |
43 |
} |
42 |
|
44 |
|
43 |
/* |
45 |
/* |
44 |
@@ -83,14 +79,14 @@ |
46 |
@@ -83,14 +80,15 @@ EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* alg |
45 |
if(EVP_CIPHER_mode(algo) != EVP_CIPH_ECB_MODE) |
47 |
if(EVP_CIPHER_mode(algo) != EVP_CIPH_ECB_MODE) |
46 |
throw Invalid_Argument("EVP_BlockCipher: Non-ECB EVP was passed in"); |
48 |
throw Invalid_Argument("EVP_BlockCipher: Non-ECB EVP was passed in"); |
47 |
|
49 |
|
48 |
- EVP_CIPHER_CTX_init(&encrypt); |
50 |
- EVP_CIPHER_CTX_init(&encrypt); |
49 |
- EVP_CIPHER_CTX_init(&decrypt); |
51 |
- EVP_CIPHER_CTX_init(&decrypt); |
50 |
+ EVP_CIPHER_CTX_init(encrypt); |
52 |
+ if ((encrypt = EVP_CIPHER_CTX_new()) == NULL) |
51 |
+ EVP_CIPHER_CTX_init(decrypt); |
53 |
+ throw Invalid_Argument("EVP_BlockCipher: EVP_CIPHER_CTX_new failed"); |
|
|
54 |
+ EVP_EncryptInit_ex(encrypt, algo, 0, 0, 0); |
55 |
+ EVP_CIPHER_CTX_set_padding(encrypt, 0); |
52 |
|
56 |
|
53 |
- EVP_EncryptInit_ex(&encrypt, algo, 0, 0, 0); |
57 |
- EVP_EncryptInit_ex(&encrypt, algo, 0, 0, 0); |
54 |
- EVP_DecryptInit_ex(&decrypt, algo, 0, 0, 0); |
58 |
- EVP_DecryptInit_ex(&decrypt, algo, 0, 0, 0); |
55 |
+ EVP_EncryptInit_ex(encrypt, algo, 0, 0, 0); |
59 |
- |
56 |
+ EVP_DecryptInit_ex(decrypt, algo, 0, 0, 0); |
|
|
57 |
|
58 |
- EVP_CIPHER_CTX_set_padding(&encrypt, 0); |
60 |
- EVP_CIPHER_CTX_set_padding(&encrypt, 0); |
59 |
- EVP_CIPHER_CTX_set_padding(&decrypt, 0); |
61 |
- EVP_CIPHER_CTX_set_padding(&decrypt, 0); |
60 |
+ EVP_CIPHER_CTX_set_padding(encrypt, 0); |
62 |
+ if ((decrypt = EVP_CIPHER_CTX_new()) == NULL) |
|
|
63 |
+ throw Invalid_Argument("EVP_BlockCipher: EVP_CIPHER_CTX_new failed"); |
64 |
+ EVP_DecryptInit_ex(decrypt, algo, 0, 0, 0); |
61 |
+ EVP_CIPHER_CTX_set_padding(decrypt, 0); |
65 |
+ EVP_CIPHER_CTX_set_padding(decrypt, 0); |
62 |
} |
66 |
} |
63 |
|
67 |
|
64 |
/* |
68 |
/* |
65 |
@@ -98,8 +94,8 @@ |
69 |
@@ -98,8 +96,8 @@ EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* alg |
66 |
*/ |
70 |
*/ |
67 |
EVP_BlockCipher::~EVP_BlockCipher() |
71 |
EVP_BlockCipher::~EVP_BlockCipher() |
68 |
{ |
72 |
{ |
Link Here
|
73 |
} |
77 |
} |
74 |
|
78 |
|
75 |
/* |
79 |
/* |
76 |
@@ -109,7 +105,7 @@ |
80 |
@@ -109,7 +107,7 @@ void EVP_BlockCipher::encrypt_n(const byte in[], byte |
77 |
size_t blocks) const |
81 |
size_t blocks) const |
78 |
{ |
82 |
{ |
79 |
int out_len = 0; |
83 |
int out_len = 0; |
Link Here
|
82 |
} |
86 |
} |
83 |
|
87 |
|
84 |
/* |
88 |
/* |
85 |
@@ -119,7 +115,7 @@ |
89 |
@@ -119,7 +117,7 @@ void EVP_BlockCipher::decrypt_n(const byte in[], byte |
86 |
size_t blocks) const |
90 |
size_t blocks) const |
87 |
{ |
91 |
{ |
88 |
int out_len = 0; |
92 |
int out_len = 0; |
Link Here
|
91 |
} |
95 |
} |
92 |
|
96 |
|
93 |
/* |
97 |
/* |
94 |
@@ -134,19 +130,19 @@ |
98 |
@@ -134,19 +132,19 @@ void EVP_BlockCipher::key_schedule(const byte key[], s |
95 |
full_key += std::make_pair(key, 8); |
99 |
full_key += std::make_pair(key, 8); |
96 |
} |
100 |
} |
97 |
else |
101 |
else |
Link Here
|
117 |
} |
121 |
} |
118 |
|
122 |
|
119 |
/* |
123 |
/* |
120 |
@@ -154,7 +150,7 @@ |
124 |
@@ -154,7 +152,7 @@ void EVP_BlockCipher::key_schedule(const byte key[], s |
121 |
*/ |
125 |
*/ |
122 |
BlockCipher* EVP_BlockCipher::clone() const |
126 |
BlockCipher* EVP_BlockCipher::clone() const |
123 |
{ |
127 |
{ |
Link Here
|
126 |
cipher_name, |
130 |
cipher_name, |
127 |
cipher_key_spec.minimum_keylength(), |
131 |
cipher_key_spec.minimum_keylength(), |
128 |
cipher_key_spec.maximum_keylength(), |
132 |
cipher_key_spec.maximum_keylength(), |
129 |
@@ -166,16 +162,16 @@ |
133 |
@@ -166,16 +164,16 @@ BlockCipher* EVP_BlockCipher::clone() const |
130 |
*/ |
134 |
*/ |
131 |
void EVP_BlockCipher::clear() |
135 |
void EVP_BlockCipher::clear() |
132 |
{ |
136 |
{ |
Link Here
|
152 |
} |
156 |
} |
153 |
|
157 |
|
154 |
} |
158 |
} |
155 |
--- src/engine/openssl/ossl_md.cpp.orig 2018-10-15 00:26:19 UTC |
159 |
--- src/engine/openssl/ossl_md.cpp.orig 2017-10-02 06:00:00 UTC |
156 |
+++ src/engine/openssl/ossl_md.cpp |
160 |
+++ src/engine/openssl/ossl_md.cpp |
157 |
@@ -8,10 +8,6 @@ |
161 |
@@ -8,10 +8,6 @@ |
158 |
#include <botan/internal/openssl_engine.h> |
162 |
#include <botan/internal/openssl_engine.h> |
Link Here
|
165 |
namespace Botan { |
169 |
namespace Botan { |
166 |
|
170 |
|
167 |
namespace { |
171 |
namespace { |
168 |
@@ -28,12 +24,12 @@ |
172 |
@@ -28,12 +24,12 @@ class EVP_HashFunction : public HashFunction |
169 |
|
173 |
|
170 |
size_t output_length() const |
174 |
size_t output_length() const |
171 |
{ |
175 |
{ |
Link Here
|
180 |
} |
184 |
} |
181 |
|
185 |
|
182 |
EVP_HashFunction(const EVP_MD*, const std::string&); |
186 |
EVP_HashFunction(const EVP_MD*, const std::string&); |
183 |
@@ -44,7 +40,7 @@ |
187 |
@@ -44,7 +40,7 @@ class EVP_HashFunction : public HashFunction |
184 |
|
188 |
|
185 |
size_t block_size; |
189 |
size_t block_size; |
186 |
std::string algo_name; |
190 |
std::string algo_name; |
Link Here
|
189 |
}; |
193 |
}; |
190 |
|
194 |
|
191 |
/* |
195 |
/* |
192 |
@@ -52,7 +48,7 @@ |
196 |
@@ -52,7 +48,7 @@ class EVP_HashFunction : public HashFunction |
193 |
*/ |
197 |
*/ |
194 |
void EVP_HashFunction::add_data(const byte input[], size_t length) |
198 |
void EVP_HashFunction::add_data(const byte input[], size_t length) |
195 |
{ |
199 |
{ |
Link Here
|
198 |
} |
202 |
} |
199 |
|
203 |
|
200 |
/* |
204 |
/* |
201 |
@@ -60,9 +56,9 @@ |
205 |
@@ -60,9 +56,9 @@ void EVP_HashFunction::add_data(const byte input[], si |
202 |
*/ |
206 |
*/ |
203 |
void EVP_HashFunction::final_result(byte output[]) |
207 |
void EVP_HashFunction::final_result(byte output[]) |
204 |
{ |
208 |
{ |
Link Here
|
211 |
} |
215 |
} |
212 |
|
216 |
|
213 |
/* |
217 |
/* |
214 |
@@ -70,8 +66,8 @@ |
218 |
@@ -70,8 +66,8 @@ void EVP_HashFunction::final_result(byte output[]) |
215 |
*/ |
219 |
*/ |
216 |
void EVP_HashFunction::clear() |
220 |
void EVP_HashFunction::clear() |
217 |
{ |
221 |
{ |
Link Here
|
222 |
} |
226 |
} |
223 |
|
227 |
|
224 |
/* |
228 |
/* |
225 |
@@ -79,7 +75,7 @@ |
229 |
@@ -79,7 +75,7 @@ void EVP_HashFunction::clear() |
226 |
*/ |
230 |
*/ |
227 |
HashFunction* EVP_HashFunction::clone() const |
231 |
HashFunction* EVP_HashFunction::clone() const |
228 |
{ |
232 |
{ |
Link Here
|
231 |
return new EVP_HashFunction(algo, name()); |
235 |
return new EVP_HashFunction(algo, name()); |
232 |
} |
236 |
} |
233 |
|
237 |
|
234 |
@@ -90,8 +86,8 @@ |
238 |
@@ -90,8 +86,9 @@ EVP_HashFunction::EVP_HashFunction(const EVP_MD* algo, |
235 |
const std::string& name) : |
239 |
const std::string& name) : |
236 |
algo_name(name) |
240 |
algo_name(name) |
237 |
{ |
241 |
{ |
238 |
- EVP_MD_CTX_init(&md); |
242 |
- EVP_MD_CTX_init(&md); |
239 |
- EVP_DigestInit_ex(&md, algo, 0); |
243 |
- EVP_DigestInit_ex(&md, algo, 0); |
240 |
+ EVP_MD_CTX_init(md); |
244 |
+ if ((md = EVP_MD_CTX_new()) == NULL) |
|
|
245 |
+ throw Invalid_Argument("EVP_HashFunction: EVP_MD_CTX_new failed"); |
241 |
+ EVP_DigestInit_ex(md, algo, 0); |
246 |
+ EVP_DigestInit_ex(md, algo, 0); |
242 |
} |
247 |
} |
243 |
|
248 |
|
244 |
/* |
249 |
/* |
245 |
@@ -99,7 +95,11 @@ |
250 |
@@ -99,7 +96,11 @@ EVP_HashFunction::EVP_HashFunction(const EVP_MD* algo, |
246 |
*/ |
251 |
*/ |
247 |
EVP_HashFunction::~EVP_HashFunction() |
252 |
EVP_HashFunction::~EVP_HashFunction() |
248 |
{ |
253 |
{ |