]>
Commit | Line | Data |
---|---|---|
d1657b48 AG |
1 | https://aur.archlinux.org/cgit/aur.git/plain/vde_cryptcab-compile-against-openssl-1.1.0.patch?h=vde2-static |
2 | ||
3 | --- a/src/vde_cryptcab/cryptcab.c 2011-11-23 16:41:17.000000000 +0000 | |
4 | +++ b/src/vde_cryptcab/cryptcab.c 2017-03-20 22:54:20.452975075 +0000 | |
5 | @@ -22,7 +22,7 @@ | |
6 | exit(1); | |
7 | } | |
8 | ||
9 | -static EVP_CIPHER_CTX ctx; | |
10 | +static EVP_CIPHER_CTX *ctx; | |
11 | static int ctx_initialized = 0; | |
12 | static int encryption_disabled = 0; | |
13 | static int nfd; | |
14 | @@ -30,6 +30,10 @@ | |
15 | static struct vde_open_args open_args={.port=0,.group=NULL,.mode=0700}; | |
16 | static int verbose = 0; | |
17 | ||
18 | +#if OPENSSL_VERSION_NUMBER < 0x10100000 | |
19 | +#define EVP_CIPHER_CTX_reset(x) EVP_CIPHER_CTX_cleanup(x) | |
20 | +#endif | |
21 | + | |
22 | void vc_printlog(int priority, const char *format, ...) | |
23 | { | |
24 | va_list arg; | |
25 | @@ -103,19 +107,21 @@ | |
26 | } | |
27 | ||
28 | if (!ctx_initialized) { | |
29 | - EVP_CIPHER_CTX_init (&ctx); | |
30 | + ctx = EVP_CIPHER_CTX_new (); | |
31 | + if (!ctx) | |
32 | + return -1; | |
33 | ctx_initialized = 1; | |
34 | } | |
35 | ||
36 | - EVP_EncryptInit (&ctx, EVP_bf_cbc (), p->key, p->iv); | |
37 | - if (EVP_EncryptUpdate (&ctx, dst, &olen, src, len) != 1) | |
38 | + EVP_EncryptInit (ctx, EVP_bf_cbc (), p->key, p->iv); | |
39 | + if (EVP_EncryptUpdate (ctx, dst, &olen, src, len) != 1) | |
40 | { | |
41 | fprintf (stderr,"error in encrypt update\n"); | |
42 | olen = -1; | |
43 | goto cleanup; | |
44 | } | |
45 | ||
46 | - if (EVP_EncryptFinal (&ctx, dst + olen, &tlen) != 1) | |
47 | + if (EVP_EncryptFinal (ctx, dst + olen, &tlen) != 1) | |
48 | { | |
49 | fprintf (stderr,"error in encrypt final\n"); | |
50 | olen = -1; | |
51 | @@ -124,7 +130,7 @@ | |
52 | olen += tlen; | |
53 | ||
54 | cleanup: | |
55 | - EVP_CIPHER_CTX_cleanup(&ctx); | |
56 | + EVP_CIPHER_CTX_reset(ctx); | |
57 | return olen; | |
58 | } | |
59 | ||
60 | @@ -138,19 +144,21 @@ | |
61 | } | |
62 | ||
63 | if (!ctx_initialized) { | |
64 | - EVP_CIPHER_CTX_init (&ctx); | |
65 | + ctx = EVP_CIPHER_CTX_new (); | |
66 | + if (!ctx) | |
67 | + return -1; | |
68 | ctx_initialized = 1; | |
69 | } | |
70 | ||
71 | - EVP_DecryptInit (&ctx, EVP_bf_cbc (), p->key, p->iv); | |
72 | - if (EVP_DecryptUpdate (&ctx, dst, &olen, src, len) != 1) | |
73 | + EVP_DecryptInit (ctx, EVP_bf_cbc (), p->key, p->iv); | |
74 | + if (EVP_DecryptUpdate (ctx, dst, &olen, src, len) != 1) | |
75 | { | |
76 | fprintf (stderr,"error in decrypt update\n"); | |
77 | olen = -1; | |
78 | goto cleanup; | |
79 | } | |
80 | ||
81 | - if (EVP_DecryptFinal (&ctx, dst + olen, &tlen) != 1) | |
82 | + if (EVP_DecryptFinal (ctx, dst + olen, &tlen) != 1) | |
83 | { | |
84 | fprintf (stderr,"error in decrypt final\n"); | |
85 | olen = -1; | |
86 | @@ -159,7 +167,7 @@ | |
87 | olen += tlen; | |
88 | ||
89 | cleanup: | |
90 | - EVP_CIPHER_CTX_cleanup(&ctx); | |
91 | + EVP_CIPHER_CTX_reset (ctx); | |
92 | return olen; | |
93 | } | |
94 |