PPP, MPPE, moved struct ppp_mppe_state from mppe.c to mppe.h

In order to be able to use struct ppp_mppe_state statically allocated,
export struct ppp_mppe_state.
This commit is contained in:
Sylvain Rochet 2015-04-18 00:15:52 +02:00
parent 3618432107
commit 6235e1ae57
2 changed files with 26 additions and 20 deletions

View File

@ -39,6 +39,12 @@
#ifndef MPPE_H
#define MPPE_H
#if LWIP_INCLUDED_POLARSSL_ARC4
#include "netif/ppp/polarssl/arc4.h"
#else
#include "polarssl/arc4.h"
#endif
#define MPPE_PAD 4 /* MPPE growth per frame */
#define MPPE_MAX_KEY_LEN 16 /* largest key length (128-bit) */
@ -126,6 +132,26 @@
opts |= MPPE_OPT_UNKNOWN; \
} while (/* CONSTCOND */ 0)
/*
* State for an MPPE (de)compressor.
*/
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;
};
void *mppe_alloc(unsigned char *options, int optlen);
void mppe_free(void *arg);
int mppe_comp_init(void *arg, unsigned char *options, int optlen, int unit,

View File

@ -50,26 +50,6 @@
#define SHA1_SIGNATURE_SIZE 20
#define SHA1_PAD_SIZE 40
/*
* State for an MPPE (de)compressor.
*/
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;
};
/* struct ppp_mppe_state.bits definitions */
#define MPPE_BIT_A 0x80 /* Encryption table were (re)inititalized */
#define MPPE_BIT_B 0x40 /* MPPC only (not implemented) */