From c2235d994dbb1d7ddba20f89a7c02f4a27b0610c Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 26 Feb 2019 16:42:50 +0100 Subject: scd: Simplify the app_readkey parameters. * scd/app-help.c (app_help_pubkey_from_cert): New. * scd/command.c (cmd_readkey): Refactor to use that new function and handle the --advanced flag only here. * scd/app.c (app_readkey): Remove parm advanced. * scd/app-common.h (struct app_ctx_s): Remove parm advanced from the readkey member. * scd/app-nks.c (do_readkey): Adjust for removed parm. * scd/app-piv.c (do_readkey): Ditto. * scd/app-openpgp.c (do_readkey): Ditto. Signed-off-by: Werner Koch --- scd/app-piv.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'scd/app-piv.c') diff --git a/scd/app-piv.c b/scd/app-piv.c index 704a498c6..495e26a63 100644 --- a/scd/app-piv.c +++ b/scd/app-piv.c @@ -1418,14 +1418,14 @@ do_readcert (app_t app, const char *certid, * application has been performed. This is because we return a cached * result from key generation. If no cached result is available, the * error GPG_ERR_UNSUPPORTED_OPERATION is returned so that the higher - * layer can then to get the key by reading the matching certificate. + * layer can then get the key by reading the matching certificate. * On success a canonical encoded s-expression with the public key is * stored at (R_PK,R_PKLEN); the caller must release that buffer. On * error R_PK and R_PKLEN are not changed and an error code is * returned. */ static gpg_error_t -do_readkey (app_t app, int advanced, const char *keyrefstr, +do_readkey (app_t app, const char *keyrefstr, unsigned char **r_pk, size_t *r_pklen) { gpg_error_t err; @@ -1471,19 +1471,6 @@ do_readkey (app_t app, int advanced, const char *keyrefstr, err = make_canon_sexp (s_pkey, &pk, &pklen); if (err) goto leave; - if (advanced) - { - /* FIXME: How ugly - we should move that to command.c */ - char *p = canon_sexp_to_string (pk, pklen); - if (!p) - { - err = gpg_error_from_syserror (); - goto leave; - } - xfree (pk); - pk = p; - pklen = strlen (pk); - } *r_pk = pk; pk = NULL; -- cgit v1.2.3