From dcd64131c60efd0189aa05d5dbce6b93547b04e3 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 14 Dec 2011 17:00:50 +0100 Subject: [PATCH] scd: Add the "undefined" stub application. * scd/app.c (select_application): Implement the "undefined" application. --- doc/scdaemon.texi | 11 +++++++++++ scd/app.c | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/doc/scdaemon.texi b/doc/scdaemon.texi index 9184ce202..200fed890 100644 --- a/doc/scdaemon.texi +++ b/doc/scdaemon.texi @@ -181,6 +181,8 @@ write hashed data to files named @code{dbgmd-000*} trace Assuan protocol. See also option @option{--debug-assuan-log-cats}. @item 11 (2048) trace APDU I/O to the card. This may reveal sensitive data. +@item 12 (4096) +trace some card reader related function calls. @end table @item --debug-all @@ -327,6 +329,7 @@ stripping off the two leading dashes. * DINSIG Card:: The DINSIG card application * PKCS#15 Card:: The PKCS#15 card application * Geldkarte Card:: The Geldkarte application +* Undefined Card:: The Undefined stub application @end menu @node OpenPGP Card @@ -367,6 +370,14 @@ This is a simple application to display information of a German Geldkarte. The Geldkarte is a small amount debit card application which comes with almost all German banking cards. +@node Undefined Card +@subsection The Undefined card application ``undefined'' + +This is a stub application to allow the use of the APDU command even +if no supported application is found on the card. This application is +not used automatically but must be explicitly requested using the +SERIALNO command. + @c ******************************************* @c *************** **************** diff --git a/scd/app.c b/scd/app.c index 6f0d7560b..63ef4fa65 100644 --- a/scd/app.c +++ b/scd/app.c @@ -387,6 +387,14 @@ select_application (ctrl_t ctrl, int slot, const char *name, app_t *r_app) if (err && is_app_allowed ("geldkarte") && (!name || !strcmp (name, "geldkarte"))) err = app_select_geldkarte (app); + if (err && is_app_allowed ("undefined") + && (name && !strcmp (name, "undefined"))) + { + /* We switch to the "undefined" application only if explicitly + requested. */ + app->apptype = "UNDEFINED"; + err = 0; + } if (err && name) err = gpg_error (GPG_ERR_NOT_SUPPORTED); @@ -422,6 +430,8 @@ get_supported_applications (void) "p15", "dinsig", "geldkarte", + /* Note: "undefined" is not listed here because it needs special + treatment by the client. */ NULL }; int idx;