summaryrefslogtreecommitdiff
path: root/cipher/dsa.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2013-09-07 10:06:46 +0200
committerWerner Koch <wk@gnupg.org>2013-09-20 18:30:05 +0200
commit3e5cfa20acfeccb9df2c3fae2730344b40b36104 (patch)
tree7b1eb9a1d34da43b39ac44ad45104f3cdbf31f24 /cipher/dsa.c
parent722bfc1e5f2268453db62f38cc46b5ec6ef3adee (diff)
downloadlibgcrypt-3e5cfa20acfeccb9df2c3fae2730344b40b36104.tar.gz
sexp: Change internal versions to always use gpg_err_code_t.
* src/sexp.c (gcry_sexp_new, gcry_sexp_create, gcry_sexp_build) (gcry_sexp_build_array, gcry_sexp_canon_len): Change error return type from gpg_error_t to gpg_err_code_t. Remove all calls to gpg_error. * src/visibility.c (gcry_sexp_new, gcry_sexp_create, gcry_sexp_sscan) (gcry_sexp_build, gcry_sexp_build_array, gcry_sexp_canon_len): Map error codes via gpg_error. * cipher/dsa.c, cipher/ecc.c, cipher/elgamal.c, cipher/rsa.c: Remove use gpg_err_code wrappers. -- We should do such a change for all other use of internal functions. It just does not make sense to use gpg_error in the internal interface because the error source is always Libgcrypt. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'cipher/dsa.c')
-rw-r--r--cipher/dsa.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/cipher/dsa.c b/cipher/dsa.c
index ceff947c..394800df 100644
--- a/cipher/dsa.c
+++ b/cipher/dsa.c
@@ -817,10 +817,9 @@ dsa_generate (int algo, unsigned int nbits, unsigned long evalue,
{
/* Format the seed-values unless domain parameters are used
for which a H_VALUE of NULL is an indication. */
- rc = gpg_err_code (gcry_sexp_build
- (&seedinfo, NULL,
- "(seed-values(counter %d)(seed %b)(h %m))",
- counter, (int)seedlen, seed, h_value));
+ rc = gcry_sexp_build (&seedinfo, NULL,
+ "(seed-values(counter %d)(seed %b)(h %m))",
+ counter, (int)seedlen, seed, h_value);
gcry_free (seed);
gcry_mpi_release (h_value);
}
@@ -876,8 +875,7 @@ dsa_generate (int algo, unsigned int nbits, unsigned long evalue,
arg_list[i++] = factors + j;
arg_list[i] = NULL;
- rc = gpg_err_code (gcry_sexp_build_array
- (&misc_info, NULL, format, arg_list));
+ rc = gcry_sexp_build_array (&misc_info, NULL, format, arg_list);
}
}
@@ -886,17 +884,16 @@ dsa_generate (int algo, unsigned int nbits, unsigned long evalue,
}
if (!rc)
- rc = gcry_err_code (gcry_sexp_build
- (r_skey, NULL,
- "(key-data"
- " (public-key"
- " (dsa(p%m)(q%m)(g%m)(y%m)))"
- " (private-key"
- " (dsa(p%m)(q%m)(g%m)(y%m)(x%m)))"
- " %S)",
- sk.p, sk.q, sk.g, sk.y,
- sk.p, sk.q, sk.g, sk.y, sk.x,
- misc_info));
+ rc = gcry_sexp_build (r_skey, NULL,
+ "(key-data"
+ " (public-key"
+ " (dsa(p%m)(q%m)(g%m)(y%m)))"
+ " (private-key"
+ " (dsa(p%m)(q%m)(g%m)(y%m)(x%m)))"
+ " %S)",
+ sk.p, sk.q, sk.g, sk.y,
+ sk.p, sk.q, sk.g, sk.y, sk.x,
+ misc_info);
gcry_mpi_release (sk.p);
@@ -976,9 +973,7 @@ dsa_sign (int algo, gcry_sexp_t *r_result, gcry_mpi_t data, gcry_mpi_t *skey,
s = mpi_alloc (mpi_get_nlimbs (sk.p));
rc = sign (r, s, data, &sk, flags, hashalgo);
if (!rc)
- rc = gcry_err_code (gcry_sexp_build (r_result, NULL,
- "(sig-val(dsa(r%M)(s%M)))",
- r, s));
+ rc = gcry_sexp_build (r_result, NULL, "(sig-val(dsa(r%M)(s%M)))", r, s);
mpi_free (r);
mpi_free (s);
}