mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
PolarSSL: update to current stable version (1.3.4)
I just removed Externals/polarssl/, added the new version, then deleted the following files/directories: DartConfiguration.tcl Makefile doxygen/ library/Makefile programs/ scripts/ tests/ visualc/
This commit is contained in:
31
Externals/polarssl/library/xtea.c
vendored
31
Externals/polarssl/library/xtea.c
vendored
@ -57,7 +57,7 @@
|
||||
/*
|
||||
* XTEA key schedule
|
||||
*/
|
||||
void xtea_setup( xtea_context *ctx, unsigned char key[16] )
|
||||
void xtea_setup( xtea_context *ctx, const unsigned char key[16] )
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -72,13 +72,13 @@ void xtea_setup( xtea_context *ctx, unsigned char key[16] )
|
||||
/*
|
||||
* XTEA encrypt function
|
||||
*/
|
||||
int xtea_crypt_ecb( xtea_context *ctx, int mode, unsigned char input[8],
|
||||
unsigned char output[8])
|
||||
int xtea_crypt_ecb( xtea_context *ctx, int mode,
|
||||
const unsigned char input[8], unsigned char output[8])
|
||||
{
|
||||
uint32_t *k, v0, v1, i;
|
||||
|
||||
k = ctx->k;
|
||||
|
||||
|
||||
GET_UINT32_BE( v0, input, 0 );
|
||||
GET_UINT32_BE( v1, input, 4 );
|
||||
|
||||
@ -111,30 +111,28 @@ int xtea_crypt_ecb( xtea_context *ctx, int mode, unsigned char input[8],
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#if defined(POLARSSL_CIPHER_MODE_CBC)
|
||||
/*
|
||||
* XTEA-CBC buffer encryption/decryption
|
||||
*/
|
||||
int xtea_crypt_cbc( xtea_context *ctx,
|
||||
int mode,
|
||||
size_t length,
|
||||
unsigned char iv[8],
|
||||
unsigned char *input,
|
||||
int xtea_crypt_cbc( xtea_context *ctx, int mode, size_t length,
|
||||
unsigned char iv[8], const unsigned char *input,
|
||||
unsigned char *output)
|
||||
{
|
||||
int i;
|
||||
unsigned char temp[8];
|
||||
|
||||
if(length % 8)
|
||||
if( length % 8 )
|
||||
return( POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH );
|
||||
|
||||
if( mode == XTEA_DECRYPT )
|
||||
if( mode == XTEA_DECRYPT )
|
||||
{
|
||||
while( length > 0 )
|
||||
{
|
||||
memcpy( temp, input, 8 );
|
||||
xtea_crypt_ecb( ctx, mode, input, output );
|
||||
|
||||
for(i = 0; i < 8; i++)
|
||||
for(i = 0; i < 8; i++)
|
||||
output[i] = (unsigned char)( output[i] ^ iv[i] );
|
||||
|
||||
memcpy( iv, temp, 8 );
|
||||
@ -143,8 +141,8 @@ int xtea_crypt_cbc( xtea_context *ctx,
|
||||
output += 8;
|
||||
length -= 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
while( length > 0 )
|
||||
{
|
||||
@ -153,7 +151,7 @@ int xtea_crypt_cbc( xtea_context *ctx,
|
||||
|
||||
xtea_crypt_ecb( ctx, mode, output, output );
|
||||
memcpy( iv, output, 8 );
|
||||
|
||||
|
||||
input += 8;
|
||||
output += 8;
|
||||
length -= 8;
|
||||
@ -162,6 +160,7 @@ int xtea_crypt_cbc( xtea_context *ctx,
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* POLARSSL_CIPHER_MODE_CBC */
|
||||
#endif /* !POLARSSL_XTEA_ALT */
|
||||
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
@ -225,7 +224,7 @@ int xtea_self_test( int verbose )
|
||||
|
||||
memcpy( buf, xtea_test_pt[i], 8 );
|
||||
|
||||
xtea_setup( &ctx, (unsigned char *) xtea_test_key[i] );
|
||||
xtea_setup( &ctx, xtea_test_key[i] );
|
||||
xtea_crypt_ecb( &ctx, XTEA_ENCRYPT, buf, buf );
|
||||
|
||||
if( memcmp( buf, xtea_test_ct[i], 8 ) != 0 )
|
||||
|
Reference in New Issue
Block a user