diff options
Diffstat (limited to 'scd')
-rw-r--r-- | scd/ChangeLog | 3 | ||||
-rw-r--r-- | scd/sc-investigate.c | 41 |
2 files changed, 43 insertions, 1 deletions
diff --git a/scd/ChangeLog b/scd/ChangeLog index 1dfafbd5a..f594fdd7f 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,5 +1,8 @@ 2004-07-01 Werner Koch <wk@gnupg.org> + * sc-investigate.c: Initialize Pth which is now required. + (interactive_shell): New command "readpk". + * app-openpgp.c (do_getattr): Fix for sending CA-FPR. 2004-06-30 Werner Koch <wk@gnupg.org> diff --git a/scd/sc-investigate.c b/scd/sc-investigate.c index 229def535..be985533c 100644 --- a/scd/sc-investigate.c +++ b/scd/sc-investigate.c @@ -26,6 +26,9 @@ #include <errno.h> #include <ctype.h> #include <unistd.h> +#ifdef USE_GNU_PTH +# include <pth.h> +#endif #ifdef HAVE_READLINE_READLINE_H #include <readline/readline.h> @@ -88,6 +91,12 @@ static ARGPARSE_OPTS opts[] = { }; +#ifdef USE_GNU_PTH +/* Pth wrapper function definitions. */ +GCRY_THREAD_OPTION_PTH_IMPL; +#endif /*USE_GNU_PTH*/ + + static void interactive_shell (int slot); static void dump_other_cards (int slot); @@ -151,7 +160,18 @@ main (int argc, char **argv ) /* Try to auto set the character set. */ set_native_charset (NULL); - /* check that the libraries are suitable. Do it here because + /* Libgcrypt requires us to register the threading model first. + Note that this will also do the pth_init. */ +#ifdef USE_GNU_PTH + rc = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth); + if (rc) + { + log_fatal ("can't register GNU Pth with Libgcrypt: %s\n", + gpg_strerror (rc)); + } +#endif /*USE_GNU_PTH*/ + + /* Check that the libraries are suitable. Do it here because the option parsing may need services of the library */ if (!gcry_check_version (NEED_LIBGCRYPT_VERSION) ) { @@ -411,6 +431,7 @@ interactive_shell (int slot) cmdDEBUG, cmdVERIFY, cmdCHANGEREF, + cmdREADPK, cmdINVCMD }; @@ -439,6 +460,7 @@ interactive_shell (int slot) { "verify" , cmdVERIFY, "verify CHVNO PIN" }, { "ver" , cmdVERIFY, NULL }, { "changeref", cmdCHANGEREF, "change reference data" }, + { "readpk", cmdREADPK, "read a public key" }, { NULL, cmdINVCMD } }; enum cmdids cmd = cmdNOP; @@ -655,6 +677,23 @@ interactive_shell (int slot) } break; + case cmdREADPK: + if (arg_number < 1 || arg_number > 255) + printf ("usage: readpk CRTBYTE1\n"); + else + { + unsigned char crt[2]; + + crt[0] = arg_number; + crt[1] = 0; + err = iso7816_read_public_key(slot, crt, 2, + &result, &resultlen); + if (!err) + dump_or_store_buffer (arg_string, result, resultlen); + } + break; + + case cmdINVCMD: default: printf ("\n"); |