9676824f5fa936a6aaf7bd3f49426ea2d267a6b6
[openwrt/staging/stintel.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 @@ -35,10 +35,10 @@ endif
19 COPTS = -O2 -pipe -Wall -g
20 LIBS =
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 @@ -140,8 +140,7 @@ endif
32
33 ifdef NEEDDES
34 ifndef USE_CRYPT
35 -CFLAGS += -I$(shell $(CC) --print-sysroot)/usr/include/openssl
36 -LIBS += -lcrypto
37 +LIBS += -ldes $(LIBS)
38 else
39 CFLAGS += -DUSE_CRYPT=1
40 endif
41 --- a/pppd/pppcrypt.c
42 +++ b/pppd/pppcrypt.c
43 @@ -64,7 +64,7 @@ u_char *des_key; /* OUT 64 bit DES key w
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 @@ -158,25 +158,25 @@ u_char *clear; /* OUT 8 octets */
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(key)
61 u_char *key;
62 {
63 - DES_cblock des_key;
64 + des_cblock des_key;
65 MakeKey(key, des_key);
66 - DES_set_key(&des_key, &key_schedule);
67 + des_set_key(&des_key, key_schedule);
68 return (1);
69 }
70
71 bool
72 -DesEncrypt(clear, cipher)
73 +DesEncrypt(clear, key, cipher)
74 u_char *clear; /* IN 8 octets */
75 u_char *cipher; /* OUT 8 octets */
76 {
77 - DES_ecb_encrypt((DES_cblock *)clear, (DES_cblock *)cipher,
78 - &key_schedule, 1);
79 + des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher,
80 + key_schedule, 1);
81 return (1);
82 }
83
84 @@ -185,8 +185,8 @@ DesDecrypt(cipher, clear)
85 u_char *cipher; /* IN 8 octets */
86 u_char *clear; /* OUT 8 octets */
87 {
88 - DES_ecb_encrypt((DES_cblock *)cipher, (DES_cblock *)clear,
89 - &key_schedule, 0);
90 + des_ecb_encrypt((des_cblock *)cipher, (des_cblock *)clear,
91 + key_schedule, 0);
92 return (1);
93 }
94