Line 0
Link Here
|
|
|
1 |
--- lib/ftxlate.c.orig 2019-03-21 19:39:03 UTC |
2 |
+++ lib/ftxlate.c |
3 |
@@ -2040,21 +2040,21 @@ static int cryptopan_init(struct cryptopan *cp, unsign |
4 |
|
5 |
|
6 |
/* init crypto */ |
7 |
- if (!(cp->cipher_ctx = (EVP_CIPHER_CTX*) malloc(sizeof(EVP_CIPHER_CTX)))) { |
8 |
+ cp->cipher_ctx = EVP_CIPHER_CTX_new(); |
9 |
+ if (cp->cipher_ctx == NULL) |
10 |
return -1; |
11 |
- } |
12 |
|
13 |
- EVP_CIPHER_CTX_init(cp->cipher_ctx); |
14 |
- |
15 |
/* disable padding */ |
16 |
if (!(EVP_CIPHER_CTX_set_padding(cp->cipher_ctx, 0))) { |
17 |
cryptopan_free(cp); |
18 |
+ EVP_CIPHER_CTX_free(cp->cipher_ctx); |
19 |
return -1; |
20 |
} |
21 |
|
22 |
/* init encryption */ |
23 |
if (!(EVP_EncryptInit(cp->cipher_ctx, EVP_aes_128_ecb(), key, NULL))) { |
24 |
cryptopan_free(cp); |
25 |
+ EVP_CIPHER_CTX_free(cp->cipher_ctx); |
26 |
return -1; |
27 |
} |
28 |
|
29 |
@@ -2062,8 +2062,10 @@ static int cryptopan_init(struct cryptopan *cp, unsign |
30 |
i = 16; |
31 |
if (!(EVP_EncryptUpdate(cp->cipher_ctx, cp->m_pad, &i, key+16, i))) { |
32 |
cryptopan_free(cp); |
33 |
+ EVP_CIPHER_CTX_free(cp->cipher_ctx); |
34 |
return -1; |
35 |
} |
36 |
+ EVP_CIPHER_CTX_free(cp->cipher_ctx); |
37 |
|
38 |
#endif /* HAVE_OPENSSL */ |
39 |
|