mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 00:55:39 +01:00
- AES code only check for Padlock once
This commit is contained in:
parent
39dfdaca8f
commit
048d04ef4b
@ -11,6 +11,7 @@ Features
|
|||||||
|
|
||||||
Changes
|
Changes
|
||||||
* Removed redundant POLARSSL_DEBUG_MSG define
|
* Removed redundant POLARSSL_DEBUG_MSG define
|
||||||
|
* AES code only check for Padlock once
|
||||||
|
|
||||||
= Version 1.1.1 released on 2012-01-23
|
= Version 1.1.1 released on 2012-01-23
|
||||||
Bugfix
|
Bugfix
|
||||||
|
@ -59,6 +59,10 @@
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(POLARSSL_PADLOCK_C)
|
||||||
|
static int aes_padlock_ace = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(POLARSSL_AES_ROM_TABLES)
|
#if defined(POLARSSL_AES_ROM_TABLES)
|
||||||
/*
|
/*
|
||||||
* Forward S-box
|
* Forward S-box
|
||||||
@ -449,6 +453,7 @@ int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int key
|
|||||||
{
|
{
|
||||||
aes_gen_tables();
|
aes_gen_tables();
|
||||||
aes_init_done = 1;
|
aes_init_done = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -460,11 +465,15 @@ int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int key
|
|||||||
default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
|
default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PADLOCK_ALIGN16)
|
#if defined(POLARSSL_PADLOCK_C) && defined(PADLOCK_ALIGN16)
|
||||||
|
if( aes_padlock_ace == -1 )
|
||||||
|
aes_padlock_ace = padlock_supports( PADLOCK_ACE );
|
||||||
|
|
||||||
|
if( aes_padlock_ace )
|
||||||
ctx->rk = RK = PADLOCK_ALIGN16( ctx->buf );
|
ctx->rk = RK = PADLOCK_ALIGN16( ctx->buf );
|
||||||
#else
|
else
|
||||||
ctx->rk = RK = ctx->buf;
|
|
||||||
#endif
|
#endif
|
||||||
|
ctx->rk = RK = ctx->buf;
|
||||||
|
|
||||||
for( i = 0; i < (keysize >> 5); i++ )
|
for( i = 0; i < (keysize >> 5); i++ )
|
||||||
{
|
{
|
||||||
@ -560,11 +569,15 @@ int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int key
|
|||||||
default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
|
default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PADLOCK_ALIGN16)
|
#if defined(POLARSSL_PADLOCK_C) && defined(PADLOCK_ALIGN16)
|
||||||
|
if( aes_padlock_ace == -1 )
|
||||||
|
aes_padlock_ace = padlock_supports( PADLOCK_ACE );
|
||||||
|
|
||||||
|
if( aes_padlock_ace )
|
||||||
ctx->rk = RK = PADLOCK_ALIGN16( ctx->buf );
|
ctx->rk = RK = PADLOCK_ALIGN16( ctx->buf );
|
||||||
#else
|
else
|
||||||
ctx->rk = RK = ctx->buf;
|
|
||||||
#endif
|
#endif
|
||||||
|
ctx->rk = RK = ctx->buf;
|
||||||
|
|
||||||
ret = aes_setkey_enc( &cty, key, keysize );
|
ret = aes_setkey_enc( &cty, key, keysize );
|
||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
@ -656,7 +669,7 @@ int aes_crypt_ecb( aes_context *ctx,
|
|||||||
unsigned long *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
|
unsigned long *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
|
||||||
|
|
||||||
#if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86)
|
#if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86)
|
||||||
if( padlock_supports( PADLOCK_ACE ) )
|
if( aes_padlock_ace )
|
||||||
{
|
{
|
||||||
if( padlock_xcryptecb( ctx, mode, input, output ) == 0 )
|
if( padlock_xcryptecb( ctx, mode, input, output ) == 0 )
|
||||||
return( 0 );
|
return( 0 );
|
||||||
@ -768,7 +781,7 @@ int aes_crypt_cbc( aes_context *ctx,
|
|||||||
return( POLARSSL_ERR_AES_INVALID_INPUT_LENGTH );
|
return( POLARSSL_ERR_AES_INVALID_INPUT_LENGTH );
|
||||||
|
|
||||||
#if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86)
|
#if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86)
|
||||||
if( padlock_supports( PADLOCK_ACE ) )
|
if( aes_padlock_ace )
|
||||||
{
|
{
|
||||||
if( padlock_xcryptcbc( ctx, mode, length, iv, input, output ) == 0 )
|
if( padlock_xcryptcbc( ctx, mode, length, iv, input, output ) == 0 )
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
Loading…
Reference in New Issue
Block a user