Add aesni_crypt_ecb() and use it
diff --git a/library/aes.c b/library/aes.c
index a3835ce..6d090a1 100644
--- a/library/aes.c
+++ b/library/aes.c
@@ -37,6 +37,9 @@
 #if defined(POLARSSL_PADLOCK_C)
 #include "polarssl/padlock.h"
 #endif
+#if defined(POLARSSL_AESNI_C)
+#include "polarssl/aesni.h"
+#endif
 
 #if !defined(POLARSSL_AES_ALT)
 
@@ -673,6 +676,11 @@
     int i;
     uint32_t *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
 
+#if defined(POLARSSL_AESNI_C) && defined(POLARSSL_HAVE_X86_64)
+    if( aesni_supported() )
+        return( aesni_crypt_ecb( ctx, mode, input, output ) );
+#endif
+
 #if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86)
     if( aes_padlock_ace )
     {