[pkg-opensc-commit] [opensc] 63/295: libopensc: no cache for the zero length PIN
Eric Dorland
eric at moszumanska.debian.org
Sat Jun 24 21:11:16 UTC 2017
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository opensc.
commit 98568fe13e65b5304878bfeb4708657fe11869f5
Author: Viktor Tarasov <viktor.tarasov at gmail.com>
Date: Sat Aug 27 15:29:56 2016 +0200
libopensc: no cache for the zero length PIN
fixes problem with the revalidation of PIN with PINPAD
observed in #856
---
src/libopensc/pkcs15-pin.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/libopensc/pkcs15-pin.c b/src/libopensc/pkcs15-pin.c
index 61756c9..847d3c0 100644
--- a/src/libopensc/pkcs15-pin.c
+++ b/src/libopensc/pkcs15-pin.c
@@ -313,7 +313,7 @@ _sc_pkcs15_verify_pin(struct sc_pkcs15_card *p15card, struct sc_pkcs15_object *p
struct sc_pin_cmd_data data;
LOG_FUNC_CALLED(ctx);
- sc_log(ctx, "PIN(type:%X;method:%X;len:)", auth_info->auth_type, auth_info->auth_method, pinlen);
+ sc_log(ctx, "PIN(type:%X; method:%X; len:%i)", auth_info->auth_type, auth_info->auth_method, pinlen);
if (pinlen > SC_MAX_PIN_SIZE)
LOG_TEST_RET(ctx, SC_ERROR_INVALID_PIN_LENGTH, "Invalid PIN size");
@@ -368,6 +368,7 @@ _sc_pkcs15_verify_pin(struct sc_pkcs15_card *p15card, struct sc_pkcs15_object *p
if(p15card->card->reader->capabilities & SC_READER_CAP_PIN_PAD) {
if (!pincode && !pinlen)
data.flags |= SC_PIN_CMD_USE_PINPAD;
+
if (auth_info->attrs.pin.flags & SC_PKCS15_PIN_FLAG_SO_PIN)
data.pin1.prompt = "Please enter SO PIN";
else
@@ -653,7 +654,11 @@ void sc_pkcs15_pincache_add(struct sc_pkcs15_card *p15card, struct sc_pkcs15_obj
LOG_FUNC_CALLED(ctx);
- if (!p15card->opts.use_pin_cache) {
+ if (!pin || !pinlen) {
+ sc_log(ctx, "No cache for zero length PIN");
+ return;
+ }
+ else if (!p15card->opts.use_pin_cache) {
sc_log(ctx, "PIN caching not enabled");
return;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/opensc.git
More information about the pkg-opensc-commit
mailing list