[git] GCRYPT - branch, master, updated. libgcrypt-1.7.3-57-g39b9302
by Jussi Kivilinna
cvs at cvs.gnupg.org
Mon Jan 23 22:00:18 CET 2017
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 "The GNU crypto library".
The branch, master has been updated
via 39b9302da5d08bd52688d20befe626fee0b6c41d (commit)
via bf9e0b79e620ca2324224893b07522462b125412 (commit)
from 623aab8a940ea61afe3fef650ad485a755ed9fe7 (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 39b9302da5d08bd52688d20befe626fee0b6c41d
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date: Mon Jan 23 20:01:32 2017 +0200
rijndael-ssse3-amd64: fix building on x32
* cipher/rijndael-ssse3-amd64.c: Use 64-bit call instructions
with 64-bit registers.
--
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
diff --git a/cipher/rijndael-ssse3-amd64.c b/cipher/rijndael-ssse3-amd64.c
index 25d1849..78d8234 100644
--- a/cipher/rijndael-ssse3-amd64.c
+++ b/cipher/rijndael-ssse3-amd64.c
@@ -128,14 +128,14 @@ extern void _gcry_aes_ssse3_decrypt_core(void);
#define vpaes_ssse3_prepare_enc() \
vpaes_ssse3_prepare(); \
- asm volatile ("call *%[core] \n\t" \
+ asm volatile ("callq *%q[core] \n\t" \
: \
: [core] "r" (_gcry_aes_ssse3_enc_preload) \
: "rax", "cc", "memory" )
#define vpaes_ssse3_prepare_dec() \
vpaes_ssse3_prepare(); \
- asm volatile ("call *%[core] \n\t" \
+ asm volatile ("callq *%q[core] \n\t" \
: \
: [core] "r" (_gcry_aes_ssse3_dec_preload) \
: "rax", "cc", "memory" )
@@ -155,7 +155,7 @@ _gcry_aes_ssse3_do_setkey (RIJNDAEL_context *ctx, const byte *key)
"leaq %[buf], %%rdx" "\n\t"
"movl %[dir], %%ecx" "\n\t"
"movl %[rotoffs], %%r8d" "\n\t"
- "call *%[core]" "\n\t"
+ "callq *%q[core]" "\n\t"
:
: [core] "r" (&_gcry_aes_ssse3_schedule_core),
[key] "m" (*key),
@@ -208,7 +208,7 @@ _gcry_aes_ssse3_prepare_decryption (RIJNDAEL_context *ctx)
"leaq %[buf], %%rdx" "\n\t"
"movl %[dir], %%ecx" "\n\t"
"movl %[rotoffs], %%r8d" "\n\t"
- "call *%[core]" "\n\t"
+ "callq *%q[core]" "\n\t"
:
: [core] "r" (_gcry_aes_ssse3_schedule_core),
[key] "m" (ctx->keyschdec32[0][0]),
@@ -231,7 +231,7 @@ do_vpaes_ssse3_enc (const RIJNDAEL_context *ctx, unsigned int nrounds)
unsigned int middle_rounds = nrounds - 1;
const void *keysched = ctx->keyschenc32;
- asm volatile ("call *%[core]" "\n\t"
+ asm volatile ("callq *%q[core]" "\n\t"
: "+a" (middle_rounds), "+d" (keysched)
: [core] "r" (_gcry_aes_ssse3_encrypt_core)
: "rcx", "rsi", "rdi", "cc", "memory");
@@ -246,7 +246,7 @@ do_vpaes_ssse3_dec (const RIJNDAEL_context *ctx, unsigned int nrounds)
unsigned int middle_rounds = nrounds - 1;
const void *keysched = ctx->keyschdec32;
- asm volatile ("call *%[core]" "\n\t"
+ asm volatile ("callq *%q[core]" "\n\t"
: "+a" (middle_rounds), "+d" (keysched)
: [core] "r" (_gcry_aes_ssse3_decrypt_core)
: "rcx", "rsi", "cc", "memory");
commit bf9e0b79e620ca2324224893b07522462b125412
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date: Mon Jan 23 19:48:28 2017 +0200
bufhelp: use 'may_alias' attribute unaligned pointer types
* configure.ac (gcry_cv_gcc_attribute_may_alias)
(HAVE_GCC_ATTRIBUTE_MAY_ALIAS): New check for 'may_alias' attribute.
* cipher/bufhelp.h (BUFHELP_FAST_UNALIGNED_ACCESS): Enable only if
HAVE_GCC_ATTRIBUTE_MAY_ALIAS is defined.
[BUFHELP_FAST_UNALIGNED_ACCESS] (bufhelp_int_t, bufhelp_u32_t)
(bufhelp_u64_t): Add 'may_alias' attribute.
* src/g10lib.h (fast_wipememory_t): Add HAVE_GCC_ATTRIBUTE_MAY_ALIAS
defined check; Add 'may_alias' attribute.
--
Attribute 'may_alias' was missing from bufhelp unaligned memory access
pointer types, and was causing problems with newer GCC versions (with
more aggressive optimization). This patch fixes broken Camellia-CFB
with '-O3 -flto' flags with GCC-6 on x86-64 and generic GCM with
default '-O2' on x32.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
diff --git a/cipher/bufhelp.h b/cipher/bufhelp.h
index df35594..3616515 100644
--- a/cipher/bufhelp.h
+++ b/cipher/bufhelp.h
@@ -26,6 +26,7 @@
#undef BUFHELP_FAST_UNALIGNED_ACCESS
#if defined(HAVE_GCC_ATTRIBUTE_PACKED) && \
defined(HAVE_GCC_ATTRIBUTE_ALIGNED) && \
+ defined(HAVE_GCC_ATTRIBUTE_MAY_ALIAS) && \
(defined(__i386__) || defined(__x86_64__) || \
(defined(__arm__) && defined(__ARM_FEATURE_UNALIGNED)) || \
defined(__aarch64__))
@@ -43,7 +44,7 @@
typedef struct bufhelp_int_s
{
uintptr_t a;
-} __attribute__((packed, aligned(1))) bufhelp_int_t;
+} __attribute__((packed, aligned(1), may_alias)) bufhelp_int_t;
#else
/* Define type with default alignment for other architectures (unaligned
accessed handled in per byte loops).
@@ -370,7 +371,7 @@ static inline void buf_put_le64(void *_buf, u64 val)
typedef struct bufhelp_u32_s
{
u32 a;
-} __attribute__((packed, aligned(1))) bufhelp_u32_t;
+} __attribute__((packed, aligned(1), may_alias)) bufhelp_u32_t;
/* Functions for loading and storing unaligned u32 values of different
endianness. */
@@ -400,7 +401,7 @@ static inline void buf_put_le32(void *_buf, u32 val)
typedef struct bufhelp_u64_s
{
u64 a;
-} __attribute__((packed, aligned(1))) bufhelp_u64_t;
+} __attribute__((packed, aligned(1), may_alias)) bufhelp_u64_t;
/* Functions for loading and storing unaligned u64 values of different
endianness. */
diff --git a/configure.ac b/configure.ac
index 31c0d55..5dd27ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -994,6 +994,21 @@ fi
#
+# Check whether the compiler supports the GCC style may_alias attribute
+#
+AC_CACHE_CHECK([whether the GCC style may_alias attribute is supported],
+ [gcry_cv_gcc_attribute_may_alias],
+ [gcry_cv_gcc_attribute_may_alias=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [[struct { int a; } foo __attribute__ ((may_alias));]])],
+ [gcry_cv_gcc_attribute_may_alias=yes])])
+if test "$gcry_cv_gcc_attribute_may_alias" = "yes" ; then
+ AC_DEFINE(HAVE_GCC_ATTRIBUTE_MAY_ALIAS,1,
+ [Defined if a GCC style "__attribute__ ((may_alias))" is supported])
+fi
+
+
+#
# Check whether the compiler supports 'asm' or '__asm__' keyword for
# assembler blocks.
#
diff --git a/src/g10lib.h b/src/g10lib.h
index 1308cff..8ce84b8 100644
--- a/src/g10lib.h
+++ b/src/g10lib.h
@@ -334,6 +334,7 @@ void __gcry_burn_stack (unsigned int bytes);
/* Following architectures can handle unaligned accesses fast. */
#if defined(HAVE_GCC_ATTRIBUTE_PACKED) && \
defined(HAVE_GCC_ATTRIBUTE_ALIGNED) && \
+ defined(HAVE_GCC_ATTRIBUTE_MAY_ALIAS) && \
(defined(__i386__) || defined(__x86_64__) || \
defined(__powerpc__) || defined(__powerpc64__) || \
(defined(__arm__) && defined(__ARM_FEATURE_UNALIGNED)) || \
@@ -342,7 +343,7 @@ void __gcry_burn_stack (unsigned int bytes);
typedef struct fast_wipememory_s
{
FASTWIPE_T a;
-} __attribute__((packed, aligned(1))) fast_wipememory_t;
+} __attribute__((packed, aligned(1), may_alias)) fast_wipememory_t;
#else
#define fast_wipememory2_unaligned_head(_vptr,_vset,_vlen) do { \
while((size_t)(_vptr)&(sizeof(FASTWIPE_T)-1) && _vlen) \
-----------------------------------------------------------------------
Summary of changes:
cipher/bufhelp.h | 7 ++++---
cipher/rijndael-ssse3-amd64.c | 12 ++++++------
configure.ac | 15 +++++++++++++++
src/g10lib.h | 3 ++-
4 files changed, 27 insertions(+), 10 deletions(-)
hooks/post-receive
--
The GNU crypto library
http://git.gnupg.org
_______________________________________________
Gnupg-commits mailing list
Gnupg-commits at gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-commits
More information about the Gcrypt-devel
mailing list