From 5f437eeb8c5b84ac2e284d518559f76faf1d1609 Mon Sep 17 00:00:00 2001 From: "ian.mcgreer%sun.com" Date: Mon, 17 Dec 2001 13:43:34 +0000 Subject: [PATCH] needed for traversal of keys --- security/nss/lib/softoken/pkcs11.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/security/nss/lib/softoken/pkcs11.c b/security/nss/lib/softoken/pkcs11.c index 1913d43e6496..489a1ad82cf4 100644 --- a/security/nss/lib/softoken/pkcs11.c +++ b/security/nss/lib/softoken/pkcs11.c @@ -3288,12 +3288,18 @@ pk11_key_collect(DBT *key, DBT *data, void *arg) PORT_Assert(slot->keyDB); if (!keyData->strict && keyData->id) { SECItem result; + PRBool haveMatch; unsigned char hashKey[SHA1_LENGTH]; result.data = hashKey; result.len = sizeof(hashKey); - SHA1_HashBuf( hashKey, key->data, key->size ); - if (SECITEM_ItemsAreEqual(keyData->id,&result)) { + if (keyData->id->len == 0) { + haveMatch = PR_TRUE; /* taking any key */ + } else { + SHA1_HashBuf( hashKey, key->data, key->size ); /* match id */ + haveMatch = SECITEM_ItemsAreEqual(keyData->id,&result); + } + if (haveMatch) { if (keyData->classFlags & NSC_PRIVATE) { pk11_addHandle(keyData->searchHandles, pk11_mkHandle(slot,&tmpDBKey,PK11_TOKEN_TYPE_PRIV));