diff options
author | Werner Koch <wk@gnupg.org> | 2013-10-11 22:37:41 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2013-10-11 22:37:58 +0200 |
commit | a951c061523e1c13f1358c9760fc3a9d787ab2d4 (patch) | |
tree | 5ea15233dbeffa041c129920c6ab5fa93b40b75e /cipher/pubkey-util.c | |
parent | 07950c865a901afc48acb46f0695040cadfd5068 (diff) | |
download | libgcrypt-a951c061523e1c13f1358c9760fc3a9d787ab2d4.tar.gz |
pubkey: Move sexp parsing of remaining fucntions to the modules.
* cipher/pubkey.c (release_mpi_array): Remove.
(pubkey_check_secret_key): Remove.
(sexp_elements_extract): Remove.
(sexp_elements_extract_ecc): Remove.
(sexp_to_key): Remove.
(get_hash_algo): Remove.
(gcry_pk_testkey): Revamp.
(gcry_pk_get_curve): Revamp.
* cipher/rsa.c (rsa_check_secret_key): Revamp.
* cipher/elgamal.c (elg_check_secret_key): Revamp.
* cipher/dsa.c (dsa_check_secret_key): Revamp.
* cipher/ecc.c (ecc_check_secret_key): Revamp.
* cipher/ecc-curves.c: Include cipher.h and pubkey-internal.h
(_gcry_ecc_get_curve): Revamp.
* cipher/pubkey-util.c (_gcry_pk_util_extract_mpis): Set passed and
used parameters on error to NULL.
--
That is the final part of the changes modulo introduced regressions.
pubkey.c is now actually maintainable code.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'cipher/pubkey-util.c')
-rw-r--r-- | cipher/pubkey-util.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cipher/pubkey-util.c b/cipher/pubkey-util.c index 9a94fe27..28388027 100644 --- a/cipher/pubkey-util.c +++ b/cipher/pubkey-util.c @@ -213,7 +213,7 @@ _gcry_pk_util_get_rsa_use_e (gcry_sexp_t list, unsigned long *r_e) * parameter "E" again as an unsigned MPI into MPI_E. * * The function returns NULL on success. On error an error code is - * returned and and the passed MPIs have no defined value. + * returned and the passed MPIs are either unchanged or set to NULL. */ gpg_err_code_t _gcry_pk_util_extract_mpis (gcry_sexp_t sexp, const char *list, ...) @@ -275,7 +275,10 @@ _gcry_pk_util_extract_mpis (gcry_sexp_t sexp, const char *list, ...) else if (!l1) { while (idx--) - gcry_mpi_release (*array[idx]); + { + gcry_mpi_release (*array[idx]); + *array[idx] = NULL; + } return GPG_ERR_NO_OBJ; /* List element not found. */ } else @@ -288,7 +291,10 @@ _gcry_pk_util_extract_mpis (gcry_sexp_t sexp, const char *list, ...) if (!*array[idx]) { while (idx--) - gcry_mpi_release (*array[idx]); + { + gcry_mpi_release (*array[idx]); + *array[idx] = NULL; + } return GPG_ERR_INV_OBJ; /* Conversion failed. */ } } |