diff options
| author | Werner Koch <[email protected]> | 2004-10-20 09:39:56 +0000 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2004-10-20 09:39:56 +0000 |
| commit | 27d06166d3972b15749d8233459bde88764dae35 (patch) | |
| tree | 504b346e56d7d3a7fc156e8432b1aafd7c1fa820 /g10/iso7816.c | |
| parent | * gpg.sgml: Minor language tweaks. (diff) | |
| download | gnupg-27d06166d3972b15749d8233459bde88764dae35.tar.gz gnupg-27d06166d3972b15749d8233459bde88764dae35.zip | |
* apdu.c (apdu_open_reader): Load pcsc_get_status_change fucntion.
(pcsc_get_status): Implemented.
(reset_pcsc_reader): Implemented.
(open_pcsc_reader): Succeed even with no card inserted.
(open_ccid_reader): Set LAST_STATUS.
* iso7816.c (iso7816_select_application): Always use 0 for P1.
Diffstat (limited to 'g10/iso7816.c')
| -rw-r--r-- | g10/iso7816.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/g10/iso7816.c b/g10/iso7816.c index cbb314eb2..9eff9d3f7 100644 --- a/g10/iso7816.c +++ b/g10/iso7816.c @@ -16,6 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * + * $Id$ */ #include <config.h> @@ -103,6 +105,17 @@ map_sw (int sw) return gpg_error (ec); } +/* Map a status word from the APDU layer to a gpg-error code. */ +gpg_error_t +iso7816_map_sw (int sw) +{ + /* All APDU functions should return 0x9000 on success but for + historical reasons of the implementation some return 0 to + indicate success. We allow for that here. */ + return sw? map_sw (sw) : 0; +} + + /* This function is specialized version of the SELECT FILE command. SLOT is the card and reader as created for example by apdu_open_reader (), AID is a buffer of size AIDLEN holding the @@ -113,15 +126,8 @@ map_sw (int sw) gpg_error_t iso7816_select_application (int slot, const char *aid, size_t aidlen) { - static char const openpgp_aid[] = { 0xD2, 0x76, 0x00, 0x01, 0x24, 0x01 }; int sw; - int p1 = 0x0C; /* No FCI to be returned. */ - - if (aidlen == sizeof openpgp_aid - && !memcmp (aid, openpgp_aid, sizeof openpgp_aid)) - p1 = 0; /* The current openpgp cards don't allow 0x0c. */ - - sw = apdu_send_simple (slot, 0x00, CMD_SELECT_FILE, 4, p1, aidlen, aid); + sw = apdu_send_simple (slot, 0x00, CMD_SELECT_FILE, 4, 0, aidlen, aid); return map_sw (sw); } |
