[git] GCRYPT - branch, master, updated. libgcrypt-1.6.0-194-ge886e4f

by Jussi Kivilinna cvs at cvs.gnupg.org
Sun May 3 09:51:52 CEST 2015


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  e886e4f5e73fe6a9f9191f5155852ce5d8bb88fe (commit)
       via  c2dba93e639639bdac139b3a3a456d10ddc61f79 (commit)
       via  839a3bbe2bb045139223b32753d656cc6c3d4669 (commit)
       via  9f086ffa43f2507b9d17522a0a2e394cb273baf8 (commit)
       via  e40eff94f9f8654c3d29e03bbb7e5ee6a43c1435 (commit)
       via  88842cbc68beb4f73c87fdbcb74182cba818f789 (commit)
      from  124dfce7c5a2d9405fa2b2832e91ac1267943830 (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 e886e4f5e73fe6a9f9191f5155852ce5d8bb88fe
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Fri May 1 19:07:07 2015 +0300

    Fix packed attribute check for Windows targets
    
    * configure.ac (gcry_cv_gcc_attribute_packed): Move 'long b' to its
    own packed structure.
    --
    
    Change packed attribute test so that it works with both MS ABI and SYSV ABI.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/configure.ac b/configure.ac
index 16f6a21..555ad1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -964,7 +964,9 @@ AC_CACHE_CHECK([whether the GCC style packed attribute is supported],
        [gcry_cv_gcc_attribute_packed],
        [gcry_cv_gcc_attribute_packed=no
         AC_COMPILE_IFELSE([AC_LANG_SOURCE(
-          [[struct foo_s { char a; long b; } __attribute__ ((packed));
+          [[struct foolong_s { long b; } __attribute__ ((packed));
+            struct foo_s { char a; struct foolong_s b; }
+              __attribute__ ((packed));
             enum bar {
               FOO = 1 / (sizeof(struct foo_s) == (sizeof(char) + sizeof(long))),
             };]])],

commit c2dba93e639639bdac139b3a3a456d10ddc61f79
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Fri May 1 18:50:34 2015 +0300

    Fix tail handling in buf_xor_1
    
    * cipher/bufhelp.h (buf_xor_1): Increment source pointer at tail
    handling.
    --
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/bufhelp.h b/cipher/bufhelp.h
index fb87939..c1aa52e 100644
--- a/cipher/bufhelp.h
+++ b/cipher/bufhelp.h
@@ -162,7 +162,7 @@ do_bytes:
 #endif
   /* Handle tail.  */
   for (; len; len--)
-    *dst++ ^= *src;
+    *dst++ ^= *src++;
 }
 
 

commit 839a3bbe2bb045139223b32753d656cc6c3d4669
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Fri May 1 15:03:38 2015 +0300

    Add --disable-hwf for basic tests
    
    * tests/basic.c (main): Add handling for '--disable-hwf'.
    --
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/tests/basic.c b/tests/basic.c
index 8400f9e..2cf8dd0 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -8028,6 +8028,21 @@ main (int argc, char **argv)
               argc--; argv++;
             }
         }
+      else if (!strcmp (*argv, "--disable-hwf"))
+        {
+          argc--;
+          argv++;
+          if (argc)
+            {
+              if (gcry_control (GCRYCTL_DISABLE_HWF, *argv, NULL))
+                fprintf (stderr,
+                        PGM
+                        ": unknown hardware feature `%s' - option ignored\n",
+                        *argv);
+              argc--;
+              argv++;
+            }
+        }
     }
 
   gcry_control (GCRYCTL_SET_VERBOSITY, (int)verbose);

commit 9f086ffa43f2507b9d17522a0a2e394cb273baf8
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Fri May 1 14:55:58 2015 +0300

    Use more odd chuck sizes for check_one_md
    
    * tests/basic.c (check_one_md): Make chuck size vary oddly, instead
    of using fixed length of 1000 bytes.
    --
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/tests/basic.c b/tests/basic.c
index f3105de..8400f9e 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -5231,11 +5231,29 @@ check_one_md (int algo, const char *data, int len, const char *expect)
   if (*data == '!' && !data[1])
     {				/* hash one million times a "a" */
       char aaa[1000];
+      size_t left = 1000 * 1000;
+      size_t startlen = 1;
+      size_t piecelen = startlen;
 
-      /* Write in odd size chunks so that we test the buffering.  */
       memset (aaa, 'a', 1000);
-      for (i = 0; i < 1000; i++)
-        gcry_md_write (hd, aaa, 1000);
+
+      /* Write in odd size chunks so that we test the buffering.  */
+      while (left > 0)
+        {
+          if (piecelen > sizeof(aaa))
+            piecelen = sizeof(aaa);
+          if (piecelen > left)
+            piecelen = left;
+
+          gcry_md_write (hd, aaa, piecelen);
+
+          left -= piecelen;
+
+          if (piecelen == sizeof(aaa))
+            piecelen = ++startlen;
+          else
+            piecelen = piecelen * 2 - ((piecelen != startlen) ? startlen : 0);
+        }
     }
   else
     gcry_md_write (hd, data, len);

commit e40eff94f9f8654c3d29e03bbb7e5ee6a43c1435
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Fri May 1 14:33:29 2015 +0300

    Enable more modes in basic ciphers test
    
    * src/gcrypt.h.in (GCRY_OCB_BLOCK_LEN): New.
    * tests/basic.c (check_one_cipher_core_reset): New.
    (check_one_cipher_core): Use check_one_cipher_core_reset inplace of
    gcry_cipher_reset.
    (check_ciphers): Add CCM and OCB modes for block cipher tests.
    --
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in
index cac2b49..0984d11 100644
--- a/src/gcrypt.h.in
+++ b/src/gcrypt.h.in
@@ -931,6 +931,9 @@ enum gcry_cipher_flags
 /* CCM works only with blocks of 128 bits.  */
 #define GCRY_CCM_BLOCK_LEN  (128 / 8)
 
+/* OCB works only with blocks of 128 bits.  */
+#define GCRY_OCB_BLOCK_LEN  (128 / 8)
+
 /* Create a handle for algorithm ALGO to be used in MODE.  FLAGS may
    be given as an bitwise OR of the gcry_cipher_flags values. */
 gcry_error_t gcry_cipher_open (gcry_cipher_hd_t *handle,
diff --git a/tests/basic.c b/tests/basic.c
index 07fd4d0..f3105de 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -4676,7 +4676,8 @@ check_bulk_cipher_modes (void)
 }
 
 
-static unsigned int get_algo_mode_blklen(int algo, int mode)
+static unsigned int
+get_algo_mode_blklen (int algo, int mode)
 {
   unsigned int blklen = gcry_cipher_get_algo_blklen(algo);
 
@@ -4696,6 +4697,48 @@ static unsigned int get_algo_mode_blklen(int algo, int mode)
 }
 
 
+static int
+check_one_cipher_core_reset (gcry_cipher_hd_t hd, int algo, int mode, int pass,
+                             int nplain)
+{
+  static const unsigned char iv[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+  u64 ctl_params[3];
+  int err;
+
+  gcry_cipher_reset (hd);
+
+  if (mode == GCRY_CIPHER_MODE_OCB || mode == GCRY_CIPHER_MODE_CCM)
+    {
+      err = gcry_cipher_setiv (hd, iv, sizeof(iv));
+      if (err)
+        {
+          fail ("pass %d, algo %d, mode %d, gcry_cipher_setiv failed: %s\n",
+                pass, algo, mode, gpg_strerror (err));
+          gcry_cipher_close (hd);
+          return -1;
+        }
+    }
+
+  if (mode == GCRY_CIPHER_MODE_CCM)
+    {
+      ctl_params[0] = nplain; /* encryptedlen */
+      ctl_params[1] = 0; /* aadlen */
+      ctl_params[2] = 16; /* authtaglen */
+      err = gcry_cipher_ctl (hd, GCRYCTL_SET_CCM_LENGTHS, ctl_params,
+                            sizeof(ctl_params));
+      if (err)
+        {
+          fail ("pass %d, algo %d, mode %d, gcry_cipher_ctl "
+                "GCRYCTL_SET_CCM_LENGTHS failed: %s\n",
+                pass, algo, mode, gpg_strerror (err));
+          gcry_cipher_close (hd);
+          return -1;
+        }
+    }
+
+  return 0;
+}
+
 /* The core of the cipher check.  In addition to the parameters passed
    to check_one_cipher it also receives the KEY and the plain data.
    PASS is printed with error messages.  The function returns 0 on
@@ -4782,6 +4825,9 @@ check_one_cipher_core (int algo, int mode, int flags,
       return -1;
     }
 
+  if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
+    return -1;
+
   err = gcry_cipher_encrypt (hd, out, nplain, plain, nplain);
   if (err)
     {
@@ -4793,7 +4839,8 @@ check_one_cipher_core (int algo, int mode, int flags,
 
   memcpy (enc_result, out, nplain);
 
-  gcry_cipher_reset (hd);
+  if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
+    return -1;
 
   err = gcry_cipher_decrypt (hd, in, nplain, out, nplain);
   if (err)
@@ -4809,7 +4856,8 @@ check_one_cipher_core (int algo, int mode, int flags,
           pass, algo, mode);
 
   /* Again, using in-place encryption.  */
-  gcry_cipher_reset (hd);
+  if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
+    return -1;
 
   memcpy (out, plain, nplain);
   err = gcry_cipher_encrypt (hd, out, nplain, NULL, 0);
@@ -4826,7 +4874,8 @@ check_one_cipher_core (int algo, int mode, int flags,
     fail ("pass %d, algo %d, mode %d, in-place, encrypt mismatch\n",
           pass, algo, mode);
 
-  gcry_cipher_reset (hd);
+  if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
+    return -1;
 
   err = gcry_cipher_decrypt (hd, out, nplain, NULL, 0);
   if (err)
@@ -4843,7 +4892,8 @@ check_one_cipher_core (int algo, int mode, int flags,
           pass, algo, mode);
 
   /* Again, splitting encryption in multiple operations. */
-  gcry_cipher_reset (hd);
+  if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
+    return -1;
 
   piecelen = blklen;
   pos = 0;
@@ -4871,7 +4921,8 @@ check_one_cipher_core (int algo, int mode, int flags,
     fail ("pass %d, algo %d, mode %d, split-buffer, encrypt mismatch\n",
           pass, algo, mode);
 
-  gcry_cipher_reset (hd);
+  if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
+    return -1;
 
   piecelen = blklen;
   pos = 0;
@@ -4900,7 +4951,8 @@ check_one_cipher_core (int algo, int mode, int flags,
 
   /* Again, using in-place encryption and splitting encryption in multiple
    * operations. */
-  gcry_cipher_reset (hd);
+  if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
+    return -1;
 
   piecelen = blklen;
   pos = 0;
@@ -4928,7 +4980,8 @@ check_one_cipher_core (int algo, int mode, int flags,
     fail ("pass %d, algo %d, mode %d, in-place split-buffer, encrypt mismatch\n",
           pass, algo, mode);
 
-  gcry_cipher_reset (hd);
+  if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
+    return -1;
 
   piecelen = blklen;
   pos = 0;
@@ -5096,8 +5149,12 @@ check_ciphers (void)
       check_one_cipher (algos[i], GCRY_CIPHER_MODE_CBC, 0);
       check_one_cipher (algos[i], GCRY_CIPHER_MODE_CBC, GCRY_CIPHER_CBC_CTS);
       check_one_cipher (algos[i], GCRY_CIPHER_MODE_CTR, 0);
+      if (gcry_cipher_get_algo_blklen (algos[i]) == GCRY_CCM_BLOCK_LEN)
+        check_one_cipher (algos[i], GCRY_CIPHER_MODE_CCM, 0);
       if (gcry_cipher_get_algo_blklen (algos[i]) == GCRY_GCM_BLOCK_LEN)
         check_one_cipher (algos[i], GCRY_CIPHER_MODE_GCM, 0);
+      if (gcry_cipher_get_algo_blklen (algos[i]) == GCRY_OCB_BLOCK_LEN)
+        check_one_cipher (algos[i], GCRY_CIPHER_MODE_OCB, 0);
     }
 
   for (i = 0; algos2[i]; i++)

commit 88842cbc68beb4f73c87fdbcb74182cba818f789
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Fri May 1 14:32:36 2015 +0300

    Fix reseting cipher in OCB mode
    
    * cipher/cipher.c (cipher_reset): Setup default taglen for OCB after
    clearing state.
    --
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/cipher.c b/cipher/cipher.c
index 6e1173f..d1550c0 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -744,6 +744,8 @@ cipher_reset (gcry_cipher_hd_t c)
 
     case GCRY_CIPHER_MODE_OCB:
       memset (&c->u_mode.ocb, 0, sizeof c->u_mode.ocb);
+      /* Setup default taglen.  */
+      c->u_mode.ocb.taglen = 16;
       break;
 
     default:

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

Summary of changes:
 cipher/bufhelp.h |   2 +-
 cipher/cipher.c  |   2 +
 configure.ac     |   4 +-
 src/gcrypt.h.in  |   3 ++
 tests/basic.c    | 112 +++++++++++++++++++++++++++++++++++++++++++++++++------
 5 files changed, 110 insertions(+), 13 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