[pkg-opensc-commit] [opensc] 169/295: Improve pinpad use detection

Eric Dorland eric at moszumanska.debian.org
Sat Jun 24 21:11:28 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 ccc7e2f1094292b85a4392ee00139183194dfa5c
Author: Nuno Goncalves <nunojpg at gmail.com>
Date:   Wed Feb 1 11:19:44 2017 +0100

    Improve pinpad use detection
    
    Pinpad is used it it is present and if no pin string is provided (pinlen==0).
    
    Signed-off-by: Nuno Goncalves <nunojpg at gmail.com>
---
 src/libopensc/pkcs15-pin.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/libopensc/pkcs15-pin.c b/src/libopensc/pkcs15-pin.c
index ffbcf39..c4d5637 100644
--- a/src/libopensc/pkcs15-pin.c
+++ b/src/libopensc/pkcs15-pin.c
@@ -268,7 +268,7 @@ _validate_pin(struct sc_pkcs15_card *p15card, struct sc_pkcs15_auth_info *auth_i
 		return SC_ERROR_BUFFER_TOO_SMALL;
 
 	/* if we use pinpad, no more checks are needed */
-	if (p15card->card->reader->capabilities & SC_READER_CAP_PIN_PAD)
+	if (p15card->card->reader->capabilities & SC_READER_CAP_PIN_PAD && !pinlen)
 		return SC_SUCCESS;
 
 	/* If pin is given, make sure it is within limits */
@@ -371,9 +371,8 @@ _sc_pkcs15_verify_pin(struct sc_pkcs15_card *p15card, struct sc_pkcs15_object *p
 		data.pin_reference = skey_info->key_reference;
 	}
 
-	if(p15card->card->reader->capabilities & SC_READER_CAP_PIN_PAD) {
-		if (!pincode && !pinlen)
-			data.flags |= SC_PIN_CMD_USE_PINPAD;
+	if(p15card->card->reader->capabilities & SC_READER_CAP_PIN_PAD && !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";

-- 
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