- pin verification works now

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@624 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
okir 2002-06-04 19:42:17 +00:00
parent 7828d8242c
commit c6a5018a4f
1 changed files with 16 additions and 0 deletions

View File

@ -28,6 +28,9 @@
#include <string.h>
/* andreas says: hm, my card only works for small payloads */
/* comment by okir: one of the examples in the developer guide
* also talks about copying data in chunks of 128.
* Either coincidence, or a known problem. */
#define ETOKEN_MAX_PAYLOAD 120
static const struct sc_card_operations *iso_ops = NULL;
@ -510,6 +513,18 @@ static int etoken_read_binary(struct sc_card *card,
return total? total : n;
}
/*
* The 0x80 thing tells the card it's okay to search parent
* directories as well for the referenced object.
* Unfortunately, it doesn't seem to work without this flag :-/
*/
static int
etoken_verify(struct sc_card *card, unsigned int type, int ref,
const u8 *pin, size_t pin_len, int *tries_left)
{
return iso_ops->verify(card, type, ref|0x80, pin, pin_len, tries_left);
}
static int
etoken_put_data_fci(struct sc_card *card,
struct sc_cardctl_etoken_pin_info *args)
@ -564,6 +579,7 @@ const struct sc_card_driver * sc_get_driver(void)
etoken_ops.create_file = etoken_create_file;
etoken_ops.update_binary = etoken_update_binary;
etoken_ops.read_binary = etoken_read_binary;
etoken_ops.verify = etoken_verify;
etoken_ops.list_files = etoken_list_files;
etoken_ops.check_sw = etoken_check_sw;