summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-01-22 13:21:26 +0200
committerToomas Soome <tsoome@me.com>2019-06-25 08:36:39 +0300
commit07eb1aef88b873c5c1036d9cf69820c1ef6a32fb (patch)
tree24d93067a9e749baf75f3c83602563bc57e131af
parentc0e21d6af8bfe88f1c49c7c12d4537b663fe9db9 (diff)
downloadillumos-joyent-07eb1aef88b873c5c1036d9cf69820c1ef6a32fb.tar.gz
11151 libpkcs11: NULL pointer errors
Reviewed by: Jason Lippert <jason@glasspelican.ca> Reviewed by: Jason King <jbk@joyent.com> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/lib/pkcs11/libpkcs11/common/metaObject.c20
-rw-r--r--usr/src/lib/pkcs11/libpkcs11/common/metaObjectManager.c2
-rw-r--r--usr/src/lib/pkcs11/libpkcs11/common/metaUtil.c32
-rw-r--r--usr/src/lib/pkcs11/libpkcs11/common/pkcs11SUNWExtensions.c8
4 files changed, 31 insertions, 31 deletions
diff --git a/usr/src/lib/pkcs11/libpkcs11/common/metaObject.c b/usr/src/lib/pkcs11/libpkcs11/common/metaObject.c
index b5c86496dd..100f0f7cba 100644
--- a/usr/src/lib/pkcs11/libpkcs11/common/metaObject.c
+++ b/usr/src/lib/pkcs11/libpkcs11/common/metaObject.c
@@ -55,15 +55,15 @@ static int num_stop_rv = sizeof (stop_rv) / sizeof (CK_RV);
* it doesn't need to be used by the code at this point.
*
* static CK_RV try_again_rv[] = {
- * CKR_DEVICE_ERROR,
- * CKR_DEVICE_MEMORY,
- * CKR_DEVICE_REMOVED,
- * CKR_FUNCTION_FAILED,
- * CKR_GENERAL_ERROR,
- * CKR_HOST_MEMORY,
- * CKR_TEMPLATE_INCONSISTENT,
- * CKR_ATTRIBUTE_READ_ONLY,
- * CKR_ATTRIBUTE_VALUE_INVALID
+ * CKR_DEVICE_ERROR,
+ * CKR_DEVICE_MEMORY,
+ * CKR_DEVICE_REMOVED,
+ * CKR_FUNCTION_FAILED,
+ * CKR_GENERAL_ERROR,
+ * CKR_HOST_MEMORY,
+ * CKR_TEMPLATE_INCONSISTENT,
+ * CKR_ATTRIBUTE_READ_ONLY,
+ * CKR_ATTRIBUTE_VALUE_INVALID
* };
* static int num_try_again_rv = sizeof (try_again_rv) / sizeof (CK_RV);
*/
@@ -180,7 +180,7 @@ meta_CreateObject(CK_SESSION_HANDLE hSession, CK_ATTRIBUTE_PTR pTemplate,
*/
if (meta_freeobject_check(session, object, NULL, pTemplate, ulCount,
- NULL)) {
+ 0)) {
/*
* Make sure we are logged into the keystore if this is a
* private freetoken object.
diff --git a/usr/src/lib/pkcs11/libpkcs11/common/metaObjectManager.c b/usr/src/lib/pkcs11/libpkcs11/common/metaObjectManager.c
index 45dfb8c45f..841615975b 100644
--- a/usr/src/lib/pkcs11/libpkcs11/common/metaObjectManager.c
+++ b/usr/src/lib/pkcs11/libpkcs11/common/metaObjectManager.c
@@ -1243,7 +1243,7 @@ clone_by_wrap(meta_object_t *object, slot_object_t *new_clone,
slot_session_t *dst_slot_session)
{
slot_session_t *src_slot_session = NULL;
- CK_OBJECT_HANDLE wrappingKey = NULL, unwrappingKey = NULL;
+ CK_OBJECT_HANDLE wrappingKey = 0, unwrappingKey = 0;
CK_MECHANISM wrappingMech;
CK_BYTE *wrappedKey = NULL;
CK_ULONG wrappedKeyLen = 0;
diff --git a/usr/src/lib/pkcs11/libpkcs11/common/metaUtil.c b/usr/src/lib/pkcs11/libpkcs11/common/metaUtil.c
index 09e21c30a0..f59f51faba 100644
--- a/usr/src/lib/pkcs11/libpkcs11/common/metaUtil.c
+++ b/usr/src/lib/pkcs11/libpkcs11/common/metaUtil.c
@@ -35,7 +35,7 @@ static boolean_t threshold_chk_enabled = B_FALSE;
CK_RV
meta_operation_init_defer(CK_FLAGS optype, meta_session_t *session,
- CK_MECHANISM *pMechanism, meta_object_t *key)
+ CK_MECHANISM *pMechanism, meta_object_t *key)
{
if (session->init.pMech == NULL) {
@@ -108,7 +108,7 @@ meta_operation_init_defer(CK_FLAGS optype, meta_session_t *session,
*/
CK_RV
meta_operation_init(CK_FLAGS optype, meta_session_t *session,
- CK_MECHANISM *pMechanism, meta_object_t *key)
+ CK_MECHANISM *pMechanism, meta_object_t *key)
{
CK_RV rv, save_rv;
mechinfo_t **supporting_slots;
@@ -325,7 +325,7 @@ finish:
*/
CK_RV
meta_operation_init_softtoken(CK_FLAGS optype, meta_session_t *session,
- CK_MECHANISM *pMechanism, meta_object_t *key)
+ CK_MECHANISM *pMechanism, meta_object_t *key)
{
CK_RV rv = CKR_FUNCTION_FAILED;
slot_session_t *init_session = NULL;
@@ -917,8 +917,8 @@ get_slotlist_for_mech(CK_MECHANISM_TYPE mech_type,
*/
CK_RV
meta_generate_keys(meta_session_t *session, CK_MECHANISM *pMechanism,
- CK_ATTRIBUTE *k1Template, CK_ULONG k1AttrCount, meta_object_t *key1,
- CK_ATTRIBUTE *k2Template, CK_ULONG k2AttrCount, meta_object_t *key2)
+ CK_ATTRIBUTE *k1Template, CK_ULONG k1AttrCount, meta_object_t *key1,
+ CK_ATTRIBUTE *k2Template, CK_ULONG k2AttrCount, meta_object_t *key2)
{
CK_RV rv, save_rv;
slot_session_t *gen_session = NULL;
@@ -977,7 +977,7 @@ meta_generate_keys(meta_session_t *session, CK_MECHANISM *pMechanism,
}
if (meta_freeobject_check(session, key1, pMechanism, k1Template,
- k1AttrCount, NULL)) {
+ k1AttrCount, 0)) {
if ((key1->isPrivate || (doKeyPair && key2->isPrivate)) &&
!metaslot_logged_in())
@@ -1298,10 +1298,10 @@ finish:
*/
CK_RV
meta_unwrap_key(meta_session_t *session,
- CK_MECHANISM *pMechanism, meta_object_t *unwrapping_key,
- CK_BYTE *wrapped_key, CK_ULONG wrapped_key_len,
- CK_ATTRIBUTE *template, CK_ULONG template_size,
- meta_object_t *unwrapped_key)
+ CK_MECHANISM *pMechanism, meta_object_t *unwrapping_key,
+ CK_BYTE *wrapped_key, CK_ULONG wrapped_key_len,
+ CK_ATTRIBUTE *template, CK_ULONG template_size,
+ meta_object_t *unwrapped_key)
{
CK_RV rv, save_rv;
CK_OBJECT_HANDLE hUnwrappedKey;
@@ -1452,11 +1452,11 @@ finish:
*/
CK_RV
meta_derive_key(meta_session_t *session, CK_MECHANISM *pMechanism,
- meta_object_t *basekey1, meta_object_t *basekey2,
- CK_OBJECT_HANDLE *phBaseKey2,
- CK_ATTRIBUTE *pTemplate, CK_ULONG ulAttributeCount,
- meta_object_t *newKey1, meta_object_t *newKey2,
- meta_object_t *newKey3, meta_object_t *newKey4)
+ meta_object_t *basekey1, meta_object_t *basekey2,
+ CK_OBJECT_HANDLE *phBaseKey2,
+ CK_ATTRIBUTE *pTemplate, CK_ULONG ulAttributeCount,
+ meta_object_t *newKey1, meta_object_t *newKey2,
+ meta_object_t *newKey3, meta_object_t *newKey4)
{
CK_RV rv, save_rv;
CK_OBJECT_HANDLE hDerivedKey;
@@ -1495,7 +1495,7 @@ meta_derive_key(meta_session_t *session, CK_MECHANISM *pMechanism,
}
if (meta_freeobject_check(session, newKey1, pMechanism, pTemplate,
- ulAttributeCount, NULL)) {
+ ulAttributeCount, 0)) {
if (newKey1->isPrivate && !metaslot_logged_in())
return (CKR_USER_NOT_LOGGED_IN);
diff --git a/usr/src/lib/pkcs11/libpkcs11/common/pkcs11SUNWExtensions.c b/usr/src/lib/pkcs11/libpkcs11/common/pkcs11SUNWExtensions.c
index 68f997e103..882ca9f8bd 100644
--- a/usr/src/lib/pkcs11/libpkcs11/common/pkcs11SUNWExtensions.c
+++ b/usr/src/lib/pkcs11/libpkcs11/common/pkcs11SUNWExtensions.c
@@ -289,7 +289,7 @@ SUNW_C_KeyToObject(CK_SESSION_HANDLE hSession, CK_MECHANISM_TYPE mech,
/* template for creating generic secret key object */
CK_ATTRIBUTE template[NUM_SECRETKEY_ATTRS];
- if ((hSession == NULL) || (obj == NULL) ||
+ if ((hSession == CK_INVALID_HANDLE) || (obj == NULL) ||
(rawkey == NULL) || (rawkey_len == 0)) {
return (CKR_ARGUMENTS_BAD);
}
@@ -386,7 +386,7 @@ pkcs11_PasswdToPBKD2Object(CK_SESSION_HANDLE hSession, char *passphrase,
CK_ULONG i, j, num_asym_mechs, num_fixed_secs, num_mapping;
CK_ATTRIBUTE template[NUM_SECRETKEY_ATTRS];
- if (hSession == NULL || obj == NULL ||
+ if (hSession == CK_INVALID_HANDLE || obj == NULL ||
passphrase == NULL || passphrase_len == 0 ||
iterations == 0UL) {
return (CKR_ARGUMENTS_BAD);
@@ -510,9 +510,9 @@ pkcs11_ObjectToKey(CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE obj,
CK_RV rv;
CK_ATTRIBUTE template;
- if (hSession == NULL)
+ if (hSession == CK_INVALID_HANDLE)
return (CKR_SESSION_HANDLE_INVALID);
- if (obj == NULL)
+ if (obj == 0)
return (CKR_OBJECT_HANDLE_INVALID);
if (rawkey == NULL || rawkey_len == NULL)
return (CKR_ARGUMENTS_BAD);