diff options
author | Werner Koch <wk@gnupg.org> | 2013-10-22 14:26:53 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2013-12-05 08:27:48 +0100 |
commit | 7bacf1812b55fa78db63abaa1f5a9220e9c6cccc (patch) | |
tree | 4141585ef24a83e22e411355585784f24b78f58f /cipher/elgamal.c | |
parent | 85bb0a98ea5add0296cbcc415d557eaa1f6bd294 (diff) | |
download | libgcrypt-7bacf1812b55fa78db63abaa1f5a9220e9c6cccc.tar.gz |
Remove macro hacks for internal vs. external functions. Part 1.
* src/visibility.h: Remove almost all define/undef hacks for symbol
visibility. Add macros to detect the use of the public functions.
Change all affected functions by prefixing them explicitly with an
underscore and change all internal callers to call the underscore
prefixed versions. Provide convenience macros from sexp and mpi
functions.
* src/visibility.c: Change all functions to use only gpg_err_code_t
and translate to gpg_error_t only in visibility.c.
--
The use of the macro magic made if hard to follow the function calls
in the source. It was not easy to see if an internal or external
function (as defined by visibility.c) was called. The change is quite
large but hopefully makes Libgcrypt easier to maintain. Some
function have not yet been fixed; this will be done soon.
Because Libgcrypt does no make use of any other libgpg-error using
libraries it is useless to always translate between gpg_error_t and
gpg_err_code_t (i.e with and w/o error source identifier). This
translation has no mostly be moved to the function wrappers in
visibility.c. An additional advantage of using gpg_err_code_t is that
comparison can be done without using gpg_err_code().
I am sorry for that large patch, but a series of patches would
actually be more work to audit.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'cipher/elgamal.c')
-rw-r--r-- | cipher/elgamal.c | 238 |
1 files changed, 118 insertions, 120 deletions
diff --git a/cipher/elgamal.c b/cipher/elgamal.c index 432ba6fd..beef8e4e 100644 --- a/cipher/elgamal.c +++ b/cipher/elgamal.c @@ -141,17 +141,17 @@ static int test_keys ( ELG_secret_key *sk, unsigned int nbits, int nodie ) { ELG_public_key pk; - gcry_mpi_t test = gcry_mpi_new ( 0 ); - gcry_mpi_t out1_a = gcry_mpi_new ( nbits ); - gcry_mpi_t out1_b = gcry_mpi_new ( nbits ); - gcry_mpi_t out2 = gcry_mpi_new ( nbits ); + gcry_mpi_t test = mpi_new ( 0 ); + gcry_mpi_t out1_a = mpi_new ( nbits ); + gcry_mpi_t out1_b = mpi_new ( nbits ); + gcry_mpi_t out2 = mpi_new ( nbits ); int failed = 0; pk.p = sk->p; pk.g = sk->g; pk.y = sk->y; - gcry_mpi_randomize ( test, nbits, GCRY_WEAK_RANDOM ); + _gcry_mpi_randomize ( test, nbits, GCRY_WEAK_RANDOM ); do_encrypt ( out1_a, out1_b, test, &pk ); decrypt ( out2, out1_a, out1_b, sk ); @@ -162,10 +162,10 @@ test_keys ( ELG_secret_key *sk, unsigned int nbits, int nodie ) if ( !verify( out1_a, out1_b, test, &pk ) ) failed |= 2; - gcry_mpi_release ( test ); - gcry_mpi_release ( out1_a ); - gcry_mpi_release ( out1_b ); - gcry_mpi_release ( out2 ); + _gcry_mpi_release ( test ); + _gcry_mpi_release ( out1_a ); + _gcry_mpi_release ( out1_b ); + _gcry_mpi_release ( out2 ); if (failed && !nodie) log_fatal ("Elgamal test key for %s %s failed\n", @@ -217,7 +217,7 @@ gen_k( gcry_mpi_t p, int small_k ) if( !rndbuf || nbits < 32 ) { gcry_free(rndbuf); - rndbuf = gcry_random_bytes_secure( nbytes, GCRY_STRONG_RANDOM ); + rndbuf = _gcry_random_bytes_secure( nbytes, GCRY_STRONG_RANDOM ); } else { @@ -226,7 +226,7 @@ gen_k( gcry_mpi_t p, int small_k ) to get_random_bytes() and use this the here maybe it is easier to do this directly in random.c Anyway, it is highly inlikely that we will ever reach this code. */ - char *pp = gcry_random_bytes_secure( 4, GCRY_STRONG_RANDOM ); + char *pp = _gcry_random_bytes_secure( 4, GCRY_STRONG_RANDOM ); memcpy( rndbuf, pp, 4 ); gcry_free(pp); } @@ -246,7 +246,7 @@ gen_k( gcry_mpi_t p, int small_k ) progress('-'); break; /* no */ } - if (gcry_mpi_gcd( temp, k, p_1 )) + if (mpi_gcd( temp, k, p_1 )) goto found; /* okay, k is relative prime to (p-1) */ mpi_add_ui( k, k, 1 ); if( DBG_CIPHER ) @@ -280,7 +280,7 @@ generate ( ELG_secret_key *sk, unsigned int nbits, gcry_mpi_t **ret_factors ) unsigned int xbits; byte *rndbuf; - p_min1 = gcry_mpi_new ( nbits ); + p_min1 = mpi_new ( nbits ); qbits = wiener_map( nbits ); if( qbits & 1 ) /* better have a even one */ qbits++; @@ -303,7 +303,7 @@ generate ( ELG_secret_key *sk, unsigned int nbits, gcry_mpi_t **ret_factors ) xbits = qbits * 3 / 2; if( xbits >= nbits ) BUG(); - x = gcry_mpi_snew ( xbits ); + x = mpi_snew ( xbits ); if( DBG_CIPHER ) log_debug("choosing a random x of size %u\n", xbits ); rndbuf = NULL; @@ -316,21 +316,20 @@ generate ( ELG_secret_key *sk, unsigned int nbits, gcry_mpi_t **ret_factors ) if( xbits < 16 ) /* should never happen ... */ { gcry_free(rndbuf); - rndbuf = gcry_random_bytes_secure( (xbits+7)/8, - GCRY_VERY_STRONG_RANDOM ); + rndbuf = _gcry_random_bytes_secure ((xbits+7)/8, + GCRY_VERY_STRONG_RANDOM); } else { - char *r = gcry_random_bytes_secure( 2, - GCRY_VERY_STRONG_RANDOM ); + char *r = _gcry_random_bytes_secure (2, GCRY_VERY_STRONG_RANDOM); memcpy(rndbuf, r, 2 ); gcry_free(r); } } else { - rndbuf = gcry_random_bytes_secure( (xbits+7)/8, - GCRY_VERY_STRONG_RANDOM ); + rndbuf = _gcry_random_bytes_secure ((xbits+7)/8, + GCRY_VERY_STRONG_RANDOM ); } _gcry_mpi_set_buffer( x, rndbuf, (xbits+7)/8, 0 ); mpi_clear_highbit( x, xbits+1 ); @@ -338,8 +337,8 @@ generate ( ELG_secret_key *sk, unsigned int nbits, gcry_mpi_t **ret_factors ) while( !( mpi_cmp_ui( x, 0 )>0 && mpi_cmp( x, p_min1 )<0 ) ); gcry_free(rndbuf); - y = gcry_mpi_new (nbits); - gcry_mpi_powm( y, g, x, p ); + y = mpi_new (nbits); + mpi_powm( y, g, x, p ); if( DBG_CIPHER ) { @@ -356,7 +355,7 @@ generate ( ELG_secret_key *sk, unsigned int nbits, gcry_mpi_t **ret_factors ) sk->y = y; sk->x = x; - gcry_mpi_release ( p_min1 ); + _gcry_mpi_release ( p_min1 ); /* Now we can test our keys (this should never fail!) */ test_keys ( sk, nbits - 64, 0 ); @@ -391,7 +390,7 @@ generate_using_x (ELG_secret_key *sk, unsigned int nbits, gcry_mpi_t x, if ( xbits < 64 || xbits >= nbits ) return GPG_ERR_INV_VALUE; - p_min1 = gcry_mpi_new ( nbits ); + p_min1 = mpi_new ( nbits ); qbits = wiener_map ( nbits ); if ( (qbits & 1) ) /* Better have an even one. */ qbits++; @@ -403,14 +402,14 @@ generate_using_x (ELG_secret_key *sk, unsigned int nbits, gcry_mpi_t x, log_debug ("using a supplied x of size %u", xbits ); if ( !(mpi_cmp_ui ( x, 0 ) > 0 && mpi_cmp ( x, p_min1 ) <0 ) ) { - gcry_mpi_release ( p_min1 ); - gcry_mpi_release ( p ); - gcry_mpi_release ( g ); + _gcry_mpi_release ( p_min1 ); + _gcry_mpi_release ( p ); + _gcry_mpi_release ( g ); return GPG_ERR_INV_VALUE; } - y = gcry_mpi_new (nbits); - gcry_mpi_powm ( y, g, x, p ); + y = mpi_new (nbits); + mpi_powm ( y, g, x, p ); if ( DBG_CIPHER ) { @@ -425,17 +424,17 @@ generate_using_x (ELG_secret_key *sk, unsigned int nbits, gcry_mpi_t x, sk->p = p; sk->g = g; sk->y = y; - sk->x = gcry_mpi_copy (x); + sk->x = mpi_copy (x); - gcry_mpi_release ( p_min1 ); + _gcry_mpi_release ( p_min1 ); /* Now we can test our keys. */ if ( test_keys ( sk, nbits - 64, 1 ) ) { - gcry_mpi_release ( sk->p ); sk->p = NULL; - gcry_mpi_release ( sk->g ); sk->g = NULL; - gcry_mpi_release ( sk->y ); sk->y = NULL; - gcry_mpi_release ( sk->x ); sk->x = NULL; + _gcry_mpi_release ( sk->p ); sk->p = NULL; + _gcry_mpi_release ( sk->g ); sk->g = NULL; + _gcry_mpi_release ( sk->y ); sk->y = NULL; + _gcry_mpi_release ( sk->x ); sk->x = NULL; return GPG_ERR_BAD_SECKEY; } @@ -453,7 +452,7 @@ check_secret_key( ELG_secret_key *sk ) int rc; gcry_mpi_t y = mpi_alloc( mpi_get_nlimbs(sk->y) ); - gcry_mpi_powm( y, sk->g, sk->x, sk->p ); + mpi_powm (y, sk->g, sk->x, sk->p); rc = !mpi_cmp( y, sk->y ); mpi_free( y ); return rc; @@ -471,14 +470,15 @@ do_encrypt(gcry_mpi_t a, gcry_mpi_t b, gcry_mpi_t input, ELG_public_key *pkey ) */ k = gen_k( pkey->p, 1 ); - gcry_mpi_powm( a, pkey->g, k, pkey->p ); + mpi_powm (a, pkey->g, k, pkey->p); + /* b = (y^k * input) mod p * = ((y^k mod p) * (input mod p)) mod p * and because input is < p * = ((y^k mod p) * input) mod p */ - gcry_mpi_powm( b, pkey->y, k, pkey->p ); - gcry_mpi_mulm( b, b, input, pkey->p ); + mpi_powm (b, pkey->y, k, pkey->p); + mpi_mulm (b, b, input, pkey->p); #if 0 if( DBG_CIPHER ) { @@ -502,7 +502,7 @@ decrypt(gcry_mpi_t output, gcry_mpi_t a, gcry_mpi_t b, ELG_secret_key *skey ) gcry_mpi_t t1 = mpi_alloc_secure( mpi_get_nlimbs( skey->p ) ); /* output = b/(a^x) mod p */ - gcry_mpi_powm( t1, a, skey->x, skey->p ); + mpi_powm( t1, a, skey->x, skey->p ); mpi_invm( t1, t1, skey->p ); mpi_mulm( output, b, t1, skey->p ); #if 0 @@ -539,7 +539,7 @@ sign(gcry_mpi_t a, gcry_mpi_t b, gcry_mpi_t input, ELG_secret_key *skey ) */ mpi_sub_ui(p_1, p_1, 1); k = gen_k( skey->p, 0 /* no small K ! */ ); - gcry_mpi_powm( a, skey->g, k, skey->p ); + mpi_powm( a, skey->g, k, skey->p ); mpi_mul(t, skey->x, a ); mpi_subm(t, input, t, p_1 ); mpi_invm(inv, k, p_1 ); @@ -643,11 +643,11 @@ elg_generate (const gcry_sexp_t genparms, gcry_sexp_t *r_skey) return rc; /* Parse the optional xvalue element. */ - l1 = gcry_sexp_find_token (genparms, "xvalue", 0); + l1 = sexp_find_token (genparms, "xvalue", 0); if (l1) { - xvalue = gcry_sexp_nth_mpi (l1, 1, 0); - gcry_sexp_release (l1); + xvalue = sexp_nth_mpi (l1, 1, 0); + sexp_release (l1); if (!xvalue) return GPG_ERR_BAD_MPI; } @@ -693,30 +693,30 @@ elg_generate (const gcry_sexp_t genparms, gcry_sexp_t *r_skey) arg_list[nfac] = factors + nfac; } p = stpcpy (p, "))"); - rc = gcry_sexp_build_array (&misc_info, NULL, buffer, arg_list); + rc = sexp_build_array (&misc_info, NULL, buffer, arg_list); gcry_free (arg_list); gcry_free (buffer); if (rc) goto leave; } - rc = gcry_sexp_build (r_skey, NULL, - "(key-data" - " (public-key" - " (elg(p%m)(g%m)(y%m)))" - " (private-key" - " (elg(p%m)(g%m)(y%m)(x%m)))" - " %S)", - sk.p, sk.g, sk.y, - sk.p, sk.g, sk.y, sk.x, - misc_info); + rc = sexp_build (r_skey, NULL, + "(key-data" + " (public-key" + " (elg(p%m)(g%m)(y%m)))" + " (private-key" + " (elg(p%m)(g%m)(y%m)(x%m)))" + " %S)", + sk.p, sk.g, sk.y, + sk.p, sk.g, sk.y, sk.x, + misc_info); leave: mpi_free (sk.p); mpi_free (sk.g); mpi_free (sk.y); mpi_free (sk.x); - gcry_sexp_release (misc_info); + sexp_release (misc_info); if (factors) { gcry_mpi_t *mp; @@ -735,9 +735,9 @@ elg_check_secret_key (gcry_sexp_t keyparms) gcry_err_code_t rc; ELG_secret_key sk = {NULL, NULL, NULL, NULL}; - rc = _gcry_sexp_extract_param (keyparms, NULL, "pgyx", - &sk.p, &sk.g, &sk.y, &sk.x, - NULL); + rc = sexp_extract_param (keyparms, NULL, "pgyx", + &sk.p, &sk.g, &sk.y, &sk.x, + NULL); if (rc) goto leave; @@ -745,10 +745,10 @@ elg_check_secret_key (gcry_sexp_t keyparms) rc = GPG_ERR_BAD_SECKEY; leave: - gcry_mpi_release (sk.p); - gcry_mpi_release (sk.g); - gcry_mpi_release (sk.y); - gcry_mpi_release (sk.x); + _gcry_mpi_release (sk.p); + _gcry_mpi_release (sk.g); + _gcry_mpi_release (sk.y); + _gcry_mpi_release (sk.x); if (DBG_CIPHER) log_debug ("elg_testkey => %s\n", gpg_strerror (rc)); return rc; @@ -781,8 +781,8 @@ elg_encrypt (gcry_sexp_t *r_ciph, gcry_sexp_t s_data, gcry_sexp_t keyparms) } /* Extract the key. */ - rc = _gcry_sexp_extract_param (keyparms, NULL, "pgy", - &pk.p, &pk.g, &pk.y, NULL); + rc = sexp_extract_param (keyparms, NULL, "pgy", + &pk.p, &pk.g, &pk.y, NULL); if (rc) goto leave; if (DBG_CIPHER) @@ -793,18 +793,18 @@ elg_encrypt (gcry_sexp_t *r_ciph, gcry_sexp_t s_data, gcry_sexp_t keyparms) } /* Do Elgamal computation and build result. */ - mpi_a = gcry_mpi_new (0); - mpi_b = gcry_mpi_new (0); + mpi_a = mpi_new (0); + mpi_b = mpi_new (0); do_encrypt (mpi_a, mpi_b, data, &pk); - rc = gcry_sexp_build (r_ciph, NULL, "(enc-val(elg(a%m)(b%m)))", mpi_a, mpi_b); + rc = sexp_build (r_ciph, NULL, "(enc-val(elg(a%m)(b%m)))", mpi_a, mpi_b); leave: - gcry_mpi_release (mpi_a); - gcry_mpi_release (mpi_b); - gcry_mpi_release (pk.p); - gcry_mpi_release (pk.g); - gcry_mpi_release (pk.y); - gcry_mpi_release (data); + _gcry_mpi_release (mpi_a); + _gcry_mpi_release (mpi_b); + _gcry_mpi_release (pk.p); + _gcry_mpi_release (pk.g); + _gcry_mpi_release (pk.y); + _gcry_mpi_release (data); _gcry_pk_util_free_encoding_ctx (&ctx); if (DBG_CIPHER) log_debug ("elg_encrypt => %s\n", gpg_strerror (rc)); @@ -832,7 +832,7 @@ elg_decrypt (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms) rc = _gcry_pk_util_preparse_encval (s_data, elg_names, &l1, &ctx); if (rc) goto leave; - rc = _gcry_sexp_extract_param (l1, NULL, "ab", &data_a, &data_b, NULL); + rc = sexp_extract_param (l1, NULL, "ab", &data_a, &data_b, NULL); if (rc) goto leave; if (DBG_CIPHER) @@ -847,9 +847,9 @@ elg_decrypt (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms) } /* Extract the key. */ - rc = _gcry_sexp_extract_param (keyparms, NULL, "pgyx", - &sk.p, &sk.g, &sk.y, &sk.x, - NULL); + rc = sexp_extract_param (keyparms, NULL, "pgyx", + &sk.p, &sk.g, &sk.y, &sk.x, + NULL); if (rc) goto leave; if (DBG_CIPHER) @@ -861,7 +861,7 @@ elg_decrypt (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms) log_printmpi ("elg_decrypt x", sk.x); } - plain = gcry_mpi_snew (ctx.nbits); + plain = mpi_snew (ctx.nbits); decrypt (plain, data_a, data_b, &sk); if (DBG_CIPHER) log_printmpi ("elg_decrypt res", plain); @@ -873,8 +873,7 @@ elg_decrypt (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms) rc = _gcry_rsa_pkcs1_decode_for_enc (&unpad, &unpadlen, ctx.nbits, plain); mpi_free (plain); plain = NULL; if (!rc) - rc = gcry_sexp_build (r_plain, NULL, "(value %b)", - (int)unpadlen, unpad); + rc = sexp_build (r_plain, NULL, "(value %b)", (int)unpadlen, unpad); break; case PUBKEY_ENC_OAEP: @@ -883,31 +882,30 @@ elg_decrypt (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms) ctx.label, ctx.labellen); mpi_free (plain); plain = NULL; if (!rc) - rc = gcry_sexp_build (r_plain, NULL, "(value %b)", - (int)unpadlen, unpad); + rc = sexp_build (r_plain, NULL, "(value %b)", (int)unpadlen, unpad); break; default: /* Raw format. For backward compatibility we need to assume a signed mpi by using the sexp format string "%m". */ - rc = gcry_sexp_build (r_plain, NULL, - (ctx.flags & PUBKEY_FLAG_LEGACYRESULT) - ? "%m" : "(value %m)", - plain); + rc = sexp_build (r_plain, NULL, + (ctx.flags & PUBKEY_FLAG_LEGACYRESULT) + ? "%m" : "(value %m)", + plain); break; } leave: gcry_free (unpad); - gcry_mpi_release (plain); - gcry_mpi_release (sk.p); - gcry_mpi_release (sk.g); - gcry_mpi_release (sk.y); - gcry_mpi_release (sk.x); - gcry_mpi_release (data_a); - gcry_mpi_release (data_b); - gcry_sexp_release (l1); + _gcry_mpi_release (plain); + _gcry_mpi_release (sk.p); + _gcry_mpi_release (sk.g); + _gcry_mpi_release (sk.y); + _gcry_mpi_release (sk.x); + _gcry_mpi_release (data_a); + _gcry_mpi_release (data_b); + sexp_release (l1); _gcry_pk_util_free_encoding_ctx (&ctx); if (DBG_CIPHER) log_debug ("elg_decrypt => %s\n", gpg_strerror (rc)); @@ -941,8 +939,8 @@ elg_sign (gcry_sexp_t *r_sig, gcry_sexp_t s_data, gcry_sexp_t keyparms) } /* Extract the key. */ - rc = _gcry_sexp_extract_param (keyparms, NULL, "pgyx", - &sk.p, &sk.g, &sk.y, &sk.x, NULL); + rc = sexp_extract_param (keyparms, NULL, "pgyx", + &sk.p, &sk.g, &sk.y, &sk.x, NULL); if (rc) goto leave; if (DBG_CIPHER) @@ -954,24 +952,24 @@ elg_sign (gcry_sexp_t *r_sig, gcry_sexp_t s_data, gcry_sexp_t keyparms) log_mpidump ("elg_sign x", sk.x); } - sig_r = gcry_mpi_new (0); - sig_s = gcry_mpi_new (0); + sig_r = mpi_new (0); + sig_s = mpi_new (0); sign (sig_r, sig_s, data, &sk); if (DBG_CIPHER) { log_mpidump ("elg_sign sig_r", sig_r); log_mpidump ("elg_sign sig_s", sig_s); } - rc = gcry_sexp_build (r_sig, NULL, "(sig-val(elg(r%M)(s%M)))", sig_r, sig_s); + rc = sexp_build (r_sig, NULL, "(sig-val(elg(r%M)(s%M)))", sig_r, sig_s); leave: - gcry_mpi_release (sig_r); - gcry_mpi_release (sig_s); - gcry_mpi_release (sk.p); - gcry_mpi_release (sk.g); - gcry_mpi_release (sk.y); - gcry_mpi_release (sk.x); - gcry_mpi_release (data); + _gcry_mpi_release (sig_r); + _gcry_mpi_release (sig_s); + _gcry_mpi_release (sk.p); + _gcry_mpi_release (sk.g); + _gcry_mpi_release (sk.y); + _gcry_mpi_release (sk.x); + _gcry_mpi_release (data); _gcry_pk_util_free_encoding_ctx (&ctx); if (DBG_CIPHER) log_debug ("elg_sign => %s\n", gpg_strerror (rc)); @@ -1009,7 +1007,7 @@ elg_verify (gcry_sexp_t s_sig, gcry_sexp_t s_data, gcry_sexp_t s_keyparms) rc = _gcry_pk_util_preparse_sigval (s_sig, elg_names, &l1, NULL); if (rc) goto leave; - rc = _gcry_sexp_extract_param (l1, NULL, "rs", &sig_r, &sig_s, NULL); + rc = sexp_extract_param (l1, NULL, "rs", &sig_r, &sig_s, NULL); if (rc) goto leave; if (DBG_CIPHER) @@ -1019,7 +1017,7 @@ elg_verify (gcry_sexp_t s_sig, gcry_sexp_t s_data, gcry_sexp_t s_keyparms) } /* Extract the key. */ - rc = _gcry_sexp_extract_param (s_keyparms, NULL, "pgy", + rc = sexp_extract_param (s_keyparms, NULL, "pgy", &pk.p, &pk.g, &pk.y, NULL); if (rc) goto leave; @@ -1035,13 +1033,13 @@ elg_verify (gcry_sexp_t s_sig, gcry_sexp_t s_data, gcry_sexp_t s_keyparms) rc = GPG_ERR_BAD_SIGNATURE; leave: - gcry_mpi_release (pk.p); - gcry_mpi_release (pk.g); - gcry_mpi_release (pk.y); - gcry_mpi_release (data); - gcry_mpi_release (sig_r); - gcry_mpi_release (sig_s); - gcry_sexp_release (l1); + _gcry_mpi_release (pk.p); + _gcry_mpi_release (pk.g); + _gcry_mpi_release (pk.y); + _gcry_mpi_release (data); + _gcry_mpi_release (sig_r); + _gcry_mpi_release (sig_s); + sexp_release (l1); _gcry_pk_util_free_encoding_ctx (&ctx); if (DBG_CIPHER) log_debug ("elg_verify => %s\n", rc?gpg_strerror (rc):"Good"); @@ -1067,14 +1065,14 @@ elg_get_nbits (gcry_sexp_t parms) gcry_mpi_t p; unsigned int nbits; - l1 = gcry_sexp_find_token (parms, "p", 1); + l1 = sexp_find_token (parms, "p", 1); if (!l1) return 0; /* Parameter P not found. */ - p= gcry_sexp_nth_mpi (l1, 1, GCRYMPI_FMT_USG); - gcry_sexp_release (l1); + p= sexp_nth_mpi (l1, 1, GCRYMPI_FMT_USG); + sexp_release (l1); nbits = p? mpi_get_nbits (p) : 0; - gcry_mpi_release (p); + _gcry_mpi_release (p); return nbits; } |