[git] GCRYPT - branch, master, updated. libgcrypt-1.7.1-15-gcb79630

by Jussi Kivilinna cvs at cvs.gnupg.org
Sun Jul 3 17:18:00 CEST 2016


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  cb79630ec567a5f2e03e5f863cda168faa7b8cc8 (commit)
       via  07de9858032826f5a7b08c372f6bcc73bbb503eb (commit)
       via  a6158a01a4d81a5d862e1e0a60bfd6063443311d (commit)
       via  a09126242a51c4ea4564b0f70b808e4f27fe5a91 (commit)
       via  4a983e3bef58b9d056517e25e0ab10b72d12ceba (commit)
      from  6965515c73632a088fb126a4a55e95121671fa98 (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 cb79630ec567a5f2e03e5f863cda168faa7b8cc8
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Fri Jul 1 23:07:07 2016 +0300

    Fix static build
    
    * tests/pubkey.c (_gcry_pk_util_get_nbits): Make function 'static'.
    --
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/tests/pubkey.c b/tests/pubkey.c
index 3eb5b4f..1271e43 100644
--- a/tests/pubkey.c
+++ b/tests/pubkey.c
@@ -175,7 +175,7 @@ show_sexp (const char *prefix, gcry_sexp_t a)
 }
 
 /* from ../cipher/pubkey-util.c */
-gpg_err_code_t
+static gpg_err_code_t
 _gcry_pk_util_get_nbits (gcry_sexp_t list, unsigned int *r_nbits)
 {
   char buf[50];

commit 07de9858032826f5a7b08c372f6bcc73bbb503eb
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Thu Jun 30 21:51:50 2016 +0300

    Disallow encryption/decryption if key is not set
    
    * cipher/cipher.c (cipher_encrypt, cipher_decrypt): If mode is not
    NONE, make sure that key is set.
    * cipher/cipher-ccm.c (_gcry_cipher_ccm_set_nonce): Do not clear
    'marks.key' when reseting state.
    --
    
    Reported-by: Andreas Metzler <ametzler at bebt.de>
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/cipher-ccm.c b/cipher/cipher-ccm.c
index 4d8f816..d7f14d8 100644
--- a/cipher/cipher-ccm.c
+++ b/cipher/cipher-ccm.c
@@ -110,6 +110,7 @@ gcry_err_code_t
 _gcry_cipher_ccm_set_nonce (gcry_cipher_hd_t c, const unsigned char *nonce,
                             size_t noncelen)
 {
+  unsigned int marks_key;
   size_t L = 15 - noncelen;
   size_t L_;
 
@@ -122,12 +123,14 @@ _gcry_cipher_ccm_set_nonce (gcry_cipher_hd_t c, const unsigned char *nonce,
     return GPG_ERR_INV_LENGTH;
 
   /* Reset state */
+  marks_key = c->marks.key;
   memset (&c->u_mode, 0, sizeof(c->u_mode));
   memset (&c->marks, 0, sizeof(c->marks));
   memset (&c->u_iv, 0, sizeof(c->u_iv));
   memset (&c->u_ctr, 0, sizeof(c->u_ctr));
   memset (c->lastiv, 0, sizeof(c->lastiv));
   c->unused = 0;
+  c->marks.key = marks_key;
 
   /* Setup CTR */
   c->u_ctr.ctr[0] = L_;
diff --git a/cipher/cipher.c b/cipher/cipher.c
index 2b7bf21..ff3340f 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -818,6 +818,12 @@ cipher_encrypt (gcry_cipher_hd_t c, byte *outbuf, size_t outbuflen,
 {
   gcry_err_code_t rc;
 
+  if (c->mode != GCRY_CIPHER_MODE_NONE && !c->marks.key)
+    {
+      log_error ("cipher_encrypt: key not set\n");
+      return GPG_ERR_MISSING_KEY;
+    }
+
   switch (c->mode)
     {
     case GCRY_CIPHER_MODE_ECB:
@@ -935,6 +941,12 @@ cipher_decrypt (gcry_cipher_hd_t c, byte *outbuf, size_t outbuflen,
 {
   gcry_err_code_t rc;
 
+  if (c->mode != GCRY_CIPHER_MODE_NONE && !c->marks.key)
+    {
+      log_error ("cipher_decrypt: key not set\n");
+      return GPG_ERR_MISSING_KEY;
+    }
+
   switch (c->mode)
     {
     case GCRY_CIPHER_MODE_ECB:

commit a6158a01a4d81a5d862e1e0a60bfd6063443311d
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Thu Jun 30 21:34:46 2016 +0300

    Avoid unaligned accesses with ARM ldm/stm instructions
    
    * cipher/rijndael-arm.S: Remove __ARM_FEATURE_UNALIGNED ifdefs, always
    compile with unaligned load/store code paths.
    * cipher/sha512-arm.S: Ditto.
    --
    
    Reported-by: Michael Plass <mfpnb at plass-family.net>
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/rijndael-arm.S b/cipher/rijndael-arm.S
index 694369d..e3a91c2 100644
--- a/cipher/rijndael-arm.S
+++ b/cipher/rijndael-arm.S
@@ -225,7 +225,7 @@ _gcry_aes_arm_encrypt_block:
 	push {%r4-%r11, %ip, %lr};
 
 	/* read input block */
-#ifndef __ARM_FEATURE_UNALIGNED
+
 	/* test if src is unaligned */
 	tst	%r2, #3;
 	beq	1f;
@@ -238,7 +238,6 @@ _gcry_aes_arm_encrypt_block:
 	b	2f;
 .ltorg
 1:
-#endif
 	/* aligned load */
 	ldm	%r2, {RA, RB, RC, RD};
 #ifndef __ARMEL__
@@ -277,7 +276,7 @@ _gcry_aes_arm_encrypt_block:
 	add	%sp, #16;
 
 	/* store output block */
-#ifndef __ARM_FEATURE_UNALIGNED
+
 	/* test if dst is unaligned */
 	tst	RT0, #3;
 	beq	1f;
@@ -290,7 +289,6 @@ _gcry_aes_arm_encrypt_block:
 	b	2f;
 .ltorg
 1:
-#endif
 	/* aligned store */
 #ifndef __ARMEL__
 	rev	RA, RA;
@@ -484,7 +482,7 @@ _gcry_aes_arm_decrypt_block:
 	push {%r4-%r11, %ip, %lr};
 
 	/* read input block */
-#ifndef __ARM_FEATURE_UNALIGNED
+
 	/* test if src is unaligned */
 	tst	%r2, #3;
 	beq	1f;
@@ -497,7 +495,6 @@ _gcry_aes_arm_decrypt_block:
 	b	2f;
 .ltorg
 1:
-#endif
 	/* aligned load */
 	ldm	%r2, {RA, RB, RC, RD};
 #ifndef __ARMEL__
@@ -533,7 +530,7 @@ _gcry_aes_arm_decrypt_block:
 	add	%sp, #16;
 
 	/* store output block */
-#ifndef __ARM_FEATURE_UNALIGNED
+
 	/* test if dst is unaligned */
 	tst	RT0, #3;
 	beq	1f;
@@ -546,7 +543,6 @@ _gcry_aes_arm_decrypt_block:
 	b	2f;
 .ltorg
 1:
-#endif
 	/* aligned store */
 #ifndef __ARMEL__
 	rev	RA, RA;
diff --git a/cipher/sha512-arm.S b/cipher/sha512-arm.S
index 28f156e..94ec014 100644
--- a/cipher/sha512-arm.S
+++ b/cipher/sha512-arm.S
@@ -323,7 +323,7 @@ _gcry_sha512_transform_arm:
 	stm RWhi, {RT1lo,RT1hi,RT2lo,RT2hi,RT3lo,RT3hi,RT4lo,RT4hi}
 
 	/* Load input to w[16] */
-#ifndef __ARM_FEATURE_UNALIGNED
+
 	/* test if data is unaligned */
 	tst %r1, #3;
 	beq 1f;
@@ -341,7 +341,6 @@ _gcry_sha512_transform_arm:
 
 	read_be64_unaligned_4(%r1, 12 * 8, RT1lo, RT1hi, RT2lo, RT2hi, RT3lo, RT3hi, RT4lo, RT4hi, RWlo);
 	b 2f;
-#endif
 1:
 	/* aligned load */
 	add RWhi, %sp, #(w(0));

commit a09126242a51c4ea4564b0f70b808e4f27fe5a91
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Thu Jun 30 21:23:05 2016 +0300

    Fix non-PIC reference in PIC for poly1305/ARMv7-NEON
    
    * cipher/poly1305-armv7-neon.S (GET_DATA_POINTER): New.
    (_gcry_poly1305_armv7_neon_init_ext): Use GET_DATA_POINTER.
    --
    
    Reported-by: Michael Plass <mfpnb at plass-family.net>
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/poly1305-armv7-neon.S b/cipher/poly1305-armv7-neon.S
index 1134e85..b1554ed 100644
--- a/cipher/poly1305-armv7-neon.S
+++ b/cipher/poly1305-armv7-neon.S
@@ -33,6 +33,19 @@
 .fpu neon
 .arm
 
+#ifdef __PIC__
+#  define GET_DATA_POINTER(reg, name, rtmp) \
+		ldr reg, 1f; \
+		ldr rtmp, 2f; \
+		b 3f; \
+	1:	.word _GLOBAL_OFFSET_TABLE_-(3f+8); \
+	2:	.word name(GOT); \
+	3:	add reg, pc, reg; \
+		ldr reg, [reg, rtmp];
+#else
+#  define GET_DATA_POINTER(reg, name, rtmp) ldr reg, =name
+#endif
+
 .text
 
 .p2align 2
@@ -52,7 +65,7 @@ _gcry_poly1305_armv7_neon_init_ext:
 	and r2, r2, r2
 	moveq r14, #-1
 	ldmia r1!, {r2-r5}
-	ldr r7, =.Lpoly1305_init_constants_neon
+	GET_DATA_POINTER(r7,.Lpoly1305_init_constants_neon,r8)
 	mov r6, r2
 	mov r8, r2, lsr #26
 	mov r9, r3, lsr #20

commit 4a983e3bef58b9d056517e25e0ab10b72d12ceba
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Thu Jun 30 21:17:32 2016 +0300

    Fix wrong CPU feature #ifdef for SHA1/AVX
    
    * cipher/sha1-avx-amd64.S: Check for HAVE_GCC_INLINE_ASM_AVX instead of
    HAVE_GCC_INLINE_ASM_AVX2 & HAVE_GCC_INLINE_ASM_BMI2.
    --
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/sha1-avx-amd64.S b/cipher/sha1-avx-amd64.S
index 062a45b..3b3a6d1 100644
--- a/cipher/sha1-avx-amd64.S
+++ b/cipher/sha1-avx-amd64.S
@@ -31,8 +31,7 @@
 
 #if (defined(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS) || \
      defined(HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS)) && \
-    defined(HAVE_GCC_INLINE_ASM_BMI2) && \
-    defined(HAVE_GCC_INLINE_ASM_AVX2) && defined(USE_SHA1)
+    defined(HAVE_GCC_INLINE_ASM_AVX) && defined(USE_SHA1)
 
 #ifdef __PIC__
 #  define RIP (%rip)

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

Summary of changes:
 cipher/cipher-ccm.c          |  3 +++
 cipher/cipher.c              | 12 ++++++++++++
 cipher/poly1305-armv7-neon.S | 15 ++++++++++++++-
 cipher/rijndael-arm.S        | 12 ++++--------
 cipher/sha1-avx-amd64.S      |  3 +--
 cipher/sha512-arm.S          |  3 +--
 tests/pubkey.c               |  2 +-
 7 files changed, 36 insertions(+), 14 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