1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-28 00:21:48 +03:00

Add AES-NI key expansion for 128 bits

This commit is contained in:
Manuel Pégourié-Gonnard
2013-12-28 20:45:04 +01:00
parent 01e31bbffb
commit 47a3536a31
3 changed files with 86 additions and 0 deletions

View File

@ -483,6 +483,15 @@ int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int key
#endif
ctx->rk = RK = ctx->buf;
#if defined(POLARSSL_AESNI_C) && defined(POLARSSL_HAVE_X86_64)
if( aesni_supports( POLARSSL_AESNI_AES ) )
{
int ret = aesni_setkey_enc( (unsigned char *) ctx->rk, key, keysize );
// XXX: temporary while some key size aren't handled
if( ret == 0 ) return( ret );
}
#endif
for( i = 0; i < (keysize >> 5); i++ )
{
GET_UINT32_LE( RK[i], key, i << 2 );