summaryrefslogtreecommitdiff
path: root/net-analyzer/flow-tools/files/ftxlate.patch
blob: 5b6ae8d49353f2a3730241d6fcf241c24790c7c9 (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
diff -urN flow-tools-0.68.6.orig/lib/ftxlate.c flow-tools-0.68.6/lib/ftxlate.c
--- flow-tools-0.68.6.orig/lib/ftxlate.c	2022-03-27 22:18:26.477803526 +0200
+++ flow-tools-0.68.6/lib/ftxlate.c	2022-03-27 22:20:18.147811569 +0200
@@ -2040,21 +2040,21 @@
 
 
   /* init crypto */
-  if (!(cp->cipher_ctx = (EVP_CIPHER_CTX*) malloc(sizeof(EVP_CIPHER_CTX)))) {
+  cp->cipher_ctx = EVP_CIPHER_CTX_new();
+  if (cp->cipher_ctx == NULL)
     return -1;
-  }
-
-  EVP_CIPHER_CTX_init(cp->cipher_ctx);
 
   /* disable padding */
   if (!(EVP_CIPHER_CTX_set_padding(cp->cipher_ctx, 0))) {
     cryptopan_free(cp);
+    EVP_CIPHER_CTX_free(cp->cipher_ctx);
     return -1;
   }
 
   /* init encryption */
   if (!(EVP_EncryptInit(cp->cipher_ctx, EVP_aes_128_ecb(), key, NULL))) {
     cryptopan_free(cp);
+    EVP_CIPHER_CTX_free(cp->cipher_ctx);
     return -1;
   }
 
@@ -2062,8 +2062,10 @@
   i = 16;
   if (!(EVP_EncryptUpdate(cp->cipher_ctx, cp->m_pad, &i, key+16, i))) {
     cryptopan_free(cp);
+    EVP_CIPHER_CTX_free(cp->cipher_ctx);
     return -1;
   }
+  EVP_CIPHER_CTX_free(cp->cipher_ctx);
 
 #endif /* HAVE_OPENSSL */