summaryrefslogtreecommitdiff
path: root/cipher
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2015-10-14 11:52:40 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2015-10-14 11:52:40 +0900
commit813565a07ca575c87e1252c6ed26018653ecd338 (patch)
tree6be01a85707031937e9967babfcde92b988d4918 /cipher
parentfa94b6111948a614ebdcb67f7942eced8b84c579 (diff)
downloadlibgcrypt-813565a07ca575c87e1252c6ed26018653ecd338.tar.gz
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 73374fdd and fix _gcry_sexp_extract_param return type, instead. Fix similar coding mistakes, throughout.
Diffstat (limited to 'cipher')
-rw-r--r--cipher/cipher.c8
-rw-r--r--cipher/dsa.c4
-rw-r--r--cipher/ecc-eddsa.c2
-rw-r--r--cipher/mac.c12
-rw-r--r--cipher/rsa-common.c2
5 files changed, 13 insertions, 15 deletions
diff --git a/cipher/cipher.c b/cipher/cipher.c
index 30c2f489..ab9f0dc5 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -590,7 +590,7 @@ _gcry_cipher_open_internal (gcry_cipher_hd_t *handle,
*handle = err ? NULL : h;
- return gcry_error (err);
+ return err;
}
@@ -1271,10 +1271,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. */
@@ -1317,7 +1317,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 723f6909..01d153fd 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 1e954896..2a52b78b 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 9bb360c6..b8a5534b 100644
--- a/cipher/mac.c
+++ b/cipher/mac.c
@@ -241,7 +241,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)
@@ -263,7 +263,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)
@@ -275,7 +275,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)
@@ -287,7 +287,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)
@@ -299,7 +299,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)
@@ -309,7 +309,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 f56e9896..b2601423 100644
--- a/cipher/rsa-common.c
+++ b/cipher/rsa-common.c
@@ -393,7 +393,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)