[git] GCRYPT - branch, master, updated. libgcrypt-1.5.0-351-gd50a88d

by Jussi Kivilinna cvs at cvs.gnupg.org
Tue Nov 5 16:34:57 CET 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  d50a88d1e29124d038196fec6082fd093e922604 (commit)
      from  d4697862266f3c96b6946dc92139dd8f3e81e5f6 (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 d50a88d1e29124d038196fec6082fd093e922604
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date:   Sun Oct 13 12:42:32 2013 +0300

    Make test vectors 'static const'
    
    * cipher/arcfour.c (selftest): Change test vectors to 'static const'.
    * cipher/blowfish.c (selftest): Ditto.
    * cipher/camellia-glue.c (selftest): Ditto.
    * cipher/cast5.c (selftest): Ditto.
    * cipher/des.c (selftest): Ditto.
    * cipher/rijndael.c (selftest): Ditto.
    * tests/basic.c (cipher_cbc_mac_cipher, check_aes128_cbc_cts_cipher)
    (check_ctr_cipher, check_cfb_cipher, check_ofb_cipher)
    (check_ccm_cipher, check_stream_cipher)
    (check_stream_cipher_large_block, check_bulk_cipher_modes)
    (check_ciphers, check_digests, check_hmac, check_pubkey_sign)
    (check_pubkey_sign_ecdsa, check_pubkey_crypt, check_pubkey): Ditto.
    --
    
    Some test vectors have been defined without 'static' and thus end up being
    initialized on runtime. Change these to 'static'. Also change test vectors
    const where possible.
    
    Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>

diff --git a/cipher/arcfour.c b/cipher/arcfour.c
index e8a5484..89936f4 100644
--- a/cipher/arcfour.c
+++ b/cipher/arcfour.c
@@ -159,9 +159,9 @@ selftest(void)
 
   /* Test vector from Cryptlib labeled there: "from the
      State/Commerce Department". */
-  static byte key_1[] =
+  static const byte key_1[] =
     { 0x61, 0x8A, 0x63, 0xD2, 0xFB };
-  static byte plaintext_1[] =
+  static const byte plaintext_1[] =
     { 0xDC, 0xEE, 0x4C, 0xF9, 0x2C };
   static const byte ciphertext_1[] =
     { 0xF1, 0x38, 0x29, 0xC9, 0xDE };
diff --git a/cipher/blowfish.c b/cipher/blowfish.c
index 3b6bf6b..84fa9d3 100644
--- a/cipher/blowfish.c
+++ b/cipher/blowfish.c
@@ -822,9 +822,12 @@ selftest(void)
   BLOWFISH_context c;
   byte plain[] = "BLOWFISH";
   byte buffer[8];
-  byte plain3[] = { 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10 };
-  byte key3[] = { 0x41, 0x79, 0x6E, 0xA0, 0x52, 0x61, 0x6E, 0xE4 };
-  byte cipher3[] = { 0xE1, 0x13, 0xF4, 0x10, 0x2C, 0xFC, 0xCE, 0x43 };
+  static const byte plain3[] =
+    { 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10 };
+  static const byte key3[] =
+    { 0x41, 0x79, 0x6E, 0xA0, 0x52, 0x61, 0x6E, 0xE4 };
+  static const byte cipher3[] =
+    { 0xE1, 0x13, 0xF4, 0x10, 0x2C, 0xFC, 0xCE, 0x43 };
   const char *r;
 
   bf_setkey( (void *) &c,
diff --git a/cipher/camellia-glue.c b/cipher/camellia-glue.c
index 8c217a7..42b62d2 100644
--- a/cipher/camellia-glue.c
+++ b/cipher/camellia-glue.c
@@ -582,38 +582,38 @@ selftest(void)
   const char *r;
 
   /* These test vectors are from RFC-3713 */
-  const byte plaintext[]=
+  static const byte plaintext[]=
     {
       0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
       0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10
     };
-  const byte key_128[]=
+  static const byte key_128[]=
     {
       0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
       0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10
     };
-  const byte ciphertext_128[]=
+  static const byte ciphertext_128[]=
     {
       0x67,0x67,0x31,0x38,0x54,0x96,0x69,0x73,
       0x08,0x57,0x06,0x56,0x48,0xea,0xbe,0x43
     };
-  const byte key_192[]=
+  static const byte key_192[]=
     {
       0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xfe,0xdc,0xba,0x98,
       0x76,0x54,0x32,0x10,0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77
     };
-  const byte ciphertext_192[]=
+  static const byte ciphertext_192[]=
     {
       0xb4,0x99,0x34,0x01,0xb3,0xe9,0x96,0xf8,
       0x4e,0xe5,0xce,0xe7,0xd7,0x9b,0x09,0xb9
     };
-  const byte key_256[]=
+  static const byte key_256[]=
     {
       0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xfe,0xdc,0xba,
       0x98,0x76,0x54,0x32,0x10,0x00,0x11,0x22,0x33,0x44,0x55,
       0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff
     };
-  const byte ciphertext_256[]=
+  static const byte ciphertext_256[]=
     {
       0x9a,0xcc,0x23,0x7d,0xff,0x16,0xd7,0x6c,
       0x20,0xef,0x7c,0x91,0x9e,0x3a,0x75,0x09
diff --git a/cipher/cast5.c b/cipher/cast5.c
index 0df7886..8d14183 100644
--- a/cipher/cast5.c
+++ b/cipher/cast5.c
@@ -796,10 +796,13 @@ static const char*
 selftest(void)
 {
     CAST5_context c;
-    byte key[16]  = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
+    static const byte key[16] =
+                    { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
 		      0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9A  };
-    byte plain[8] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF };
-    byte cipher[8]= { 0x23, 0x8B, 0x4F, 0xE5, 0x84, 0x7E, 0x44, 0xB2 };
+    static const byte plain[8] =
+                    { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF };
+    static const byte cipher[8] =
+                    { 0x23, 0x8B, 0x4F, 0xE5, 0x84, 0x7E, 0x44, 0xB2 };
     byte buffer[8];
     const char *r;
 
diff --git a/cipher/des.c b/cipher/des.c
index 3464d53..6611fd3 100644
--- a/cipher/des.c
+++ b/cipher/des.c
@@ -893,7 +893,8 @@ selftest (void)
    * thanks to Jeroen C. van Gelderen.
    */
   {
-    struct { byte key[24]; byte plain[8]; byte cipher[8]; } testdata[] = {
+    static const struct { byte key[24]; byte plain[8]; byte cipher[8]; }
+      testdata[] = {
       { { 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
           0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
           0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01  },
diff --git a/cipher/rijndael.c b/cipher/rijndael.c
index e8733c9..b8cc18b 100644
--- a/cipher/rijndael.c
+++ b/cipher/rijndael.c
@@ -2308,7 +2308,7 @@ selftest (void)
 static const char *
 selftest_fips_128_38a (int requested_mode)
 {
-  struct tv
+  static const struct tv
   {
     int mode;
     const unsigned char key[16];
diff --git a/tests/basic.c b/tests/basic.c
index 21af21d..99d63ae 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -139,7 +139,7 @@ progress_handler (void *cb_data, const char *what, int printchar,
 static void
 check_cbc_mac_cipher (void)
 {
-  struct tv
+  static const struct tv
   {
     int algo;
     char key[MAX_DATA_LEN];
@@ -264,10 +264,10 @@ check_cbc_mac_cipher (void)
 static void
 check_aes128_cbc_cts_cipher (void)
 {
-  char key[128 / 8] = "chicken teriyaki";
-  unsigned char plaintext[] =
+  static const char key[128 / 8] = "chicken teriyaki";
+  static const unsigned char plaintext[] =
     "I would like the General Gau's Chicken, please, and wonton soup.";
-  struct tv
+  static const struct tv
   {
     unsigned char out[MAX_DATA_LEN];
     int inlen;
@@ -378,7 +378,7 @@ check_aes128_cbc_cts_cipher (void)
 static void
 check_ctr_cipher (void)
 {
-  struct tv
+  static const struct tv
   {
     int algo;
     char key[MAX_DATA_LEN];
@@ -734,7 +734,7 @@ check_ctr_cipher (void)
 static void
 check_cfb_cipher (void)
 {
-  struct tv
+  static const struct tv
   {
     int algo;
     char key[MAX_DATA_LEN];
@@ -905,7 +905,7 @@ check_cfb_cipher (void)
 static void
 check_ofb_cipher (void)
 {
-  struct tv
+  static const struct tv
   {
     int algo;
     char key[MAX_DATA_LEN];
@@ -1911,7 +1911,7 @@ check_ccm_cipher (void)
 static void
 check_stream_cipher (void)
 {
-  struct tv
+  static const struct tv
   {
     const char *name;
     int algo;
@@ -2252,7 +2252,7 @@ check_stream_cipher (void)
 static void
 check_stream_cipher_large_block (void)
 {
-  struct tv
+  static const struct tv
   {
     const char *name;
     int algo;
@@ -2690,7 +2690,7 @@ check_stream_cipher_large_block (void)
 static void
 check_bulk_cipher_modes (void)
 {
-  struct
+  static const struct
   {
     int algo;
     int mode;
@@ -3110,7 +3110,7 @@ check_one_cipher (int algo, int mode, int flags)
 static void
 check_ciphers (void)
 {
-  static int algos[] = {
+  static const int algos[] = {
 #if USE_BLOWFISH
     GCRY_CIPHER_BLOWFISH,
 #endif
@@ -3154,7 +3154,7 @@ check_ciphers (void)
 #endif
     0
   };
-  static int algos2[] = {
+  static const int algos2[] = {
 #if USE_ARCFOUR
     GCRY_CIPHER_ARCFOUR,
 #endif
@@ -3364,7 +3364,7 @@ check_one_md_multi (int algo, const char *data, int len, const char *expect)
 static void
 check_digests (void)
 {
-  static struct algos
+  static const struct algos
   {
     int md;
     const char *data;
@@ -3728,7 +3728,7 @@ check_one_hmac (int algo, const char *data, int datalen,
 static void
 check_hmac (void)
 {
-  static struct algos
+  static const struct algos
   {
     int md;
     const char *data;
@@ -4070,7 +4070,7 @@ check_pubkey_sign (int n, gcry_sexp_t skey, gcry_sexp_t pkey, int algo)
   static const char baddata[] =
     "(data\n (flags pkcs1)\n"
     " (hash sha1 #11223344556677889900AABBCCDDEEFF10203041#))\n";
-  static struct
+  static const struct
   {
     const char *data;
     int algo;
@@ -4173,7 +4173,7 @@ check_pubkey_sign_ecdsa (int n, gcry_sexp_t skey, gcry_sexp_t pkey)
   gcry_sexp_t sig, badhash, hash;
   unsigned int nbits;
   int dataidx;
-  static struct
+  static const struct
   {
     unsigned int nbits;
     const char *data;
@@ -4285,7 +4285,7 @@ check_pubkey_crypt (int n, gcry_sexp_t skey, gcry_sexp_t pkey, int algo)
   gcry_sexp_t ciph = NULL;
   gcry_sexp_t data = NULL;
   int dataidx;
-  static struct
+  static const struct
   {
     int algo;    /* If not 0 run test only if ALGO matches.  */
     const char *data;
@@ -4599,7 +4599,7 @@ check_one_pubkey_new (int n)
 static void
 check_pubkey (void)
 {
-  test_spec_pubkey_t pubkeys[] = {
+  static const test_spec_pubkey_t pubkeys[] = {
   {
     GCRY_PK_RSA, FLAG_CRYPT | FLAG_SIGN,
     {

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

Summary of changes:
 cipher/arcfour.c       |    4 ++--
 cipher/blowfish.c      |    9 ++++++---
 cipher/camellia-glue.c |   14 +++++++-------
 cipher/cast5.c         |    9 ++++++---
 cipher/des.c           |    3 ++-
 cipher/rijndael.c      |    2 +-
 tests/basic.c          |   36 ++++++++++++++++++------------------
 7 files changed, 42 insertions(+), 35 deletions(-)


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




More information about the Gnupg-commits mailing list