[git] GCRYPT - branch, master, updated. libgcrypt-1.5.0-264-g925d4fb

by Jussi Kivilinna cvs at cvs.gnupg.org
Sat Sep 21 15:10:18 CEST 2013


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  925d4fb3e8f2df3c5566ec6b5df7620a3d3504e5 (commit)
       via  cfea5c28a3822e1e7e401e5107ebe07ba7fdcf37 (commit)
      from  9337e03824a5bdd3bbbcb8382cabefe6d6c32e1e (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 925d4fb3e8f2df3c5566ec6b5df7620a3d3504e5
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Sat Sep 21 13:54:38 2013 +0300

    bufhelp: enable fast unaligned memory accesses on powerpc
    
    * cipher/bufhelp.h [__powerpc__] (BUFHELP_FAST_UNALIGNED_ACCESS): Set
    macro enabled.
    [__powerpc64__] (BUFHELP_FAST_UNALIGNED_ACCESS): Ditto.
    --
    
    PowerPC can handle unaligned memory accesses fast, so enable fast
    buffer handling in bufhelp.h.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/bufhelp.h b/cipher/bufhelp.h
index c637dac..21fac07 100644
--- a/cipher/bufhelp.h
+++ b/cipher/bufhelp.h
@@ -34,6 +34,7 @@
 
 
 #if defined(__i386__) || defined(__x86_64__) || \
+    defined(__powerpc__) || defined(__powerpc64__) || \
     (defined(__arm__) && defined(__ARM_FEATURE_UNALIGNED))
 /* These architectures are able of unaligned memory accesses and can
    handle those fast.

commit cfea5c28a3822e1e7e401e5107ebe07ba7fdcf37
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Sat Sep 21 13:54:38 2013 +0300

    Remove i386 inline assembly version of rotation functions
    
    * cipher/bithelp.h (rol, ror): Remove i386 version, change
    macros to inline functions.
    * src/hmac256.c (ror): Ditto.
    --
    
    (Current) compilers can optimize '(x << c) | (x >> (32-c))' to rotation
    instruction. So remove i386 specific assembly for manually doing this.
    Furthermore, compiler can generate faster code in case where 'c' is
    constant and can use rotate with immediate value rather than rotate
    with %cl register.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/bithelp.h b/cipher/bithelp.h
index 734dcbb..601ecac 100644
--- a/cipher/bithelp.h
+++ b/cipher/bithelp.h
@@ -26,33 +26,15 @@
 /****************
  * Rotate the 32 bit unsigned integer X by N bits left/right
  */
-#if defined(__GNUC__) && defined(__i386__)
-static inline u32
-rol( u32 x, int n)
+static inline u32 rol( u32 x, int n)
 {
-	__asm__("roll %%cl,%0"
-		:"=r" (x)
-		:"0" (x),"c" (n)
-		:"cc");
-	return x;
+	return ( (x << n) | (x >> (32-n)) );
 }
-#else
-#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
-#endif
 
-#if defined(__GNUC__) && defined(__i386__)
-static inline u32
-ror(u32 x, int n)
+static inline u32 ror(u32 x, int n)
 {
-	__asm__("rorl %%cl,%0"
-		:"=r" (x)
-		:"0" (x),"c" (n)
-		:"cc");
-	return x;
+	return ( (x >> n) | (x << (32-n)) );
 }
-#else
-#define ror(x,n) ( ((x) >> (n)) | ((x) << (32-(n))) )
-#endif
 
 /* Byte swap for 32-bit and 64-bit integers.  If available, use compiler
    provided helpers.  */
diff --git a/src/hmac256.c b/src/hmac256.c
index 2fda47b..94a26da 100644
--- a/src/hmac256.c
+++ b/src/hmac256.c
@@ -98,19 +98,10 @@ struct hmac256_context
 
 
 /* Rotate a 32 bit word.  */
-#if defined(__GNUC__) && defined(__i386__)
-static inline u32
-ror(u32 x, int n)
+static inline u32 ror(u32 x, int n)
 {
-	__asm__("rorl %%cl,%0"
-		:"=r" (x)
-		:"0" (x),"c" (n)
-		:"cc");
-	return x;
+	return ( ((x) >> (n)) | ((x) << (32-(n))) );
 }
-#else
-#define ror(x,n) ( ((x) >> (n)) | ((x) << (32-(n))) )
-#endif
 
 #define my_wipememory2(_ptr,_set,_len) do { \
               volatile char *_vptr=(volatile char *)(_ptr); \

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

Summary of changes:
 cipher/bithelp.h |   26 ++++----------------------
 cipher/bufhelp.h |    1 +
 src/hmac256.c    |   13 ++-----------
 3 files changed, 7 insertions(+), 33 deletions(-)


hooks/post-receive
-- 
The GNU crypto library
http://git.gnupg.org




More information about the Gnupg-commits mailing list