PPP, MPPE, replaced #ifdef MPPE to #if MPPE_SUPPORT

This commit is contained in:
Sylvain Rochet
2015-03-20 00:20:12 +01:00
parent 73f1511ac2
commit 9fbe900949
7 changed files with 84 additions and 71 deletions

View File

@@ -70,7 +70,7 @@
#define MS_CHAP2_NTRESP_LEN 24
#define MS_CHAP2_FLAGS 48
#ifdef MPPE
#if MPPE_SUPPORT
#include "mppe.h" /* MPPE_MAX_KEY_LEN */
extern u_char mppe_send_key[MPPE_MAX_KEY_LEN];
extern u_char mppe_recv_key[MPPE_MAX_KEY_LEN];
@@ -86,7 +86,7 @@ extern int mppe_keys_set;
/* used by plugins (using above values) */
extern void set_mppe_enc_types(int, int);
#endif /* UNUSED */
#endif
#endif /* MPPE_SUPPORT */
/* Are we the authenticator or authenticatee? For MS-CHAPv2 key derivation. */
#define MS_CHAP2_AUTHENTICATEE 0
@@ -95,11 +95,11 @@ extern void set_mppe_enc_types(int, int);
void ChapMS (u_char *, char *, int, u_char *);
void ChapMS2 (u_char *, u_char *, char *, char *, int,
u_char *, u_char[MS_AUTH_RESPONSE_LENGTH+1], int);
#ifdef MPPE
#if MPPE_SUPPORT
void mppe_set_keys (u_char *, u_char[MD4_SIGNATURE_SIZE]);
void mppe_set_keys2(u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
u_char NTResponse[24], int IsServer);
#endif
#endif /* MPPE_SUPPORT */
void ChallengeHash (u_char[16], u_char *, char *, u_char[8]);

View File

@@ -33,6 +33,12 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "lwip/opt.h"
#if PPP_SUPPORT && MPPE_SUPPORT /* don't build if not configured for use in lwipopts.h */
#ifndef MPPE_H
#define MPPE_H
#define MPPE_PAD 4 /* MPPE growth per frame */
#define MPPE_MAX_KEY_LEN 16 /* largest key length (128-bit) */
@@ -119,3 +125,6 @@
if (ptr[3] & ~MPPE_ALL_BITS) \
opts |= MPPE_OPT_UNKNOWN; \
} while (/* CONSTCOND */ 0)
#endif /* MPPE_H */
#endif /* PPP_SUPPORT && MPPE_SUPPORT */

View File

@@ -85,6 +85,10 @@
#define PPP_STATS_SUPPORT 0
#endif
#ifndef MPPE_SUPPORT
#define MPPE_SUPPORT 0
#endif
/*************************
*** PUBLIC DEFINITIONS ***
@@ -234,11 +238,11 @@ typedef struct ppp_settings_s {
#else
unsigned int :1; /* 1 bit of padding */
#endif
#ifdef MPPE
#if MPPE_SUPPORT
unsigned int refuse_mppe_stateful :1; /* Allow MPPE stateful mode? */
#else
#else /* MPPE_SUPPORT */
unsigned int :1; /* 1 bit of padding */
#endif
#endif /* MPPE_SUPPORT */
u16_t listen_time; /* time to listen first (ms), waiting for peer to send LCP packet */