1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Add support for key inversion using AES-NI

This commit is contained in:
Manuel Pégourié-Gonnard
2013-12-28 15:58:30 +01:00
parent 80637c7520
commit 01e31bbffb
3 changed files with 42 additions and 0 deletions

View File

@ -591,6 +591,15 @@ int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int key
if( ret != 0 )
return( ret );
#if defined(POLARSSL_AESNI_C) && defined(POLARSSL_HAVE_X86_64)
if( aesni_supports( POLARSSL_AESNI_AES ) )
{
aesni_inverse_key( (unsigned char *) ctx->rk,
(const unsigned char *) cty.rk, ctx->nr );
goto done;
}
#endif
SK = cty.rk + cty.nr * 4;
*RK++ = *SK++;
@ -614,6 +623,7 @@ int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int key
*RK++ = *SK++;
*RK++ = *SK++;
done:
memset( &cty, 0, sizeof( aes_context ) );
return( 0 );