'pinpad-enable' pkcs15-crypt: if it's a pinpad and you press enter when being asked for a PIN, you can enter the PIN on the reader

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2205 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
sth 2005-02-26 19:47:54 +00:00
parent 5a12e5f920
commit a1d4fe394e
1 changed files with 5 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/*
* pkcs15-crypt.c: Tool for cryptography operations with SmartCards
*
* Copyright (C) 2001 Juha Yrjölä <juha.yrjola@iki.fi>
* Copyright (C) 2001 Juha Yrj<EFBFBD><EFBFBD><juha.yrjola@iki.fi>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -428,11 +428,12 @@ static int get_key(unsigned int usage, sc_pkcs15_object_t **result)
return 0;
pincode = get_pin(pin);
if (pincode == NULL || *pincode == '\0')
return 5;
if (((pincode == NULL || *pincode == '\0')) &&
!(p15card->card->slot->capabilities & SC_SLOT_CAP_PIN_PAD))
return 5;
r = sc_pkcs15_verify_pin(p15card, (struct sc_pkcs15_pin_info *) pin->data,
(const u8 *) pincode, strlen(pincode));
(const u8 *) pincode, pincode == NULL ? 0 : strlen(pincode));
if (r) {
fprintf(stderr, "PIN code verification failed: %s\n", sc_strerror(r));
return 5;