openvpn: update to 2.4.8
[openwrt/openwrt.git] / package / network / services / openvpn / patches / 220-disable_des.patch
1 --- a/src/openvpn/syshead.h
2 +++ b/src/openvpn/syshead.h
3 @@ -597,11 +597,11 @@ socket_defined(const socket_descriptor_t
4 /*
5 * Should we include NTLM proxy functionality
6 */
7 -#if defined(ENABLE_CRYPTO)
8 -#define NTLM 1
9 -#else
10 +//#if defined(ENABLE_CRYPTO)
11 +//#define NTLM 1
12 +//#else
13 #define NTLM 0
14 -#endif
15 +//#endif
16
17 /*
18 * Should we include proxy digest auth functionality
19 --- a/src/openvpn/crypto_mbedtls.c
20 +++ b/src/openvpn/crypto_mbedtls.c
21 @@ -319,6 +319,7 @@ int
22 key_des_num_cblocks(const mbedtls_cipher_info_t *kt)
23 {
24 int ret = 0;
25 +#ifdef MBEDTLS_DES_C
26 if (kt->type == MBEDTLS_CIPHER_DES_CBC)
27 {
28 ret = 1;
29 @@ -331,6 +332,7 @@ key_des_num_cblocks(const mbedtls_cipher
30 {
31 ret = 3;
32 }
33 +#endif
34
35 dmsg(D_CRYPTO_DEBUG, "CRYPTO INFO: n_DES_cblocks=%d", ret);
36 return ret;
37 @@ -339,6 +341,7 @@ key_des_num_cblocks(const mbedtls_cipher
38 bool
39 key_des_check(uint8_t *key, int key_len, int ndc)
40 {
41 +#ifdef MBEDTLS_DES_C
42 int i;
43 struct buffer b;
44
45 @@ -367,11 +370,15 @@ key_des_check(uint8_t *key, int key_len,
46
47 err:
48 return false;
49 +#else
50 + return true;
51 +#endif
52 }
53
54 void
55 key_des_fixup(uint8_t *key, int key_len, int ndc)
56 {
57 +#ifdef MBEDTLS_DES_C
58 int i;
59 struct buffer b;
60
61 @@ -386,6 +393,7 @@ key_des_fixup(uint8_t *key, int key_len,
62 }
63 mbedtls_des_key_set_parity(key);
64 }
65 +#endif
66 }
67
68 /*
69 @@ -705,10 +713,12 @@ cipher_des_encrypt_ecb(const unsigned ch
70 unsigned char *src,
71 unsigned char *dst)
72 {
73 +#ifdef MBEDTLS_DES_C
74 mbedtls_des_context ctx;
75
76 ASSERT(mbed_ok(mbedtls_des_setkey_enc(&ctx, key)));
77 ASSERT(mbed_ok(mbedtls_des_crypt_ecb(&ctx, src, dst)));
78 +#endif
79 }
80
81