[pkg-opensc-commit] [engine-pkcs11] 31/43: Squashed compiler warnings

Eric Dorland eric at moszumanska.debian.org
Sun Jan 31 06:38:50 UTC 2016


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository engine-pkcs11.

commit ac3c6d79811874301a7784cadd576543b9babda4
Author: Michał Trojnara <Michal.Trojnara at stunnel.org>
Date:   Tue Jan 26 22:58:20 2016 +0100

    Squashed compiler warnings
---
 src/engine_pkcs11.c | 52 +++++++++++++++++++++++++++++++++++-----------------
 src/hw_pkcs11.c     | 21 +++------------------
 2 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c
index 8136c42..6c7cca6 100644
--- a/src/engine_pkcs11.c
+++ b/src/engine_pkcs11.c
@@ -160,6 +160,15 @@ int set_init_args(const char *init_args_orig)
 
 int pkcs11_finish(ENGINE * engine)
 {
+	/*
+	 * TODO: Retrieve the libp11 context with:
+	 *   ctx = ENGINE_get_ex_data(e, pkcs11_idx);
+	 * , free it, and set to NULL with:
+	 *   ENGINE_set_ex_data(e, pkcs11_idx, NULL);
+	 * instead of using a global context
+	 */
+	(void)engine;
+
 	if (ctx) {
 		PKCS11_CTX_unload(ctx);
 		PKCS11_CTX_free(ctx);
@@ -173,6 +182,13 @@ int pkcs11_init(ENGINE * engine)
 {
 	char *mod = module;
 
+	/*
+	 * TODO: Save the libp11 context with:
+	 *   ENGINE_set_ex_data(e, pkcs11_idx, ctx);
+	 * instead of using a global context
+	 */
+	(void)engine;
+
 #ifdef DEFAULT_PKCS11_MODULE
 	if (mod == NULL)
 		mod = DEFAULT_PKCS11_MODULE;
@@ -189,17 +205,6 @@ int pkcs11_init(ENGINE * engine)
 	return 1;
 }
 
-int pkcs11_rsa_finish(RSA * rsa)
-{
-	zero_pin();
-	if (module) {
-		free(module);
-		module = NULL;
-	}
-	/* need to free RSA_ex_data? */
-	return 1;
-}
-
 static int hex_to_bin(const char *in, unsigned char *out, size_t * outlen)
 {
 	size_t left, count = 0;
@@ -512,7 +517,7 @@ static int parse_pkcs11_uri(const char *uri, PKCS11_TOKEN **p_tok,
 /* prototype for OpenSSL ENGINE_load_cert */
 /* used by load_cert_ctrl via ENGINE_ctrl for now */
 
-static X509 *pkcs11_load_cert(ENGINE * e, const char *s_slot_cert_id)
+static X509 *pkcs11_load_cert(ENGINE * engine, const char *s_slot_cert_id)
 {
 	PKCS11_SLOT *slot_list, *slot;
 	PKCS11_SLOT *found_slot = NULL;
@@ -528,6 +533,13 @@ static X509 *pkcs11_load_cert(ENGINE * e, const char *s_slot_cert_id)
 	int slot_nr = -1;
 	char flags[64];
 
+	/*
+	 * TODO: Retrieve the libp11 context with:
+	 *   ctx = ENGINE_get_ex_data(e, pkcs11_idx);
+	 * instead of using a global context
+	 */
+	(void)engine;
+
 	if (s_slot_cert_id && *s_slot_cert_id) {
 		if (!strncmp(s_slot_cert_id, "pkcs11:", 7)) {
 			n = parse_pkcs11_uri(s_slot_cert_id, &match_tok,
@@ -602,7 +614,7 @@ static X509 *pkcs11_load_cert(ENGINE * e, const char *s_slot_cert_id)
 		}
 
 		if (slot_nr != -1 &&
-			slot_nr == PKCS11_get_slotid_from_slot(slot)) {
+			slot_nr == (int)PKCS11_get_slotid_from_slot(slot)) {
 			found_slot = slot;
 		}
 		if (match_tok && slot->token &&
@@ -791,9 +803,8 @@ static int pkcs11_login(PKCS11_SLOT *slot, PKCS11_TOKEN *tok,
 	return 1;
 }
 
-static EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id,
-		UI_METHOD * ui_method, void *callback_data,
-		int isPrivate)
+static EVP_PKEY *pkcs11_load_key(ENGINE * engine, const char *s_slot_key_id,
+		UI_METHOD * ui_method, void *callback_data, int isPrivate)
 {
 	PKCS11_SLOT *slot_list, *slot;
 	PKCS11_SLOT *found_slot = NULL;
@@ -810,6 +821,13 @@ static EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id,
 	size_t tmp_pin_len = sizeof(tmp_pin);
 	char flags[64];
 
+	/*
+	 * TODO: Retrieve the libp11 context with:
+	 *   ctx = ENGINE_get_ex_data(e, pkcs11_idx);
+	 * instead of using a global context
+	 */
+	(void)engine;
+
 	if (verbose)
 		fprintf(stderr, "Loading %s key \"%s\"\n",
 			(char *)(isPrivate ? "private" : "public"),
@@ -889,7 +907,7 @@ static EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id,
 		}
 
 		if (slot_nr != -1 &&
-			slot_nr == PKCS11_get_slotid_from_slot(slot)) {
+			slot_nr == (int)PKCS11_get_slotid_from_slot(slot)) {
 			found_slot = slot;
 		}
 		if (match_tok && slot->token &&
diff --git a/src/hw_pkcs11.c b/src/hw_pkcs11.c
index 9ffaa50..ed40e75 100644
--- a/src/hw_pkcs11.c
+++ b/src/hw_pkcs11.c
@@ -127,6 +127,7 @@ static const ENGINE_CMD_DEFN pkcs11_cmd_defns[] = {
 /* Destructor */
 static int pkcs11_engine_destroy(ENGINE * e)
 {
+	(void)e;
 #ifndef OPENSSL_NO_EC
 #ifndef OPENSSL_NO_ECDSA
 	PKCS11_ecdsa_method_free();
@@ -139,6 +140,8 @@ static int pkcs11_engine_destroy(ENGINE * e)
 static int pkcs11_engine_ctrl(ENGINE * e, int cmd, long i, void *p,
 		void (*f) ())
 {
+	(void)i; /* We don't currently take integer parameters */
+	(void)f; /* We don't currently take callback parameters */
 	/*int initialised = ((pkcs11_dso == NULL) ? 0 : 1); */
 	switch (cmd) {
 	case CMD_MODULE_PATH:
@@ -157,24 +160,6 @@ static int pkcs11_engine_ctrl(ENGINE * e, int cmd, long i, void *p,
 	return 0;
 }
 
-#if 0
-/* set up default rsa_meth_st with overloaded rsa functions */
-/* the actual implementation needs to be in another object */
-
-static int (*orig_finish) (RSA * rsa);
-
-static int pkcs11_engine_rsa_finish(RSA * rsa)
-{
-
-	pkcs11_rsa_finish(rsa);
-
-	if (orig_finish)
-		orig_finish(rsa);
-	return 1;
-
-}
-#endif
-
 /* This internal function is used by ENGINE_pkcs11() and possibly by the
  * "dynamic" ENGINE support too */
 static int bind_helper(ENGINE * e)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/engine-pkcs11.git



More information about the pkg-opensc-commit mailing list