From 4b668502eefd4dcf43a9da210f86721504ad74d5 Mon Sep 17 00:00:00 2001 From: Alessio Di Mauro Date: Thu, 17 Sep 2015 17:05:29 +0200 Subject: [PATCH] Minor fixes. --- ykcs11/openssl_utils.c | 8 ++++---- ykcs11/vendors.c | 1 - ykcs11/ykcs11.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ykcs11/openssl_utils.c b/ykcs11/openssl_utils.c index 7a11896..5d59599 100644 --- a/ykcs11/openssl_utils.c +++ b/ykcs11/openssl_utils.c @@ -220,9 +220,9 @@ create_empty_cert_cleanup: CK_RV do_check_cert(CK_BYTE_PTR in, CK_ULONG_PTR cert_len) { - X509 *cert; + X509 *cert; const unsigned char *p = in; // Mandatory temp variable required by OpenSSL - int len; + int len; len = 0; len += get_length(p + 1, &len) + 1; @@ -434,7 +434,7 @@ CK_RV do_pkcs_1_t1(CK_BYTE_PTR in, CK_ULONG in_len, CK_BYTE_PTR out, CK_ULONG_PT // TODO: rand must be seeded first (should be automatic) if (*out_len < key_len) - CKR_BUFFER_TOO_SMALL; + return CKR_BUFFER_TOO_SMALL; if (RSA_padding_add_PKCS1_type_1(buffer, key_len, in, in_len) == 0) return CKR_FUNCTION_FAILED; @@ -468,7 +468,7 @@ CK_RV do_pkcs_pss(RSA *key, CK_BYTE_PTR in, CK_ULONG in_len, int nid, // TODO: rand must be seeded first (should be automatic) if (*out_len < (CK_ULONG)RSA_size(key)) - CKR_BUFFER_TOO_SMALL; + return CKR_BUFFER_TOO_SMALL; DBG(("Apply PSS padding to %lu bytes and get %d\n", in_len, RSA_size(key))); diff --git a/ykcs11/vendors.c b/ykcs11/vendors.c index 25683f5..982208d 100644 --- a/ykcs11/vendors.c +++ b/ykcs11/vendors.c @@ -2,7 +2,6 @@ #include vendor_id_t get_vendor_id(char *vendor_name) { - vendor_id_t vid; if (strstr(vendor_name, "Yubico") != NULL) return YUBICO; diff --git a/ykcs11/ykcs11.c b/ykcs11/ykcs11.c index 1b11abd..9bed06a 100644 --- a/ykcs11/ykcs11.c +++ b/ykcs11/ykcs11.c @@ -66,7 +66,7 @@ CK_DEFINE_FUNCTION(CK_RV, C_Initialize)( } if (parse_readers(piv_state, readers, len, slots, &n_slots, &n_slots_with_token) != CK_TRUE) - CKR_FUNCTION_FAILED; + return CKR_FUNCTION_FAILED; DBG(("Found %lu slot(s) of which %lu tokenless/unsupported", n_slots, n_slots - n_slots_with_token));