[git] GCRYPT - branch, LIBGCRYPT-1-6-BRANCH, updated. libgcrypt-1.6.4-3-gd501cc4

by NIIBE Yutaka cvs at cvs.gnupg.org
Wed Oct 14 05:43:44 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, LIBGCRYPT-1-6-BRANCH has been updated
       via  d501cc4edd55d3953d7581b3f8ff0c348df31ef0 (commit)
      from  24f6c65e36edec13aa781862ff1ff45ca3e99b99 (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 d501cc4edd55d3953d7581b3f8ff0c348df31ef0
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Wed Oct 14 11:52:40 2015 +0900

    Fix gpg_error_t and gpg_err_code_t confusion.
    
    * src/gcrypt-int.h (_gcry_sexp_extract_param): Revert the change.
    * cipher/dsa.c (dsa_check_secret_key): Ditto.
    * src/sexp.c (_gcry_sexp_extract_param): Return gpg_err_code_t.
    
    * src/gcrypt-int.h (_gcry_err_make_from_errno)
    (_gcry_error_from_errno): Return gpg_error_t.
    * cipher/cipher.c (_gcry_cipher_open_internal)
    (_gcry_cipher_ctl, _gcry_cipher_ctl): Don't use gcry_error.
    * src/global.c (_gcry_vcontrol): Likewise.
    * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_genkey): Use
     gpg_err_code_from_syserror.
    * cipher/mac.c (mac_reset, mac_setkey, mac_setiv, mac_write)
    (mac_read, mac_verify): Return gcry_err_code_t.
    * cipher/rsa-common.c (mgf1): Use gcry_err_code_t for ERR.
    * src/visibility.c (gcry_error_from_errno): Return gpg_error_t.
    
    --
    
    Reverting a part of 24f6c65e and fix _gcry_sexp_extract_param
    return type, instead.
    
    Fix similar coding mistakes, throughout.
    
    (backported from master
         commit 813565a07ca575c87e1252c6ed26018653ecd338)

diff --git a/cipher/cipher.c b/cipher/cipher.c
index 8c5a0b4..1741a7b 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -542,7 +542,7 @@ _gcry_cipher_open_internal (gcry_cipher_hd_t *handle,
 
   *handle = err ? NULL : h;
 
-  return gcry_error (err);
+  return err;
 }
 
 
@@ -1153,10 +1153,10 @@ _gcry_cipher_ctl (gcry_cipher_hd_t h, int cmd, void *buffer, size_t buflen)
         size_t authtaglen;
 
         if (h->mode != GCRY_CIPHER_MODE_CCM)
-          return gcry_error (GPG_ERR_INV_CIPHER_MODE);
+          return GPG_ERR_INV_CIPHER_MODE;
 
         if (!buffer || buflen != 3 * sizeof(u64))
-          return gcry_error (GPG_ERR_INV_ARG);
+          return GPG_ERR_INV_ARG;
 
         /* This command is used to pass additional length parameters needed
            by CCM mode to initialize CBC-MAC.  */
@@ -1176,7 +1176,7 @@ _gcry_cipher_ctl (gcry_cipher_hd_t h, int cmd, void *buffer, size_t buflen)
       /* This command expects NULL for H and BUFFER to point to an
          integer with the algo number.  */
       if( h || !buffer || buflen != sizeof(int) )
-	return gcry_error (GPG_ERR_CIPHER_ALGO);
+	return GPG_ERR_CIPHER_ALGO;
       disable_cipher_algo( *(int*)buffer );
       break;
 
diff --git a/cipher/dsa.c b/cipher/dsa.c
index 723f690..01d153f 100644
--- a/cipher/dsa.c
+++ b/cipher/dsa.c
@@ -968,14 +968,12 @@ dsa_generate (const gcry_sexp_t genparms, gcry_sexp_t *r_skey)
 static gcry_err_code_t
 dsa_check_secret_key (gcry_sexp_t keyparms)
 {
-  gcry_error_t err;
   gcry_err_code_t rc;
   DSA_secret_key sk = {NULL, NULL, NULL, NULL, NULL};
 
-  err = _gcry_sexp_extract_param (keyparms, NULL, "pqgyx",
+  rc = _gcry_sexp_extract_param (keyparms, NULL, "pqgyx",
                                   &sk.p, &sk.q, &sk.g, &sk.y, &sk.x,
                                   NULL);
-  rc = gpg_err_code (err);
   if (rc)
     goto leave;
 
diff --git a/cipher/ecc-eddsa.c b/cipher/ecc-eddsa.c
index 62e6729..589ae17 100644
--- a/cipher/ecc-eddsa.c
+++ b/cipher/ecc-eddsa.c
@@ -508,7 +508,7 @@ _gcry_ecc_eddsa_genkey (ECC_secret_key *sk, elliptic_curve_t *E, mpi_ec_t ctx,
   hash_d = xtrymalloc_secure (2*b);
   if (!hash_d)
     {
-      rc = gpg_error_from_syserror ();
+      rc = gpg_err_code_from_syserror ();
       goto leave;
     }
   dlen = b;
diff --git a/cipher/mac.c b/cipher/mac.c
index d87ac13..85a32c1 100644
--- a/cipher/mac.c
+++ b/cipher/mac.c
@@ -229,7 +229,7 @@ mac_open (gcry_mac_hd_t * hd, int algo, int secure, gcry_ctx_t ctx)
 }
 
 
-static gcry_error_t
+static gcry_err_code_t
 mac_reset (gcry_mac_hd_t hd)
 {
   if (hd->spec->ops->reset)
@@ -251,7 +251,7 @@ mac_close (gcry_mac_hd_t hd)
 }
 
 
-static gcry_error_t
+static gcry_err_code_t
 mac_setkey (gcry_mac_hd_t hd, const void *key, size_t keylen)
 {
   if (!hd->spec->ops->setkey)
@@ -263,7 +263,7 @@ mac_setkey (gcry_mac_hd_t hd, const void *key, size_t keylen)
 }
 
 
-static gcry_error_t
+static gcry_err_code_t
 mac_setiv (gcry_mac_hd_t hd, const void *iv, size_t ivlen)
 {
   if (!hd->spec->ops->setiv)
@@ -275,7 +275,7 @@ mac_setiv (gcry_mac_hd_t hd, const void *iv, size_t ivlen)
 }
 
 
-static gcry_error_t
+static gcry_err_code_t
 mac_write (gcry_mac_hd_t hd, const void *inbuf, size_t inlen)
 {
   if (!hd->spec->ops->write)
@@ -287,7 +287,7 @@ mac_write (gcry_mac_hd_t hd, const void *inbuf, size_t inlen)
 }
 
 
-static gcry_error_t
+static gcry_err_code_t
 mac_read (gcry_mac_hd_t hd, void *outbuf, size_t * outlen)
 {
   if (!outbuf || !outlen || *outlen == 0 || !hd->spec->ops->read)
@@ -297,7 +297,7 @@ mac_read (gcry_mac_hd_t hd, void *outbuf, size_t * outlen)
 }
 
 
-static gcry_error_t
+static gcry_err_code_t
 mac_verify (gcry_mac_hd_t hd, const void *buf, size_t buflen)
 {
   if (!buf || buflen == 0 || !hd->spec->ops->verify)
diff --git a/cipher/rsa-common.c b/cipher/rsa-common.c
index 4f5a659..09774e5 100644
--- a/cipher/rsa-common.c
+++ b/cipher/rsa-common.c
@@ -328,7 +328,7 @@ mgf1 (unsigned char *output, size_t outlen, unsigned char *seed, size_t seedlen,
   size_t dlen, nbytes, n;
   int idx;
   gcry_md_hd_t hd;
-  gcry_error_t err;
+  gcry_err_code_t err;
 
   err = _gcry_md_open (&hd, algo, 0);
   if (err)
diff --git a/src/gcrypt-int.h b/src/gcrypt-int.h
index b6e5826..6cf3a70 100644
--- a/src/gcrypt-int.h
+++ b/src/gcrypt-int.h
@@ -276,7 +276,7 @@ _gcry_err_code_to_errno (gcry_err_code_t code)
 
 /* Return an error value with the error source SOURCE and the system
    error ERR.  */
-static inline gcry_err_code_t
+static inline gcry_error_t
 _gcry_err_make_from_errno (gpg_err_source_t source, int err)
 {
   return gpg_err_make_from_errno (source, err);
@@ -284,7 +284,7 @@ _gcry_err_make_from_errno (gpg_err_source_t source, int err)
 
 
 /* Return an error value with the system error ERR.  */
-static inline gcry_err_code_t
+static inline gcry_error_t
 _gcry_error_from_errno (int err)
 {
   return gpg_error (gpg_err_code_from_errno (err));
@@ -328,10 +328,10 @@ void *_gcry_sexp_nth_buffer (const gcry_sexp_t list, int number,
                              size_t *rlength);
 char *_gcry_sexp_nth_string (gcry_sexp_t list, int number);
 gcry_mpi_t _gcry_sexp_nth_mpi (gcry_sexp_t list, int number, int mpifmt);
-gpg_error_t _gcry_sexp_extract_param (gcry_sexp_t sexp,
-                                      const char *path,
-                                      const char *list,
-                                      ...) _GCRY_GCC_ATTR_SENTINEL(0);
+gpg_err_code_t _gcry_sexp_extract_param (gcry_sexp_t sexp,
+                                         const char *path,
+                                         const char *list,
+                                         ...) _GCRY_GCC_ATTR_SENTINEL(0);
 
 #define sexp_new(a, b, c, d)         _gcry_sexp_new ((a), (b), (c), (d))
 #define sexp_create(a, b, c, d, e)   _gcry_sexp_create ((a), (b), (c), (d), (e))
diff --git a/src/global.c b/src/global.c
index 6f9cbf9..f5c26ab 100644
--- a/src/global.c
+++ b/src/global.c
@@ -499,7 +499,7 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr)
       _gcry_set_preferred_rng_type (0);
       rc = _gcry_rndegd_set_socket_name (va_arg (arg_ptr, const char *));
 #else
-      rc = gpg_error (GPG_ERR_NOT_SUPPORTED);
+      rc = GPG_ERR_NOT_SUPPORTED;
 #endif
       break;
 
diff --git a/src/sexp.c b/src/sexp.c
index 1c014e0..f1bbffa 100644
--- a/src/sexp.c
+++ b/src/sexp.c
@@ -2423,7 +2423,7 @@ _gcry_sexp_vextract_param (gcry_sexp_t sexp, const char *path,
   return rc;
 }
 
-gpg_error_t
+gpg_err_code_t
 _gcry_sexp_extract_param (gcry_sexp_t sexp, const char *path,
                           const char *list, ...)
 {
@@ -2433,5 +2433,5 @@ _gcry_sexp_extract_param (gcry_sexp_t sexp, const char *path,
   va_start (arg_ptr, list);
   rc = _gcry_sexp_vextract_param (sexp, path, list, arg_ptr);
   va_end (arg_ptr);
-  return gpg_error (rc);
+  return rc;
 }
diff --git a/src/visibility.c b/src/visibility.c
index b71c839..ca57113 100644
--- a/src/visibility.c
+++ b/src/visibility.c
@@ -57,7 +57,7 @@ gcry_err_make_from_errno (gcry_err_source_t source, int err)
   return _gcry_err_make_from_errno (source, err);
 }
 
-gcry_err_code_t
+gcry_error_t
 gcry_error_from_errno (int err)
 {
   return _gcry_error_from_errno (err);

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

Summary of changes:
 cipher/cipher.c     |  8 ++++----
 cipher/dsa.c        |  4 +---
 cipher/ecc-eddsa.c  |  2 +-
 cipher/mac.c        | 12 ++++++------
 cipher/rsa-common.c |  2 +-
 src/gcrypt-int.h    | 12 ++++++------
 src/global.c        |  2 +-
 src/sexp.c          |  4 ++--
 src/visibility.c    |  2 +-
 9 files changed, 23 insertions(+), 25 deletions(-)


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




More information about the Gnupg-commits mailing list