gnutls-commit
[Top][All Lists]
Advanced

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

[SCM] GNU gnutls branch, gnutls_3_0_x, updated. gnutls_3_0_0-37-g7da7af3


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, gnutls_3_0_x, updated. gnutls_3_0_0-37-g7da7af3
Date: Thu, 11 Aug 2011 16:49:46 +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=7da7af3c68a54e88ddf825c4a412fe6824b86fcd

The branch, gnutls_3_0_x has been updated
       via  7da7af3c68a54e88ddf825c4a412fe6824b86fcd (commit)
      from  dbeae928aa4db45aacbeb42a79e67de3057a2c18 (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 7da7af3c68a54e88ddf825c4a412fe6824b86fcd
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]