[pkg-opensc-commit] [libp11] 140/239: Switch from using int for size arguments to size_t. This change breaks ABI on 64bit plattforms (we increased the library minor/major numbers in the last commit already). patch submitted by Stanislav Brabec.

Eric Dorland eric at moszumanska.debian.org
Sat Oct 17 06:21:18 UTC 2015


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

eric pushed a commit to branch master
in repository libp11.

commit 47b872bc4054a948906cf030846e00902b4ed4ce
Author: Andreas Jellinghaus <andreas at ionisiert.de>
Date:   Wed Aug 20 14:51:29 2008 +0000

    Switch from using int for size arguments to size_t.
    This change breaks ABI on 64bit plattforms (we increased
    the library minor/major numbers in the last commit already).
    patch submitted by Stanislav Brabec.
---
 src/libp11.h   | 12 ++++++------
 src/p11_cert.c |  4 ++--
 src/p11_key.c  | 16 ++++++++--------
 src/pkcs11.h   |  2 +-
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/libp11.h b/src/libp11.h
index 662fa4b..5a60e25 100644
--- a/src/libp11.h
+++ b/src/libp11.h
@@ -53,7 +53,7 @@ ERR_PUT_error(ERR_LIB_PKCS11,(f),(r),__FILE__,__LINE__)
 typedef struct PKCS11_key_st {
 	char *label;
 	unsigned char *id;
-	int id_len;
+	size_t id_len;
 	unsigned char isPrivate;	/**< private key present? */
 	unsigned char needLogin;	/**< login to read private key? */
 	EVP_PKEY *evp_key;		/**< initially NULL, need to call PKCS11_load_key */
@@ -64,7 +64,7 @@ typedef struct PKCS11_key_st {
 typedef struct PKCS11_cert_st {
 	char *label;
 	unsigned char *id;
-	int id_len;
+	size_t id_len;
 	X509 *x509;
 	void *_private;
 } PKCS11_CERT;
@@ -291,7 +291,7 @@ extern int PKCS11_change_pin(PKCS11_SLOT * slot, const char *old_pin,
  * @retval -1 error
  */
 
-extern int PKCS11_generate_key(PKCS11_TOKEN * token, int algorithm, unsigned int bits, char *label, unsigned char* id, unsigned int id_len);
+extern int PKCS11_generate_key(PKCS11_TOKEN * token, int algorithm, unsigned int bits, char *label, unsigned char* id, size_t id_len);
 
 /**
  * Store private key on a token
@@ -304,7 +304,7 @@ extern int PKCS11_generate_key(PKCS11_TOKEN * token, int algorithm, unsigned int
  * @retval 0 success
  * @retval -1 error
  */
-extern int PKCS11_store_private_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, unsigned int id_len);
+extern int PKCS11_store_private_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, size_t id_len);
 
 /**
  * Store public key on a token
@@ -317,7 +317,7 @@ extern int PKCS11_store_private_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *l
  * @retval 0 success
  * @retval -1 error
  */
-extern int PKCS11_store_public_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, unsigned int id_len);
+extern int PKCS11_store_public_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, size_t id_len);
 
 /**
  * Store certificate on a token
@@ -332,7 +332,7 @@ extern int PKCS11_store_public_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *la
  * @retval -1 error
  */
 extern int PKCS11_store_certificate(PKCS11_TOKEN * token, X509 * x509,
-		char *label, unsigned char *id, unsigned int id_len,
+		char *label, unsigned char *id, size_t id_len,
 		PKCS11_CERT **ret_cert);
 
 /* rsa private key operations */
diff --git a/src/p11_cert.c b/src/p11_cert.c
index cf6481c..157bc6b 100644
--- a/src/p11_cert.c
+++ b/src/p11_cert.c
@@ -174,7 +174,7 @@ static int pkcs11_init_cert(PKCS11_CTX * ctx, PKCS11_TOKEN * token,
 		cert->x509 = d2i_X509(NULL, &p, size);
 	}
 	cert->id_len = sizeof(id);
-	if (!pkcs11_getattr_var(token, obj, CKA_ID, id, (size_t *) & cert->id_len)) {
+	if (!pkcs11_getattr_var(token, obj, CKA_ID, id, &cert->id_len)) {
 		cert->id = (unsigned char *) malloc(cert->id_len);
 		memcpy(cert->id, id, cert->id_len);
 	}
@@ -219,7 +219,7 @@ void pkcs11_destroy_certs(PKCS11_TOKEN * token)
  */
 int
 PKCS11_store_certificate(PKCS11_TOKEN * token, X509 * x509, char *label,
-			 unsigned char *id, unsigned int id_len,
+			 unsigned char *id, size_t id_len,
 			 PKCS11_CERT ** ret_cert)
 {
 	PKCS11_SLOT *slot = TOKEN2SLOT(token);
diff --git a/src/p11_key.c b/src/p11_key.c
index 8690450..f9672fc 100644
--- a/src/p11_key.c
+++ b/src/p11_key.c
@@ -31,9 +31,9 @@ static int pkcs11_init_key(PKCS11_CTX * ctx, PKCS11_TOKEN * token,
 			   CK_SESSION_HANDLE session, CK_OBJECT_HANDLE o,
 			   CK_OBJECT_CLASS type, PKCS11_KEY **);
 static int pkcs11_store_private_key(PKCS11_TOKEN *, EVP_PKEY *, char *,
-				    unsigned char *, unsigned int, PKCS11_KEY **);
+				    unsigned char *, size_t, PKCS11_KEY **);
 static int pkcs11_store_public_key(PKCS11_TOKEN *, EVP_PKEY *, char *,
-				   unsigned char *, unsigned int, PKCS11_KEY **);
+				   unsigned char *, size_t, PKCS11_KEY **);
 
 static CK_OBJECT_CLASS key_search_class;
 static CK_ATTRIBUTE key_search_attrs[] = {
@@ -93,14 +93,14 @@ PKCS11_KEY *PKCS11_find_key(PKCS11_CERT *cert)
 /*
  * Store a private key on the token
  */
-int PKCS11_store_private_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, unsigned int id_len)
+int PKCS11_store_private_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, size_t id_len)
 {
 	if (pkcs11_store_private_key(token, pk, label, id, id_len, NULL))
 		return -1;
 	return 0;
 }
 
-int PKCS11_store_public_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, unsigned int id_len)
+int PKCS11_store_public_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, unsigned char *id, size_t id_len)
 {
 	if (pkcs11_store_public_key(token, pk, label, id, id_len, NULL))
 		return -1;
@@ -114,7 +114,7 @@ int PKCS11_store_public_key(PKCS11_TOKEN * token, EVP_PKEY * pk, char *label, un
  */
 int
 PKCS11_generate_key(PKCS11_TOKEN * token,
-		    int algorithm, unsigned int bits, char *label, unsigned char* id, unsigned int id_len)
+		    int algorithm, unsigned int bits, char *label, unsigned char* id, size_t id_len)
 {
 	PKCS11_KEY *key_obj;
 	EVP_PKEY *pk;
@@ -283,7 +283,7 @@ static int pkcs11_init_key(PKCS11_CTX * ctx, PKCS11_TOKEN * token,
 	if (!pkcs11_getattr_s(token, obj, CKA_LABEL, label, sizeof(label)))
 		key->label = BUF_strdup(label);
 	key->id_len = sizeof(id);
-	if (!pkcs11_getattr_var(token, obj, CKA_ID, id, (size_t *) & key->id_len)) {
+	if (!pkcs11_getattr_var(token, obj, CKA_ID, id, &key->id_len)) {
 		key->id = (unsigned char *) malloc(key->id_len);
 		memcpy(key->id, id, key->id_len);
 	}
@@ -329,7 +329,7 @@ void pkcs11_destroy_keys(PKCS11_TOKEN * token)
  * Store private key
  */
 static int pkcs11_store_private_key(PKCS11_TOKEN * token, EVP_PKEY * pk,
-		char *label, unsigned char *id, unsigned int id_len,
+		char *label, unsigned char *id, size_t id_len,
 		PKCS11_KEY ** ret_key)
 {
 	PKCS11_SLOT *slot = TOKEN2SLOT(token);
@@ -392,7 +392,7 @@ static int pkcs11_store_private_key(PKCS11_TOKEN * token, EVP_PKEY * pk,
  * Store public key
  */
 static int pkcs11_store_public_key(PKCS11_TOKEN * token, EVP_PKEY * pk,
-		char *label, unsigned char *id, unsigned int id_len,
+		char *label, unsigned char *id, size_t id_len,
 		PKCS11_KEY ** ret_key)
 {
 	PKCS11_SLOT *slot = TOKEN2SLOT(token);
diff --git a/src/pkcs11.h b/src/pkcs11.h
index 2e6a1e3..52cd17d 100644
--- a/src/pkcs11.h
+++ b/src/pkcs11.h
@@ -460,7 +460,7 @@ struct ck_attribute
 {
   ck_attribute_type_t type;
   void *value;
-  unsigned long value_len;
+  size_t value_len;
 };
 
 

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



More information about the pkg-opensc-commit mailing list