mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-04 05:39:53 +00:00
PPP, MPPE, updated polarssl ARC4 for lwIP
This commit is contained in:
parent
cd39843c75
commit
0bfe435c4f
@ -2036,6 +2036,13 @@
|
|||||||
#define CCP_SUPPORT 0
|
#define CCP_SUPPORT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MPPE_SUPPORT==1: Support MPPE. CURRENTLY NOT SUPPORTED! DO NOT SET!
|
||||||
|
*/
|
||||||
|
#ifndef MPPE_SUPPORT
|
||||||
|
#define MPPE_SUPPORT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ECP_SUPPORT==1: Support ECP. CURRENTLY NOT SUPPORTED! DO NOT SET!
|
* ECP_SUPPORT==1: Support ECP. CURRENTLY NOT SUPPORTED! DO NOT SET!
|
||||||
*/
|
*/
|
||||||
@ -2140,6 +2147,12 @@
|
|||||||
#ifndef LWIP_INCLUDED_POLARSSL_DES
|
#ifndef LWIP_INCLUDED_POLARSSL_DES
|
||||||
#define LWIP_INCLUDED_POLARSSL_DES 1 /* MSCHAP require DES support */
|
#define LWIP_INCLUDED_POLARSSL_DES 1 /* MSCHAP require DES support */
|
||||||
#endif /* LWIP_INCLUDED_POLARSSL_DES */
|
#endif /* LWIP_INCLUDED_POLARSSL_DES */
|
||||||
|
/* MS-CHAP support is required for MPPE */
|
||||||
|
#if MPPE_SUPPORT
|
||||||
|
#ifndef LWIP_INCLUDED_POLARSSL_ARC4
|
||||||
|
#define LWIP_INCLUDED_POLARSSL_ARC4 1 /* MPPE require ARC4 support */
|
||||||
|
#endif /* LWIP_INCLUDED_POLARSSL_ARC4*/
|
||||||
|
#endif /* MPPE_SUPPORT */
|
||||||
#endif /* MSCHAP_SUPPORT */
|
#endif /* MSCHAP_SUPPORT */
|
||||||
|
|
||||||
/* Default value if unset */
|
/* Default value if unset */
|
||||||
@ -2155,6 +2168,9 @@
|
|||||||
#ifndef LWIP_INCLUDED_POLARSSL_DES
|
#ifndef LWIP_INCLUDED_POLARSSL_DES
|
||||||
#define LWIP_INCLUDED_POLARSSL_DES 0
|
#define LWIP_INCLUDED_POLARSSL_DES 0
|
||||||
#endif /* LWIP_INCLUDED_POLARSSL_DES */
|
#endif /* LWIP_INCLUDED_POLARSSL_DES */
|
||||||
|
#ifndef LWIP_INCLUDED_POLARSSL_ARC4
|
||||||
|
#define LWIP_INCLUDED_POLARSSL_ARC4 0
|
||||||
|
#endif /* LWIP_INCLUDED_POLARSSL_ARC4 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Timeouts
|
* Timeouts
|
||||||
|
@ -32,8 +32,12 @@
|
|||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#ifndef POLARSSL_ARC4_H
|
|
||||||
#define POLARSSL_ARC4_H
|
#include "lwip/opt.h"
|
||||||
|
#if LWIP_INCLUDED_POLARSSL_ARC4
|
||||||
|
|
||||||
|
#ifndef LWIP_INCLUDED_POLARSSL_ARC4_H
|
||||||
|
#define LWIP_INCLUDED_POLARSSL_ARC4_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief ARC4 context structure
|
* \brief ARC4 context structure
|
||||||
@ -68,15 +72,10 @@ void arc4_setup( arc4_context *ctx, unsigned char *key, int keylen );
|
|||||||
*/
|
*/
|
||||||
void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen );
|
void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen );
|
||||||
|
|
||||||
/*
|
|
||||||
* \brief Checkup routine
|
|
||||||
*
|
|
||||||
* \return 0 if successful, or 1 if the test failed
|
|
||||||
*/
|
|
||||||
int arc4_self_test( int verbose );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* arc4.h */
|
#endif /* LWIP_INCLUDED_POLARSSL_ARC4_H */
|
||||||
|
|
||||||
|
#endif /* LWIP_INCLUDED_POLARSSL_ARC4 */
|
||||||
|
@ -85,10 +85,6 @@
|
|||||||
#define PPP_STATS_SUPPORT 0
|
#define PPP_STATS_SUPPORT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MPPE_SUPPORT
|
|
||||||
#define MPPE_SUPPORT 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************
|
/*************************
|
||||||
*** PUBLIC DEFINITIONS ***
|
*** PUBLIC DEFINITIONS ***
|
||||||
|
@ -38,12 +38,10 @@
|
|||||||
* http://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0
|
* http://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "polarssl/config.h"
|
#include "lwip/opt.h"
|
||||||
|
#if PPP_SUPPORT && LWIP_INCLUDED_POLARSSL_ARC4
|
||||||
#if defined(POLARSSL_ARC4_C)
|
|
||||||
|
|
||||||
#include "polarssl/arc4.h"
|
|
||||||
|
|
||||||
|
#include "netif/ppp/polarssl/arc4.h"
|
||||||
/*
|
/*
|
||||||
* ARC4 key schedule
|
* ARC4 key schedule
|
||||||
*/
|
*/
|
||||||
@ -100,74 +98,4 @@ void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen )
|
|||||||
ctx->y = y;
|
ctx->y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(POLARSSL_SELF_TEST)
|
#endif /* PPP_SUPPORT && LWIP_INCLUDED_POLARSSL_DES */
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ARC4 tests vectors as posted by Eric Rescorla in sep. 1994:
|
|
||||||
*
|
|
||||||
* http://groups.google.com/group/comp.security.misc/msg/10a300c9d21afca0
|
|
||||||
*/
|
|
||||||
static const unsigned char arc4_test_key[3][8] =
|
|
||||||
{
|
|
||||||
{ 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
|
|
||||||
{ 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
|
|
||||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
|
||||||
};
|
|
||||||
|
|
||||||
static const unsigned char arc4_test_pt[3][8] =
|
|
||||||
{
|
|
||||||
{ 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
|
|
||||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
|
||||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
|
||||||
};
|
|
||||||
|
|
||||||
static const unsigned char arc4_test_ct[3][8] =
|
|
||||||
{
|
|
||||||
{ 0x75, 0xB7, 0x87, 0x80, 0x99, 0xE0, 0xC5, 0x96 },
|
|
||||||
{ 0x74, 0x94, 0xC2, 0xE7, 0x10, 0x4B, 0x08, 0x79 },
|
|
||||||
{ 0xDE, 0x18, 0x89, 0x41, 0xA3, 0x37, 0x5D, 0x3A }
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Checkup routine
|
|
||||||
*/
|
|
||||||
int arc4_self_test( int verbose )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
unsigned char buf[8];
|
|
||||||
arc4_context ctx;
|
|
||||||
|
|
||||||
for( i = 0; i < 3; i++ )
|
|
||||||
{
|
|
||||||
if( verbose != 0 )
|
|
||||||
printf( " ARC4 test #%d: ", i + 1 );
|
|
||||||
|
|
||||||
memcpy( buf, arc4_test_pt[i], 8 );
|
|
||||||
|
|
||||||
arc4_setup( &ctx, (unsigned char *) arc4_test_key[i], 8 );
|
|
||||||
arc4_crypt( &ctx, buf, 8 );
|
|
||||||
|
|
||||||
if( memcmp( buf, arc4_test_ct[i], 8 ) != 0 )
|
|
||||||
{
|
|
||||||
if( verbose != 0 )
|
|
||||||
printf( "failed\n" );
|
|
||||||
|
|
||||||
return( 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( verbose != 0 )
|
|
||||||
printf( "passed\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( verbose != 0 )
|
|
||||||
printf( "\n" );
|
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user