Update external polarssl to 1.3.8

There were some fixes back on March 13th, 2014 for fixing compiling on MIPS64.
Also some fixes on June 25th, 2014 for SPARC64 fixes.

Probably more things, but those are what I care about.
This commit is contained in:
Ryan Houdek
2014-09-08 01:58:33 -05:00
parent 6ea82790ba
commit a48e284317
130 changed files with 12346 additions and 4632 deletions

View File

@ -1,7 +1,7 @@
/*
* An implementation of the ARCFOUR algorithm
*
* Copyright (C) 2006-2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -28,18 +28,47 @@
* http://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0
*/
#if !defined(POLARSSL_CONFIG_FILE)
#include "polarssl/config.h"
#else
#include POLARSSL_CONFIG_FILE
#endif
#if defined(POLARSSL_ARC4_C)
#include "polarssl/arc4.h"
#if defined(POLARSSL_PLATFORM_C)
#include "polarssl/platform.h"
#else
#define polarssl_printf printf
#endif
#if !defined(POLARSSL_ARC4_ALT)
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
void arc4_init( arc4_context *ctx )
{
memset( ctx, 0, sizeof( arc4_context ) );
}
void arc4_free( arc4_context *ctx )
{
if( ctx == NULL )
return;
polarssl_zeroize( ctx, sizeof( arc4_context ) );
}
/*
* ARC4 key schedule
*/
void arc4_setup( arc4_context *ctx, const unsigned char *key, unsigned int keylen )
void arc4_setup( arc4_context *ctx, const unsigned char *key,
unsigned int keylen )
{
int i, j, a;
unsigned int k;
@ -135,15 +164,17 @@ static const unsigned char arc4_test_ct[3][8] =
*/
int arc4_self_test( int verbose )
{
int i;
int i, ret = 0;
unsigned char ibuf[8];
unsigned char obuf[8];
arc4_context ctx;
arc4_init( &ctx );
for( i = 0; i < 3; i++ )
{
if( verbose != 0 )
printf( " ARC4 test #%d: ", i + 1 );
polarssl_printf( " ARC4 test #%d: ", i + 1 );
memcpy( ibuf, arc4_test_pt[i], 8 );
@ -153,21 +184,25 @@ int arc4_self_test( int verbose )
if( memcmp( obuf, arc4_test_ct[i], 8 ) != 0 )
{
if( verbose != 0 )
printf( "failed\n" );
polarssl_printf( "failed\n" );
return( 1 );
ret = 1;
goto exit;
}
if( verbose != 0 )
printf( "passed\n" );
polarssl_printf( "passed\n" );
}
if( verbose != 0 )
printf( "\n" );
polarssl_printf( "\n" );
return( 0 );
exit:
arc4_free( &ctx );
return( ret );
}
#endif
#endif /* POLARSSL_SELF_TEST */
#endif
#endif /* POLARSSL_ARC4_C */