diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2016-09-06 02:23:03 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2016-09-06 02:23:32 -0500 |
commit | 4114606c72147a3c2918bdca1a9cf5ef164bc06d (patch) | |
tree | b01fb190501b157568073f7df92d74e3cdd5f391 /src | |
parent | 995e057abc6ad9458d64b648178d6efae244d877 (diff) | |
download | smartcardauth-4114606c72147a3c2918bdca1a9cf5ef164bc06d.tar.gz smartcardauth-4114606c72147a3c2918bdca1a9cf5ef164bc06d.zip |
Gracefully handle lack of random data in early system startup
Speed up PC/SC launch
Diffstat (limited to 'src')
-rw-r--r-- | src/cardpincheck.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cardpincheck.c b/src/cardpincheck.c index e6c1cc4..f1e730f 100644 --- a/src/cardpincheck.c +++ b/src/cardpincheck.c @@ -192,13 +192,13 @@ int main(int argc, char* argv[]) { file_to_decrypt = argv[2]; } - fprintf(stderr, "Initializing pkcs11-helper\n"); + fprintf(stderr, "Initializing pkcs11-helper\n"); fflush(stderr); if ((rv = pkcs11h_initialize()) != CKR_OK) { fprintf(stderr, "pkcs11h_initialize failed: %s\n", pkcs11h_getMessage(rv)); return -1; } - fprintf(stderr, "Registering pkcs11-helper hooks\n"); + fprintf(stderr, "Registering pkcs11-helper hooks\n"); fflush(stderr); if ((rv = pkcs11h_setLogHook(pkcs_log_hook, NULL)) != CKR_OK) { fprintf(stderr, "pkcs11h_setLogHook failed: %s\n", pkcs11h_getMessage(rv)); return -1; @@ -223,7 +223,7 @@ int main(int argc, char* argv[]) { return -1; } - fprintf(stderr, "Adding provider '%s'\n", opensc_provider_library); + fprintf(stderr, "Adding provider '%s'\n", opensc_provider_library); fflush(stderr); if ((rv = pkcs11h_addProvider(opensc_provider_library, opensc_provider_library, FALSE, PKCS11H_PRIVATEMODE_MASK_AUTO, PKCS11H_SLOTEVENT_METHOD_AUTO, 0, FALSE)) != CKR_OK) { fprintf(stderr, "pkcs11h_addProvider failed: %s\n", pkcs11h_getMessage(rv)); return -1; @@ -284,7 +284,11 @@ int main(int argc, char* argv[]) { // Check PIN rv = pkcs11h_certificate_ensureKeyAccess(certificate); if (rv != CKR_OK) { - if (rv == CKR_CANCEL) { + if (rv == CKR_GENERAL_ERROR) { + ret = -4; + break; + } + else if (rv == CKR_CANCEL) { ret = -3; break; } |