diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 3b7222e8..c80fd17c 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -1722,6 +1722,10 @@ #ifndef MSCHAP_SUPPORT #define MSCHAP_SUPPORT 0 #endif +#if MSCHAP_SUPPORT +#undef CHAP_SUPPORT +#define CHAP_SUPPORT 1 /* MSCHAP require CHAP support */ +#endif /* MSCHAP_SUPPORT */ /** * CBCP_SUPPORT==1: Support CBCP. CURRENTLY NOT SUPPORTED! DO NOT SET! @@ -1751,6 +1755,57 @@ #define MD5_SUPPORT 0 #endif +/** + * PolarSSL library, used if necessary and not previously disabled + * + * + * lwIP contains some files fetched from the latest BSD release of + * the PolarSSL project for ciphers and encryption methods we need for lwIP + * PPP support. + * + * The PolarSSL files were cleaned to contain only the necessary struct + * fields and functions needed for lwIP. + * + * The PolarSSL API was not changed at all, so if you are already using + * PolarSSL you can choose to skip the compilation of the included PolarSSL + * library into lwIP: + * + * The following defines are available for flexibility: + * + * LWIP_INCLUDED_POLARSSL_MD4 ; Use lwIP internal PolarSSL for MD4 + * LWIP_INCLUDED_POLARSSL_MD5 ; Use lwIP internal PolarSSL for MD5 + * LWIP_INCLUDED_POLARSSL_SHA1 ; Use lwIP internal PolarSSL for SHA1 + * LWIP_INCLUDED_POLARSSL_DES ; Use lwIP internal PolarSSL for DES + * + * If set (=1), the default if required by another enabled PPP feature unless + * explicitly set to 0, using included lwIP PolarSSL. + * + * If clear (=0), using external PolarSSL. + * + * Undefined if not needed. + * + * Beware of the stack requirements which can be a lot larger if you are not + * using our cleaned PolarSSL library. + */ + +#if CHAP_SUPPORT || EAP_SUPPORT +#ifndef LWIP_INCLUDED_POLARSSL_MD5 +#define LWIP_INCLUDED_POLARSSL_MD5 1 /* CHAP and EAP require MD5 support */ +#endif /* LWIP_INCLUDED_POLARSSL_MD5 */ +#endif /* CHAP_SUPPORT || EAP_SUPPORT */ + +#if MSCHAP_SUPPORT +#ifndef LWIP_INCLUDED_POLARSSL_MD4 +#define LWIP_INCLUDED_POLARSSL_MD4 1 /* MSCHAP require MD4 support */ +#endif /* LWIP_INCLUDED_POLARSSL_MD4 */ +#ifndef LWIP_INCLUDED_POLARSSL_SHA1 +#define LWIP_INCLUDED_POLARSSL_SHA1 1 /* MSCHAP require SHA1 support */ +#endif /* LWIP_INCLUDED_POLARSSL_SHA1 */ +#ifndef LWIP_INCLUDED_POLARSSL_DES +#define LWIP_INCLUDED_POLARSSL_DES 1 /* MSCHAP require DES support */ +#endif /* LWIP_INCLUDED_POLARSSL_DES */ +#endif /* MSCHAP_SUPPORT */ + /* * Timeouts */ diff --git a/src/netif/ppp/cbcp.h b/src/netif/ppp/cbcp.h deleted file mode 100644 index c2ab3f68..00000000 --- a/src/netif/ppp/cbcp.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef CBCP_H -#define CBCP_H - -typedef struct cbcp_state { - int us_unit; /* Interface unit number */ - u_char us_id; /* Current id */ - u_char us_allowed; - int us_type; - char *us_number; /* Telefone Number */ -} cbcp_state; - -extern cbcp_state cbcp[]; - -extern struct protent cbcp_protent; - -#define CBCP_MINLEN 4 - -#define CBCP_REQ 1 -#define CBCP_RESP 2 -#define CBCP_ACK 3 - -#define CB_CONF_NO 1 -#define CB_CONF_USER 2 -#define CB_CONF_ADMIN 3 -#define CB_CONF_LIST 4 -#endif diff --git a/src/netif/ppp/magic.c b/src/netif/ppp/magic.c index de65a96e..c5587ce5 100644 --- a/src/netif/ppp/magic.c +++ b/src/netif/ppp/magic.c @@ -73,7 +73,6 @@ *****************************************************************************/ #include "lwip/opt.h" - #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ #include "polarssl/md5.h" diff --git a/src/netif/ppp/magic.h b/src/netif/ppp/magic.h index 2c714140..8c4c016e 100644 --- a/src/netif/ppp/magic.h +++ b/src/netif/ppp/magic.h @@ -78,7 +78,6 @@ #define MAGIC_H #include "lwip/opt.h" - #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ /*********************** diff --git a/src/netif/ppp/patchlevel.h b/src/netif/ppp/patchlevel.h deleted file mode 100644 index b7d6ce33..00000000 --- a/src/netif/ppp/patchlevel.h +++ /dev/null @@ -1,2 +0,0 @@ -#define VERSION "2.4.5" -#define DATE "17 November 2009" diff --git a/src/netif/ppp/pppcrypt.c b/src/netif/ppp/pppcrypt.c index 9bde8953..3baa16d1 100644 --- a/src/netif/ppp/pppcrypt.c +++ b/src/netif/ppp/pppcrypt.c @@ -31,8 +31,7 @@ */ #include "lwip/opt.h" - -/* FIXME: dont include if not needed */ +#if PPP_SUPPORT && MSCHAP_SUPPORT /* don't build if not necessary */ #include "pppd.h" #include "pppcrypt.h" @@ -62,3 +61,5 @@ void pppcrypt_56_to_64_bit_key(u_char *key, u_char * des_key) { des_key[6] = pppcrypt_get_7bits(key, 42); des_key[7] = pppcrypt_get_7bits(key, 49); } + +#endif /* PPP_SUPPORT && MSCHAP_SUPPORT */ diff --git a/src/netif/ppp/pppcrypt.h b/src/netif/ppp/pppcrypt.h index 6b5eaf8b..ef2e87de 100644 --- a/src/netif/ppp/pppcrypt.h +++ b/src/netif/ppp/pppcrypt.h @@ -30,9 +30,14 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "lwip/opt.h" +#if PPP_SUPPORT && MSCHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + #ifndef PPPCRYPT_H #define PPPCRYPT_H void pppcrypt_56_to_64_bit_key(u_char *key, u_char *des_key); #endif /* PPPCRYPT_H */ + +#endif /* PPP_SUPPORT && MSCHAP_SUPPORT */