diff options
author | Werner Koch <[email protected]> | 2009-06-17 09:45:50 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2009-06-17 09:45:50 +0000 |
commit | 5f8acaccc0f1a1eede88af09c4377b9ad2871695 (patch) | |
tree | 57a1c533af681b8b55ce5bb6eed643813c8fd271 /scd/iso7816.c | |
parent | app-openpgp changes (diff) | |
download | gnupg-5f8acaccc0f1a1eede88af09c4377b9ad2871695.tar.gz gnupg-5f8acaccc0f1a1eede88af09c4377b9ad2871695.zip |
Add readcert command.
fix reading large certificates.
Diffstat (limited to 'scd/iso7816.c')
-rw-r--r-- | scd/iso7816.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/scd/iso7816.c b/scd/iso7816.c index 492e125de..3fea6c79e 100644 --- a/scd/iso7816.c +++ b/scd/iso7816.c @@ -420,19 +420,27 @@ iso7816_reset_retry_counter (int slot, int chvno, a newly allocated buffer at the address passed by RESULT. Return the length of this data at the address of RESULTLEN. */ gpg_error_t -iso7816_get_data (int slot, int tag, +iso7816_get_data (int slot, int extended_mode, int tag, unsigned char **result, size_t *resultlen) { int sw; + int le; if (!result || !resultlen) return gpg_error (GPG_ERR_INV_VALUE); *result = NULL; *resultlen = 0; - sw = apdu_send (slot, 0, 0x00, CMD_GET_DATA, - ((tag >> 8) & 0xff), (tag & 0xff), -1, NULL, - result, resultlen); + if (extended_mode > 0 && extended_mode < 256) + le = 65534; /* Not 65535 in case it is used as some special flag. */ + else if (extended_mode > 0) + le = extended_mode; + else + le = 256; + + sw = apdu_send_le (slot, extended_mode, 0x00, CMD_GET_DATA, + ((tag >> 8) & 0xff), (tag & 0xff), -1, NULL, le, + result, resultlen); if (sw != SW_SUCCESS) { /* Make sure that pending buffers are released. */ |