PPP, switched chap_digests linked list to a const table in .rodata/flash, saving about 100 bytes in .data segment if chap(md5) and mschap is enabled

This commit is contained in:
Sylvain Rochet
2012-10-14 02:04:36 +02:00
parent e5a554f0b5
commit 7f97e354b4
6 changed files with 28 additions and 47 deletions

View File

@@ -31,6 +31,6 @@
#include "lwip/opt.h"
#if PPP_SUPPORT && CHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */
extern void chap_md5_init(void);
extern const struct chap_digest_type md5_digest;
#endif /* PPP_SUPPORT && CHAP_SUPPORT */

View File

@@ -143,8 +143,6 @@ struct chap_digest_type {
unsigned char *priv);
int (*check_success)(unsigned char *pkt, int len, unsigned char *priv);
void (*handle_failure)(unsigned char *pkt, int len);
struct chap_digest_type *next;
};
/*
@@ -154,7 +152,7 @@ struct chap_digest_type {
typedef struct chap_client_state {
u8_t flags;
char *name;
struct chap_digest_type *digest;
const struct chap_digest_type *digest;
unsigned char priv[64]; /* private area for digest's use */
} chap_client_state;
@@ -163,7 +161,7 @@ typedef struct chap_server_state {
u8_t flags;
int id;
char *name;
struct chap_digest_type *digest;
const struct chap_digest_type *digest;
int challenge_xmits;
int challenge_pktlen;
unsigned char challenge[CHAL_MAX_PKTLEN];
@@ -175,14 +173,11 @@ typedef struct chap_server_state {
#if 0 /* UNUSED */
/* Hook for a plugin to validate CHAP challenge */
extern int (*chap_verify_hook)(char *name, char *ourname, int id,
struct chap_digest_type *digest,
const struct chap_digest_type *digest,
unsigned char *challenge, unsigned char *response,
char *message, int message_space);
#endif /* UNUSED */
/* Called by digest code to register a digest type */
extern void chap_register_digest(struct chap_digest_type *);
#if PPP_SERVER
/* Called by authentication code to start authenticating the peer. */
extern void chap_auth_peer(ppp_pcb *pcb, char *our_name, int digest_code);

View File

@@ -106,7 +106,8 @@ void GenerateAuthenticatorResponse(u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
u_char *rchallenge, char *username,
u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]);
void chapms_init(void);
extern const struct chap_digest_type chapms_digest;
extern const struct chap_digest_type chapms2_digest;
#define __CHAPMS_INCLUDE__
#endif /* __CHAPMS_INCLUDE__ */