summaryrefslogtreecommitdiff
path: root/scard.c
diff options
context:
space:
mode:
Diffstat (limited to 'scard.c')
-rw-r--r--scard.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/scard.c b/scard.c
index 951d868c8..9f22fdf39 100644
--- a/scard.c
+++ b/scard.c
@@ -24,7 +24,7 @@
24 24
25#ifdef SMARTCARD 25#ifdef SMARTCARD
26#include "includes.h" 26#include "includes.h"
27RCSID("$OpenBSD: scard.c,v 1.8 2001/07/30 16:06:07 jakob Exp $"); 27RCSID("$OpenBSD: scard.c,v 1.9 2001/07/31 08:41:10 jakob Exp $");
28 28
29#include <openssl/engine.h> 29#include <openssl/engine.h>
30#include <sectok.h> 30#include <sectok.h>
@@ -62,7 +62,7 @@ sc_open(void)
62 return SCARD_ERROR_FAIL; 62 return SCARD_ERROR_FAIL;
63 } 63 }
64 if (! sectok_cardpresent(sc_fd)) { 64 if (! sectok_cardpresent(sc_fd)) {
65 error("smartcard in reader %d not present, skipping", 65 debug("smartcard in reader %d not present, skipping",
66 sc_reader_num); 66 sc_reader_num);
67 return SCARD_ERROR_NOCARD; 67 return SCARD_ERROR_NOCARD;
68 } 68 }
@@ -328,13 +328,19 @@ Key *
328sc_get_key(int num) 328sc_get_key(int num)
329{ 329{
330 Key *k; 330 Key *k;
331 int status;
331 332
332 sc_reader_num = num; 333 sc_reader_num = num;
333 k = key_new(KEY_RSA); 334 k = key_new(KEY_RSA);
334 if (k == NULL) { 335 if (k == NULL) {
335 return NULL; 336 return NULL;
336 } 337 }
337 if (sc_read_pubkey(k) < 0) { 338 status = sc_read_pubkey(k);
339 if (status == SCARD_ERROR_NOCARD) {
340 key_free(k);
341 return NULL;
342 }
343 if (status < 0 ) {
338 error("sc_read_pubkey failed"); 344 error("sc_read_pubkey failed");
339 key_free(k); 345 key_free(k);
340 return NULL; 346 return NULL;