mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
PPP, MPPE, optimized struct ppp_mppe_state size
This commit is contained in:
parent
b553df860c
commit
f79bc03360
@ -137,23 +137,24 @@
|
||||
*/
|
||||
struct ppp_mppe_state {
|
||||
arc4_context arc4;
|
||||
unsigned char master_key[MPPE_MAX_KEY_LEN];
|
||||
unsigned char session_key[MPPE_MAX_KEY_LEN];
|
||||
unsigned keylen; /* key length in bytes */
|
||||
/* NB: 128-bit == 16, 40-bit == 8! */
|
||||
/* If we want to support 56-bit, */
|
||||
/* the unit has to change to bits */
|
||||
unsigned char bits; /* MPPE control bits */
|
||||
unsigned ccount; /* 12-bit coherency count (seqno) */
|
||||
unsigned stateful; /* stateful mode flag */
|
||||
int discard; /* stateful mode packet loss flag */
|
||||
int sanity_errors; /* take down LCP if too many */
|
||||
int unit;
|
||||
int debug;
|
||||
u8_t master_key[MPPE_MAX_KEY_LEN];
|
||||
u8_t session_key[MPPE_MAX_KEY_LEN];
|
||||
u8_t keylen; /* key length in bytes */
|
||||
/* NB: 128-bit == 16, 40-bit == 8!
|
||||
* If we want to support 56-bit, the unit has to change to bits
|
||||
*/
|
||||
u8_t bits; /* MPPE control bits */
|
||||
u16_t ccount; /* 12-bit coherency count (seqno) */
|
||||
unsigned int stateful :1; /* stateful mode flag */
|
||||
unsigned int discard :1; /* stateful mode packet loss flag */
|
||||
unsigned int debug :1; /* debug flag */
|
||||
unsigned int :5; /* 5 bit of padding to round out to 8 bits */
|
||||
u16_t sanity_errors; /* take down LCP if too many */
|
||||
u8_t unit;
|
||||
};
|
||||
|
||||
int mppe_init(struct ppp_mppe_state *state, unsigned char *options, int optlen,
|
||||
int unit, int debug, const char *debugstr);
|
||||
u8_t unit, u8_t debug, const char *debugstr);
|
||||
void mppe_comp_reset(struct ppp_mppe_state *state);
|
||||
err_t mppe_compress(struct ppp_mppe_state *state, struct pbuf **pb, u16_t protocol);
|
||||
void mppe_decomp_reset(struct ppp_mppe_state *state);
|
||||
|
@ -117,7 +117,7 @@ static void mppe_rekey(struct ppp_mppe_state * state, int initial_key)
|
||||
* Initialize (de)compressor state.
|
||||
*/
|
||||
int
|
||||
mppe_init(struct ppp_mppe_state *state, unsigned char *options, int optlen, int unit, int debug,
|
||||
mppe_init(struct ppp_mppe_state *state, unsigned char *options, int optlen, u8_t unit, u8_t debug,
|
||||
const char *debugstr)
|
||||
{
|
||||
unsigned char mppe_opts;
|
||||
@ -218,7 +218,7 @@ mppe_compress(struct ppp_mppe_state *state, struct pbuf **pb, u16_t protocol)
|
||||
pl = (u8_t*)np->payload;
|
||||
|
||||
state->ccount = (state->ccount + 1) % MPPE_CCOUNT_SPACE;
|
||||
if (state->debug >= 7)
|
||||
if (state->debug)
|
||||
PPPDEBUG(LOG_DEBUG, ("mppe_compress[%d]: ccount %d\n", state->unit,
|
||||
state->ccount));
|
||||
/* FIXME: use PUT* macros */
|
||||
@ -274,9 +274,9 @@ mppe_decompress(struct ppp_mppe_state *state, struct pbuf **pb)
|
||||
{
|
||||
struct pbuf *n0 = *pb, *n;
|
||||
u8_t *pl;
|
||||
unsigned ccount;
|
||||
int flushed;
|
||||
int sanity = 0;
|
||||
u16_t ccount;
|
||||
u8_t flushed;
|
||||
u8_t sanity = 0;
|
||||
|
||||
/* MPPE Header */
|
||||
if (n0->len < MPPE_OVHD) {
|
||||
@ -290,7 +290,7 @@ mppe_decompress(struct ppp_mppe_state *state, struct pbuf **pb)
|
||||
pl = (u8_t*)n0->payload;
|
||||
flushed = MPPE_BITS(pl) & MPPE_BIT_FLUSHED;
|
||||
ccount = MPPE_CCOUNT(pl);
|
||||
if (state->debug >= 7)
|
||||
if (state->debug)
|
||||
PPPDEBUG(LOG_DEBUG, ("mppe_decompress[%d]: ccount %d\n",
|
||||
state->unit, ccount));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user