[git] GCRYPT - branch, master, updated. libgcrypt-1.5.0-206-gf351524

by Jussi Kivilinna cvs at cvs.gnupg.org
Sun Sep 1 20:43:21 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  f3515240de9513ead975985c9f8ab714022cac8e (commit)
       via  8b735cb563dff7aafbf8a970972522b5621e665c (commit)
       via  d12828cd821a4b4428eae19de5aee02cf536e536 (commit)
      from  fd6721c235a5bdcb332c8eb708fbd4f96e52e824 (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 f3515240de9513ead975985c9f8ab714022cac8e
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Sun Sep 1 16:50:55 2013 +0300

    camellia-aesni-avx2-amd64: Move register clearing to assembly functions
    
    * cipher/camellia-aesni-avx2-amd64.S
    (_gcry_camellia_aesni_avx2_ctr_enc): Add 'vzeroall'.
    (_gcry_camellia_aesni_avx2_cbc_dec)
    (_gcry_camellia_aesni_avx2_cfb_dec): Add 'vzeroupper' at head and
    'vzeroall' at tail.
    * cipher/camellia-glue.c (_gcry_serpent_ctr_enc, _gcry_serpent_cbc_dec)
    (_gcry_serpent_avx2_cfb_dec) [USE_AESNI_AVX2]: Remove register
    clearing.
    --
    
    Patch moves register clearing with 'vzeroall' to assembly functions and
    adds missing 'vzeroupper' instructions at head of assembly functions.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/camellia-aesni-avx2-amd64.S b/cipher/camellia-aesni-avx2-amd64.S
index da427b4..7e31323 100644
--- a/cipher/camellia-aesni-avx2-amd64.S
+++ b/cipher/camellia-aesni-avx2-amd64.S
@@ -1104,6 +1104,8 @@ _gcry_camellia_aesni_avx2_ctr_enc:
 		     %ymm15, %ymm14, %ymm13, %ymm12, %ymm11, %ymm10, %ymm9,
 		     %ymm8, %rsi);
 
+	vzeroall;
+
 	ret;
 .size _gcry_camellia_aesni_avx2_ctr_enc,.-_gcry_camellia_aesni_avx2_ctr_enc;
 
@@ -1119,6 +1121,8 @@ _gcry_camellia_aesni_avx2_cbc_dec:
 	 *	%rcx: iv
 	 */
 
+	vzeroupper;
+
 	movq %rcx, %r9;
 
 	cmpl $128, key_bitlength(CTX);
@@ -1171,6 +1175,8 @@ _gcry_camellia_aesni_avx2_cbc_dec:
 	movq %rax, (0)(%r9);
 	movq %rcx, (8)(%r9);
 
+	vzeroall;
+
 	ret;
 .size _gcry_camellia_aesni_avx2_cbc_dec,.-_gcry_camellia_aesni_avx2_cbc_dec;
 
@@ -1186,6 +1192,8 @@ _gcry_camellia_aesni_avx2_cfb_dec:
 	 *	%rcx: iv
 	 */
 
+	vzeroupper;
+
 	movq %rsp, %r10;
 	subq $(16 * 32), %rsp;
 	andq $~31, %rsp;
@@ -1240,6 +1248,8 @@ _gcry_camellia_aesni_avx2_cfb_dec:
 		     %ymm15, %ymm14, %ymm13, %ymm12, %ymm11, %ymm10, %ymm9,
 		     %ymm8, %rsi);
 
+	vzeroall;
+
 	ret;
 .size _gcry_camellia_aesni_avx2_cfb_dec,.-_gcry_camellia_aesni_avx2_cfb_dec;
 
diff --git a/cipher/camellia-glue.c b/cipher/camellia-glue.c
index 7d8a4cd..d6d6005 100644
--- a/cipher/camellia-glue.c
+++ b/cipher/camellia-glue.c
@@ -314,9 +314,6 @@ _gcry_camellia_ctr_enc(void *context, unsigned char *ctr,
           int avx2_burn_stack_depth = 32 * CAMELLIA_BLOCK_SIZE + 16 +
                                         2 * sizeof(void *);
 
-          /* clear AVX registers */
-          asm volatile ("vzeroall;\n":::);
-
           if (burn_stack_depth < avx2_burn_stack_depth)
             burn_stack_depth = avx2_burn_stack_depth;
         }
@@ -408,9 +405,6 @@ _gcry_camellia_cbc_dec(void *context, unsigned char *iv,
           int avx2_burn_stack_depth = 32 * CAMELLIA_BLOCK_SIZE + 16 +
                                         2 * sizeof(void *);
 
-          /* clear AVX registers */
-          asm volatile ("vzeroall;\n":::);
-
           if (burn_stack_depth < avx2_burn_stack_depth)
             burn_stack_depth = avx2_burn_stack_depth;
         }
@@ -496,9 +490,6 @@ _gcry_camellia_cfb_dec(void *context, unsigned char *iv,
           int avx2_burn_stack_depth = 32 * CAMELLIA_BLOCK_SIZE + 16 +
                                         2 * sizeof(void *);
 
-          /* clear AVX registers */
-          asm volatile ("vzeroall;\n":::);
-
           if (burn_stack_depth < avx2_burn_stack_depth)
             burn_stack_depth = avx2_burn_stack_depth;
         }

commit 8b735cb563dff7aafbf8a970972522b5621e665c
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Sun Sep 1 16:50:55 2013 +0300

    camellia-aesni-avx-amd64: Move register clearing to assembly functions
    
    * cipher/camellia-aesni-avx-amd64.S (_gcry_camellia_aesni_avx_ctr_enc)
    (_gcry_camellia_aesni_avx_cbc_dec)
    (_gcry_camellia_aesni_avx_cfb_dec): Add 'vzeroupper' at head and
    'vzeroall' at tail.
    * cipher/camellia-glue.c (_gcry_serpent_ctr_enc, _gcry_serpent_cbc_dec)
    (_gcry_serpent_avx2_cfb_dec) [USE_AESNI_AVX]: Remove register clearing.
    --
    
    Patch moves register clearing with 'vzeroall' to assembly functions and
    adds missing 'vzeroupper' instructions at head of assembly functions.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/camellia-aesni-avx-amd64.S b/cipher/camellia-aesni-avx-amd64.S
index b0ef5fd..9873d98 100644
--- a/cipher/camellia-aesni-avx-amd64.S
+++ b/cipher/camellia-aesni-avx-amd64.S
@@ -958,6 +958,8 @@ _gcry_camellia_aesni_avx_ctr_enc:
 	 *	%rcx: iv (big endian, 128bit)
 	 */
 
+	vzeroupper;
+
 	subq $(16 * 16), %rsp;
 	movq %rsp, %rax;
 
@@ -1054,6 +1056,8 @@ _gcry_camellia_aesni_avx_ctr_enc:
 		     %xmm15, %xmm14, %xmm13, %xmm12, %xmm11, %xmm10, %xmm9,
 		     %xmm8, %rsi);
 
+	vzeroall;
+
 	ret;
 .size _gcry_camellia_aesni_avx_ctr_enc,.-_gcry_camellia_aesni_avx_ctr_enc;
 
@@ -1069,6 +1073,8 @@ _gcry_camellia_aesni_avx_cbc_dec:
 	 *	%rcx: iv
 	 */
 
+	vzeroupper;
+
 	movq %rcx, %r9;
 
 	cmpl $128, key_bitlength(CTX);
@@ -1114,6 +1120,8 @@ _gcry_camellia_aesni_avx_cbc_dec:
 	movq %r10, (0)(%r9);
 	movq %r11, (8)(%r9);
 
+	vzeroall;
+
 	ret;
 .size _gcry_camellia_aesni_avx_cbc_dec,.-_gcry_camellia_aesni_avx_cbc_dec;
 
@@ -1129,6 +1137,8 @@ _gcry_camellia_aesni_avx_cfb_dec:
 	 *	%rcx: iv
 	 */
 
+	vzeroupper;
+
 	subq $(16 * 16), %rsp;
 	movq %rsp, %rax;
 
@@ -1179,6 +1189,8 @@ _gcry_camellia_aesni_avx_cfb_dec:
 		     %xmm15, %xmm14, %xmm13, %xmm12, %xmm11, %xmm10, %xmm9,
 		     %xmm8, %rsi);
 
+	vzeroall;
+
 	ret;
 .size _gcry_camellia_aesni_avx_cfb_dec,.-_gcry_camellia_aesni_avx_cfb_dec;
 
diff --git a/cipher/camellia-glue.c b/cipher/camellia-glue.c
index 6e2319d..7d8a4cd 100644
--- a/cipher/camellia-glue.c
+++ b/cipher/camellia-glue.c
@@ -344,9 +344,6 @@ _gcry_camellia_ctr_enc(void *context, unsigned char *ctr,
 
       if (did_use_aesni_avx)
         {
-          /* clear AVX registers */
-          asm volatile ("vzeroall;\n":::);
-
           if (burn_stack_depth < 16 * CAMELLIA_BLOCK_SIZE + 2 * sizeof(void *))
             burn_stack_depth = 16 * CAMELLIA_BLOCK_SIZE + 2 * sizeof(void *);
         }
@@ -440,9 +437,6 @@ _gcry_camellia_cbc_dec(void *context, unsigned char *iv,
 
       if (did_use_aesni_avx)
         {
-          /* clear AVX registers */
-          asm volatile ("vzeroall;\n":::);
-
           if (burn_stack_depth < 16 * CAMELLIA_BLOCK_SIZE + 2 * sizeof(void *))
             burn_stack_depth = 16 * CAMELLIA_BLOCK_SIZE + 2 * sizeof(void *);
         }
@@ -531,9 +525,6 @@ _gcry_camellia_cfb_dec(void *context, unsigned char *iv,
 
       if (did_use_aesni_avx)
         {
-          /* clear AVX registers */
-          asm volatile ("vzeroall;\n":::);
-
           if (burn_stack_depth < 16 * CAMELLIA_BLOCK_SIZE + 2 * sizeof(void *))
             burn_stack_depth = 16 * CAMELLIA_BLOCK_SIZE + 2 * sizeof(void *);
         }

commit d12828cd821a4b4428eae19de5aee02cf536e536
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Sun Sep 1 16:50:55 2013 +0300

    serpent-avx2-amd64: Move register clearing to assembly
    
    * cipher/serpent-avx2-amd64.S (_gcry_serpent_avx2_ctr_enc)
    (_gcry_serpent_avx2_cbc_dec, _gcry_serpent_avx2_cfb_dec): Change last
    'vzeroupper' to 'vzeroall'.
    * cipher/serpent.c (_gcry_serpent_ctr_enc, _gcry_serpent_cbc_dec)
    (_gcry_serpent_avx2_cfb_dec) [USE_AVX2]: Remove register clearing with
    'vzeroall'.
    --
    
    AVX2 implementation was already clearing upper halfs of YMM registers at end of
    assembly functions to prevent long SSE<->AVX transition stalls present on Intel
    CPUs. Patch changes these 'vzeroupper' instructions to 'vzeroall' to fully
    clear YMM registers. After this change register clearing in serpent.c in not
    needed.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/serpent-avx2-amd64.S b/cipher/serpent-avx2-amd64.S
index 7586c0c..c726e7b 100644
--- a/cipher/serpent-avx2-amd64.S
+++ b/cipher/serpent-avx2-amd64.S
@@ -730,7 +730,7 @@ _gcry_serpent_avx2_ctr_enc:
 	vmovdqu RB2, (6 * 32)(%rsi);
 	vmovdqu RB3, (7 * 32)(%rsi);
 
-	vzeroupper;
+	vzeroall;
 
 	ret
 .size _gcry_serpent_avx2_ctr_enc,.-_gcry_serpent_avx2_ctr_enc;
@@ -799,7 +799,7 @@ _gcry_serpent_avx2_cbc_dec:
 	vmovdqu RB2, (6 * 32)(%rsi);
 	vmovdqu RB3, (7 * 32)(%rsi);
 
-	vzeroupper;
+	vzeroall;
 
 	ret
 .size _gcry_serpent_avx2_cbc_dec,.-_gcry_serpent_avx2_cbc_dec;
@@ -870,7 +870,7 @@ _gcry_serpent_avx2_cfb_dec:
 	vmovdqu RB2, (6 * 32)(%rsi);
 	vmovdqu RB3, (7 * 32)(%rsi);
 
-	vzeroupper;
+	vzeroall;
 
 	ret
 .size _gcry_serpent_avx2_cfb_dec,.-_gcry_serpent_avx2_cfb_dec;
diff --git a/cipher/serpent.c b/cipher/serpent.c
index bf03fe7..430a7e9 100644
--- a/cipher/serpent.c
+++ b/cipher/serpent.c
@@ -845,9 +845,6 @@ _gcry_serpent_ctr_enc(void *context, unsigned char *ctr,
 
       if (did_use_avx2)
         {
-          /* clear avx2 registers used by serpent-sse2 */
-          asm volatile ("vzeroall;\n":::);
-
           /* serpent-avx2 assembly code does not use stack */
           if (nblocks == 0)
             burn_stack_depth = 0;
@@ -937,9 +934,6 @@ _gcry_serpent_cbc_dec(void *context, unsigned char *iv,
 
       if (did_use_avx2)
         {
-          /* clear avx2 registers used by serpent-sse2 */
-          asm volatile ("vzeroall;\n":::);
-
           /* serpent-avx2 assembly code does not use stack */
           if (nblocks == 0)
             burn_stack_depth = 0;
@@ -1023,9 +1017,6 @@ _gcry_serpent_cfb_dec(void *context, unsigned char *iv,
 
       if (did_use_avx2)
         {
-          /* clear avx2 registers used by serpent-sse2 */
-          asm volatile ("vzeroall;\n":::);
-
           /* serpent-avx2 assembly code does not use stack */
           if (nblocks == 0)
             burn_stack_depth = 0;

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

Summary of changes:
 cipher/camellia-aesni-avx-amd64.S  |   12 ++++++++++++
 cipher/camellia-aesni-avx2-amd64.S |   10 ++++++++++
 cipher/camellia-glue.c             |   18 ------------------
 cipher/serpent-avx2-amd64.S        |    6 +++---
 cipher/serpent.c                   |    9 ---------
 5 files changed, 25 insertions(+), 30 deletions(-)


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




More information about the Gnupg-commits mailing list