ppp: Update to version 2.4.9
[openwrt/staging/rmilecki.git] / package / network / services / ppp / patches / 600-Revert-pppd-Use-openssl-for-the-DES-instead-of-the-l.patch
1 From 831dca008699d485f2c8e91749657ef2d0b06166 Mon Sep 17 00:00:00 2001
2 From: Martin Schiller <ms@dev.tdt.de>
3 Date: Thu, 6 Dec 2018 08:43:17 +0100
4 Subject: [PATCH] Revert "pppd: Use openssl for the DES instead of the libcrypt
5 / glibc"
6
7 For musl and glibc2.27 we can keep linking to crypt; however if we
8 switch to glibc 2.28 we will have to link to one of the SSL libraries.
9
10 This reverts commit 3c7b86229f7bd2600d74db14b1fe5b3896be3875.
11 ---
12 pppd/Makefile.linux | 7 +++----
13 pppd/pppcrypt.c | 18 +++++++++---------
14 2 files changed, 12 insertions(+), 13 deletions(-)
15
16 --- a/pppd/Makefile.linux
17 +++ b/pppd/Makefile.linux
18 @@ -36,10 +36,10 @@ endif
19
20 LIBS = -lrt
21
22 -# Uncomment the next line to include support for Microsoft's
23 +# Uncomment the next 2 lines to include support for Microsoft's
24 # MS-CHAP authentication protocol. Also, edit plugins/radius/Makefile.linux.
25 CHAPMS=y
26 -#USE_CRYPT=y
27 +USE_CRYPT=y
28 # Don't use MSLANMAN unless you really know what you're doing.
29 #MSLANMAN=y
30 # Uncomment the next line to include support for MPPE. CHAPMS (above) must
31 @@ -158,8 +158,7 @@ endif
32
33 ifdef NEEDDES
34 ifndef USE_CRYPT
35 -CFLAGS += -I$(shell $(CC) --print-sysroot)/usr/include/openssl
36 -NEEDCRYPTOLIB = y
37 +LIBS += -ldes $(LIBS)
38 else
39 CFLAGS += -DUSE_CRYPT=1
40 endif
41 --- a/pppd/pppcrypt.c
42 +++ b/pppd/pppcrypt.c
43 @@ -62,7 +62,7 @@ MakeKey(u_char *key, u_char *des_key)
44 des_key[7] = Get7Bits(key, 49);
45
46 #ifndef USE_CRYPT
47 - DES_set_odd_parity((DES_cblock *)des_key);
48 + des_set_odd_parity((des_cblock *)des_key);
49 #endif
50 }
51
52 @@ -147,30 +147,30 @@ DesDecrypt(u_char *cipher, u_char *clear
53 }
54
55 #else /* USE_CRYPT */
56 -static DES_key_schedule key_schedule;
57 +static des_key_schedule key_schedule;
58
59 bool
60 DesSetkey(u_char *key)
61 {
62 - DES_cblock des_key;
63 + des_cblock des_key;
64 MakeKey(key, des_key);
65 - DES_set_key(&des_key, &key_schedule);
66 + des_set_key(&des_key, key_schedule);
67 return (1);
68 }
69
70 bool
71 DesEncrypt(u_char *clear, u_char *cipher)
72 {
73 - DES_ecb_encrypt((DES_cblock *)clear, (DES_cblock *)cipher,
74 - &key_schedule, 1);
75 + des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher,
76 + key_schedule, 1);
77 return (1);
78 }
79
80 bool
81 DesDecrypt(u_char *cipher, u_char *clear)
82 {
83 - DES_ecb_encrypt((DES_cblock *)cipher, (DES_cblock *)clear,
84 - &key_schedule, 0);
85 + des_ecb_encrypt((des_cblock *)cipher, (des_cblock *)clear,
86 + key_schedule, 0);
87 return (1);
88 }
89