From 3e5cfa20acfeccb9df2c3fae2730344b40b36104 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Sat, 7 Sep 2013 10:06:46 +0200 Subject: 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 --- cipher/dsa.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'cipher/dsa.c') 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); } -- cgit v1.2.1