diff --git a/tkd/Makefile.am b/tkd/Makefile.am index 4f381f249..a86e13f04 100644 --- a/tkd/Makefile.am +++ b/tkd/Makefile.am @@ -35,8 +35,3 @@ tkdaemon_LDADD = $(libcommonpth) \ $(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(NPTH_LIBS) \ $(GPG_ERROR_LIBS) \ $(LIBINTL) $(DL_LIBS) $(NETLIBS) $(LIBICONV) - -pksign_LDADD = $(libcommonpth) \ - $(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(NPTH_LIBS) \ - $(GPG_ERROR_LIBS) \ - $(LIBINTL) $(DL_LIBS) $(NETLIBS) $(LIBICONV) diff --git a/tkd/command.c b/tkd/command.c index 682d71064..380cabd72 100644 --- a/tkd/command.c +++ b/tkd/command.c @@ -189,11 +189,12 @@ static gpg_error_t cmd_slotlist (assuan_context_t ctx, char *line) { ctrl_t ctrl = assuan_get_pointer (ctx); - gpg_error_t err = 0; + gpg_error_t err; line = skip_options (line); + (void)line; - (void)ctrl; + err = token_slotlist (ctrl); return err; } @@ -216,7 +217,6 @@ cmd_readkey (assuan_context_t ctx, char *line) int opt_nokey = 0; unsigned char *pk = NULL; size_t pklen; - token_t token; const char *keygrip; if (has_option (line, "--format=advanced")) @@ -232,15 +232,7 @@ cmd_readkey (assuan_context_t ctx, char *line) if (strlen (keygrip) != 40) err = gpg_error (GPG_ERR_INV_ID); - token = token_get (ctrl, keygrip); - if (token) - { - err = token_readkey (token, opt_info, &pk, &pklen); - token_put (token); - } - else - err = gpg_error (GPG_ERR_NO_SECKEY); - + err = token_readkey (ctrl, keygrip, opt_info, &pk, &pklen); if (err) goto leave; @@ -325,7 +317,6 @@ cmd_pksign (assuan_context_t ctx, char *line) gpg_error_t err; int hash_algo; const char *keygrip; - token_t token; unsigned char *outdata; size_t outdatalen; @@ -347,15 +338,7 @@ cmd_pksign (assuan_context_t ctx, char *line) if (strlen (keygrip) != 40) err = gpg_error (GPG_ERR_INV_ID); - token = token_get (ctrl, keygrip); - if (token) - { - err = token_sign (token, keygrip, hash_algo, &outdata, &outdatalen); - token_put (token); - } - else - err = gpg_error (GPG_ERR_NO_SECKEY); - + err = token_sign (ctrl, keygrip, hash_algo, &outdata, &outdatalen); if (err) { log_error ("token_sign failed: %s\n", gpg_strerror (err)); @@ -415,6 +398,7 @@ static const char hlp_keyinfo[] = static gpg_error_t cmd_keyinfo (assuan_context_t ctx, char *line) { + gpg_error_t err; int cap; int opt_data; const char *keygrip = NULL; @@ -434,9 +418,9 @@ cmd_keyinfo (assuan_context_t ctx, char *line) else keygrip = skip_options (line); - token_keyinfo (ctrl, keygrip, opt_data, cap); + err = token_keyinfo (ctrl, keygrip, opt_data, cap); - return 0; + return err; } diff --git a/tkd/tkdaemon.c b/tkd/tkdaemon.c index d16f512a0..ac8445e2b 100644 --- a/tkd/tkdaemon.c +++ b/tkd/tkdaemon.c @@ -41,8 +41,8 @@ #define INCLUDED_BY_MAIN_MODULE 1 #define GNUPG_COMMON_NEED_AFLOCAL #include "tkdaemon.h" -#include +#include #include /* malloc hooks */ #include "../common/i18n.h" diff --git a/tkd/tkdaemon.h b/tkd/tkdaemon.h index bfa99e484..73fa25896 100644 --- a/tkd/tkdaemon.h +++ b/tkd/tkdaemon.h @@ -107,4 +107,18 @@ void send_keyinfo (ctrl_t ctrl, int data, const char *keygrip_str, const char *serialno, const char *idstr, const char *usage); +/*-- pkcs11.c --*/ +gpg_error_t token_slotlist (ctrl_t ctrl); +gpg_error_t token_sign (ctrl_t ctrl, + const char *keygrip, int hash_algo, + unsigned char **r_outdata, + size_t *r_outdatalen); +gpg_error_t token_readkey (ctrl_t ctrl, + const char *keygrip, int opt_info, + unsigned char **r_pk, + size_t *r_pklen); +gpg_error_t token_keyinfo (ctrl_t ctrl, const char *keygrip, + int opt_data, int cap); + + #endif /*TKDAEMON_H*/