Skip to content

Commit

Permalink
Bugzilla bug 126087: removed symKey->refLock because we are using atomic
Browse files Browse the repository at this point in the history
routines on symKey->refCount now.  Declare symKey->refCount as PRInt32 to
match the prototype of PR_AtomicIncrement/Decrement.
Modified files: pk11skey.c secmodti.h
  • Loading branch information
wtc%netscape.com committed Apr 17, 2002
1 parent 7b24ce7 commit 69f08ed
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
11 changes: 0 additions & 11 deletions security/nss/lib/pk11wrap/pk11skey.c
Expand Up @@ -179,11 +179,6 @@ pk11_getKeyFromList(PK11SlotInfo *slot) {
if (symKey == NULL) {
return NULL;
}
symKey->refLock = PZ_NewLock(nssILockRefLock);
if (symKey->refLock == NULL) {
PORT_Free(symKey);
return NULL;
}
symKey->session = pk11_GetNewSession(slot,&symKey->sessionOwner);
symKey->next = NULL;
return symKey;
Expand All @@ -198,7 +193,6 @@ PK11_CleanKeyList(PK11SlotInfo *slot)
symKey = slot->freeSymKeysHead;
slot->freeSymKeysHead = symKey->next;
pk11_CloseSession(slot, symKey->session,symKey->sessionOwner);
PK11_USE_THREADS(PZ_DestroyLock(symKey->refLock);)
PORT_Free(symKey);
};
return;
Expand Down Expand Up @@ -242,14 +236,10 @@ PK11_CreateSymKey(PK11SlotInfo *slot, CK_MECHANISM_TYPE type, void *wincx)
void
PK11_FreeSymKey(PK11SymKey *symKey)
{
PRBool destroy = PR_FALSE;
PK11SlotInfo *slot;
PRBool freeit = PR_TRUE;

if (PR_AtomicDecrement(&symKey->refCount) == 0) {
destroy= PR_TRUE;
}
if (destroy) {
if ((symKey->owner) && symKey->objectID != CK_INVALID_HANDLE) {
pk11_EnterKeyMonitor(symKey);
(void) PK11_GETTAB(symKey->slot)->
Expand All @@ -273,7 +263,6 @@ PK11_FreeSymKey(PK11SymKey *symKey)
if (freeit) {
pk11_CloseSession(symKey->slot, symKey->session,
symKey->sessionOwner);
PK11_USE_THREADS(PZ_DestroyLock(symKey->refLock);)
PORT_Free(symKey);
}
PK11_FreeSlot(slot);
Expand Down
3 changes: 1 addition & 2 deletions security/nss/lib/pk11wrap/secmodti.h
Expand Up @@ -145,8 +145,7 @@ struct PK11SymKeyStr {
SECItem data; /* raw key data if available */
CK_SESSION_HANDLE session;
PRBool sessionOwner;
int refCount; /* number of references to this key */
PZLock *refLock;
PRInt32 refCount; /* number of references to this key */
int size; /* key size in bytes */
PK11Origin origin; /* where this key came from
(see def in secmodt.h) */
Expand Down

0 comments on commit 69f08ed

Please sign in to comment.