diff --git a/scd/iso7816.c b/scd/iso7816.c index 627481fd4..6920a683e 100644 --- a/scd/iso7816.c +++ b/scd/iso7816.c @@ -722,8 +722,9 @@ iso7816_get_challenge (int slot, int length, unsigned char *buffer) stored in a newly allocated buffer at the address passed by RESULT. Returns the length of this data at the address of RESULTLEN. */ gpg_error_t -iso7816_read_binary (int slot, size_t offset, size_t nmax, - unsigned char **result, size_t *resultlen) +iso7816_read_binary_ext (int slot, int extended_mode, + size_t offset, size_t nmax, + unsigned char **result, size_t *resultlen) { int sw; unsigned char *buffer; @@ -746,13 +747,13 @@ iso7816_read_binary (int slot, size_t offset, size_t nmax, buffer = NULL; bufferlen = 0; n = read_all? 0 : nmax; - sw = apdu_send_le (slot, 0, 0x00, CMD_READ_BINARY, + sw = apdu_send_le (slot, extended_mode, 0x00, CMD_READ_BINARY, ((offset>>8) & 0xff), (offset & 0xff) , -1, NULL, n, &buffer, &bufferlen); if ( SW_EXACT_LENGTH_P(sw) ) { n = (sw & 0x00ff); - sw = apdu_send_le (slot, 0, 0x00, CMD_READ_BINARY, + sw = apdu_send_le (slot, extended_mode, 0x00, CMD_READ_BINARY, ((offset>>8) & 0xff), (offset & 0xff) , -1, NULL, n, &buffer, &bufferlen); } @@ -811,6 +812,15 @@ iso7816_read_binary (int slot, size_t offset, size_t nmax, return 0; } + +gpg_error_t +iso7816_read_binary (int slot, size_t offset, size_t nmax, + unsigned char **result, size_t *resultlen) +{ + return iso7816_read_binary_ext (slot, 0, offset, nmax, result, resultlen); +} + + /* Perform a READ RECORD command. RECNO gives the record number to read with 0 indicating the current record. RECCOUNT must be 1 (not all cards support reading of more than one record). SHORT_EF diff --git a/scd/iso7816.h b/scd/iso7816.h index 8da5a943a..b46c7601b 100644 --- a/scd/iso7816.h +++ b/scd/iso7816.h @@ -117,6 +117,9 @@ gpg_error_t iso7816_read_public_key (int slot, int extended_mode, gpg_error_t iso7816_get_challenge (int slot, int length, unsigned char *buffer); +gpg_error_t iso7816_read_binary_ext (int slot, int extended_mode, + size_t offset, size_t nmax, + unsigned char **result, size_t *resultlen); gpg_error_t iso7816_read_binary (int slot, size_t offset, size_t nmax, unsigned char **result, size_t *resultlen); gpg_error_t iso7816_read_record (int slot, int recno, int reccount,