mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 21:18:47 +00:00
Minor tune-up in aes code
un-duplicate a check, and remove useless default case, mainly so that these lines don't appear as uncovered
This commit is contained in:
parent
e1ac0f8c5d
commit
afd5a08e33
1 changed files with 4 additions and 14 deletions
|
@ -565,10 +565,6 @@ int aes_setkey_enc( aes_context *ctx, const unsigned char *key,
|
||||||
RK[15] = RK[7] ^ RK[14];
|
RK[15] = RK[7] ^ RK[14];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
@ -586,14 +582,6 @@ int aes_setkey_dec( aes_context *ctx, const unsigned char *key,
|
||||||
uint32_t *SK;
|
uint32_t *SK;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
switch( keysize )
|
|
||||||
{
|
|
||||||
case 128: ctx->nr = 10; break;
|
|
||||||
case 192: ctx->nr = 12; break;
|
|
||||||
case 256: ctx->nr = 14; break;
|
|
||||||
default : return( POLARSSL_ERR_AES_INVALID_KEY_LENGTH );
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(POLARSSL_PADLOCK_C) && defined(PADLOCK_ALIGN16)
|
#if defined(POLARSSL_PADLOCK_C) && defined(PADLOCK_ALIGN16)
|
||||||
if( aes_padlock_ace == -1 )
|
if( aes_padlock_ace == -1 )
|
||||||
aes_padlock_ace = padlock_supports( PADLOCK_ACE );
|
aes_padlock_ace = padlock_supports( PADLOCK_ACE );
|
||||||
|
@ -604,10 +592,12 @@ int aes_setkey_dec( aes_context *ctx, const unsigned char *key,
|
||||||
#endif
|
#endif
|
||||||
ctx->rk = RK = ctx->buf;
|
ctx->rk = RK = ctx->buf;
|
||||||
|
|
||||||
ret = aes_setkey_enc( &cty, key, keysize );
|
/* Also checks keysize */
|
||||||
if( ret != 0 )
|
if( ( ret = aes_setkey_enc( &cty, key, keysize ) ) != 0 )
|
||||||
return( ret );
|
return( ret );
|
||||||
|
|
||||||
|
ctx->nr = cty.nr;
|
||||||
|
|
||||||
#if defined(POLARSSL_AESNI_C) && defined(POLARSSL_HAVE_X86_64)
|
#if defined(POLARSSL_AESNI_C) && defined(POLARSSL_HAVE_X86_64)
|
||||||
if( aesni_supports( POLARSSL_AESNI_AES ) )
|
if( aesni_supports( POLARSSL_AESNI_AES ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue