summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Walden <jwalden@mit.edu>2020-06-05 21:22:51 +0000
committerJeff Walden <jwalden@mit.edu>2020-06-05 21:22:51 +0000
commitb0ecce5214e7509fa2282b07f848533caba88d65 (patch)
tree3834673cc7206f563dd7865ea2e5b36db93196ea
parent07eda9e427f1b47b3e45af269578b6c7f1c4c79b (diff)
downloadnss-hg-b0ecce5214e7509fa2282b07f848533caba88d65.tar.gz
Bug 1643557 - Change the type of the size argument to pk11_FindObjectsByTemplate to be size_t, consistent with the type of some (small) numeric values passed to it after the previous revision. r=kjacobs
Depends on D78452 Differential Revision: https://phabricator.services.mozilla.com/D78453
-rw-r--r--lib/pk11wrap/pk11akey.c6
-rw-r--r--lib/pk11wrap/pk11cert.c4
-rw-r--r--lib/pk11wrap/pk11obj.c7
-rw-r--r--lib/pk11wrap/secmodi.h5
4 files changed, 15 insertions, 7 deletions
diff --git a/lib/pk11wrap/pk11akey.c b/lib/pk11wrap/pk11akey.c
index c4d139226..cada965c6 100644
--- a/lib/pk11wrap/pk11akey.c
+++ b/lib/pk11wrap/pk11akey.c
@@ -5,6 +5,8 @@
* This file contains functions to manage asymetric keys, (public and
* private keys).
*/
+#include <stddef.h>
+
#include "seccomon.h"
#include "secmod.h"
#include "secmodi.h"
@@ -2548,7 +2550,7 @@ PK11_ListPublicKeysInSlot(PK11SlotInfo *slot, char *nickname)
CK_ATTRIBUTE *attrs;
CK_BBOOL ckTrue = CK_TRUE;
CK_OBJECT_CLASS keyclass = CKO_PUBLIC_KEY;
- unsigned int tsize = 0;
+ size_t tsize = 0;
int objCount = 0;
CK_OBJECT_HANDLE *key_ids;
SECKEYPublicKeyList *keys;
@@ -2596,7 +2598,7 @@ PK11_ListPrivKeysInSlot(PK11SlotInfo *slot, char *nickname, void *wincx)
CK_ATTRIBUTE *attrs;
CK_BBOOL ckTrue = CK_TRUE;
CK_OBJECT_CLASS keyclass = CKO_PRIVATE_KEY;
- unsigned int tsize = 0;
+ size_t tsize = 0;
int objCount = 0;
CK_OBJECT_HANDLE *key_ids;
SECKEYPrivateKeyList *keys;
diff --git a/lib/pk11wrap/pk11cert.c b/lib/pk11wrap/pk11cert.c
index d89897a18..a192c6951 100644
--- a/lib/pk11wrap/pk11cert.c
+++ b/lib/pk11wrap/pk11cert.c
@@ -5,6 +5,8 @@
* This file manages PKCS #11 instances of certificates.
*/
+#include <stddef.h>
+
#include "secport.h"
#include "seccomon.h"
#include "secmod.h"
@@ -445,7 +447,7 @@ PK11_FindCertHandlesForKeyHandle(PK11SlotInfo *slot, CK_OBJECT_HANDLE keyHandle,
idTemplate[0],
{ CKA_CLASS, &searchClass, sizeof(searchClass) }
};
- const int searchAttrCount = sizeof(searchTemplate) / sizeof(searchTemplate[0]);
+ const size_t searchAttrCount = sizeof(searchTemplate) / sizeof(searchTemplate[0]);
CK_OBJECT_HANDLE *ids = pk11_FindObjectsByTemplate(slot, searchTemplate, searchAttrCount, certHandleCountOut);
PORT_DestroyCheapArena(&arena);
diff --git a/lib/pk11wrap/pk11obj.c b/lib/pk11wrap/pk11obj.c
index 37eea41f8..8ca8e8a3d 100644
--- a/lib/pk11wrap/pk11obj.c
+++ b/lib/pk11wrap/pk11obj.c
@@ -5,6 +5,7 @@
* This file manages object type indepentent functions.
*/
#include <limits.h>
+#include <stddef.h>
#include "seccomon.h"
#include "secmod.h"
@@ -1846,7 +1847,7 @@ pk11_FindObjectByTemplate(PK11SlotInfo *slot, CK_ATTRIBUTE *theTemplate, int tsi
*/
CK_OBJECT_HANDLE *
pk11_FindObjectsByTemplate(PK11SlotInfo *slot, CK_ATTRIBUTE *findTemplate,
- int templCount, int *object_count)
+ size_t templCount, int *object_count)
{
CK_OBJECT_HANDLE *objID = NULL;
CK_ULONG returned_count = 0;
@@ -1941,7 +1942,7 @@ PK11_FindRawCertsWithSubject(PK11SlotInfo *slot, SECItem *derSubject,
{ CKA_CLASS, &cko_certificate, sizeof(cko_certificate) },
{ CKA_SUBJECT, derSubject->data, derSubject->len },
};
- int templateCount = sizeof(subjectTemplate) / sizeof(subjectTemplate[0]);
+ const size_t templateCount = sizeof(subjectTemplate) / sizeof(subjectTemplate[0]);
int handleCount = 0;
CK_OBJECT_HANDLE *handles =
pk11_FindObjectsByTemplate(slot, subjectTemplate, templateCount,
@@ -2175,7 +2176,7 @@ PK11_FindObjectsFromNickname(char *nickname, PK11SlotInfo **slotptr,
{ CKA_LABEL, NULL, 0 },
{ CKA_CLASS, NULL, 0 },
};
- int findCount = sizeof(findTemplate) / sizeof(findTemplate[0]);
+ const size_t findCount = sizeof(findTemplate) / sizeof(findTemplate[0]);
SECStatus rv;
PK11_SETATTRS(&findTemplate[1], CKA_CLASS, &objclass, sizeof(objclass));
diff --git a/lib/pk11wrap/secmodi.h b/lib/pk11wrap/secmodi.h
index df755e34a..940f6900d 100644
--- a/lib/pk11wrap/secmodi.h
+++ b/lib/pk11wrap/secmodi.h
@@ -7,6 +7,9 @@
*/
#ifndef _SECMODI_H_
#define _SECMODI_H_ 1
+
+#include <stddef.h>
+
#include "pkcs11.h"
#include "nssilock.h"
#include "secoidt.h"
@@ -92,7 +95,7 @@ void pk11_SignedToUnsigned(CK_ATTRIBUTE *attrib);
CK_OBJECT_HANDLE pk11_FindObjectByTemplate(PK11SlotInfo *slot,
CK_ATTRIBUTE *inTemplate, int tsize);
CK_OBJECT_HANDLE *pk11_FindObjectsByTemplate(PK11SlotInfo *slot,
- CK_ATTRIBUTE *inTemplate, int tsize, int *objCount);
+ CK_ATTRIBUTE *inTemplate, size_t tsize, int *objCount);
#define PK11_GETTAB(x) ((CK_FUNCTION_LIST_3_0_PTR)((x)->functionList))
#define PK11_SETATTRS(x, id, v, l) \