gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, master, updated. gnutls_3_0_0-37-gd212851


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_0_0-37-gd212851
Date: Thu, 11 Aug 2011 16:49:52 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=d21285196611811120ff1ba41e64f716f244f3d8

The branch, master has been updated
       via  d21285196611811120ff1ba41e64f716f244f3d8 (commit)
      from  641115f7ebcb29b1ff6ebd0aa5de13b94684c13b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d21285196611811120ff1ba41e64f716f244f3d8
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Thu Aug 11 18:48:44 2011 +0200

    Force alignment for AES-NI to the runtime rather than on the structures.
    Corrects issue on some systems (reported by Andreas Radke).

-----------------------------------------------------------------------

Summary of changes:
 lib/accelerated/intel/aes-x86.c |   11 +++++++----
 lib/accelerated/intel/aes-x86.h |   11 +++--------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/lib/accelerated/intel/aes-x86.c b/lib/accelerated/intel/aes-x86.c
index 6801e7e..68a5e1a 100644
--- a/lib/accelerated/intel/aes-x86.c
+++ b/lib/accelerated/intel/aes-x86.c
@@ -40,6 +40,9 @@ struct aes_ctx
   uint8_t iv[16];
 };
 
+#define ALIGN16(x) \
+        ((void *)(((unsigned long)(x)+0x0f)&~(0x0f)))
+
 static int
 aes_cipher_init (gnutls_cipher_algorithm_t algorithm, void **_ctx)
 {
@@ -69,11 +72,11 @@ aes_cipher_setkey (void *_ctx, const void *userkey, size_t 
keysize)
   struct aes_ctx *ctx = _ctx;
   int ret;
 
-  ret = aesni_set_encrypt_key (userkey, keysize * 8, &ctx->expanded_key);
+  ret = aesni_set_encrypt_key (userkey, keysize * 8, 
ALIGN16(&ctx->expanded_key));
   if (ret != 0)
     return gnutls_assert_val (GNUTLS_E_ENCRYPTION_FAILED);
 
-  ret = aesni_set_decrypt_key (userkey, keysize * 8, &ctx->expanded_key_dec);
+  ret = aesni_set_decrypt_key (userkey, keysize * 8, 
ALIGN16(&ctx->expanded_key_dec));
   if (ret != 0)
     return gnutls_assert_val (GNUTLS_E_ENCRYPTION_FAILED);
 
@@ -95,7 +98,7 @@ aes_encrypt (void *_ctx, const void *src, size_t src_size,
 {
   struct aes_ctx *ctx = _ctx;
 
-  aesni_cbc_encrypt (src, dst, src_size, &ctx->expanded_key, ctx->iv, 1);
+  aesni_cbc_encrypt (src, dst, src_size, ALIGN16(&ctx->expanded_key), ctx->iv, 
1);
   return 0;
 }
 
@@ -105,7 +108,7 @@ aes_decrypt (void *_ctx, const void *src, size_t src_size,
 {
   struct aes_ctx *ctx = _ctx;
 
-  aesni_cbc_encrypt (src, dst, src_size, &ctx->expanded_key_dec, ctx->iv, 0);
+  aesni_cbc_encrypt (src, dst, src_size, ALIGN16(&ctx->expanded_key_dec), 
ctx->iv, 0);
 
   return 0;
 }
diff --git a/lib/accelerated/intel/aes-x86.h b/lib/accelerated/intel/aes-x86.h
index 8f49ff3..a4cac1d 100644
--- a/lib/accelerated/intel/aes-x86.h
+++ b/lib/accelerated/intel/aes-x86.h
@@ -5,17 +5,12 @@
 
 void register_x86_crypto (void);
 
-#ifdef __GNUC__
-# define ALIGN16 __attribute__ ((aligned (16)))
-#else
-# define ALIGN16
-#endif
-
+#define AES_KEY_ALIGN_SIZE 4
 #define AES_MAXNR 14
 typedef struct
 {
-  uint32_t ALIGN16 rd_key[4 * (AES_MAXNR + 1)];
-  int rounds;
+  uint32_t rd_key[4 * (AES_MAXNR + 1)+AES_KEY_ALIGN_SIZE];
+  int rounds; /* unused... */
 } AES_KEY;
 
 void aesni_ecb_encrypt (const unsigned char *in, unsigned char *out,


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]