summaryrefslogtreecommitdiffstats
path: root/security/nss/lib/softoken
diff options
context:
space:
mode:
Diffstat (limited to 'security/nss/lib/softoken')
-rw-r--r--security/nss/lib/softoken/pkcs11.c9
-rw-r--r--security/nss/lib/softoken/pkcs11c.c2
-rw-r--r--security/nss/lib/softoken/pkcs11i.h2
-rw-r--r--security/nss/lib/softoken/pkcs11u.c23
-rw-r--r--security/nss/lib/softoken/softkver.h4
5 files changed, 14 insertions, 26 deletions
diff --git a/security/nss/lib/softoken/pkcs11.c b/security/nss/lib/softoken/pkcs11.c
index 7dd4f7ee9..7f0adf82f 100644
--- a/security/nss/lib/softoken/pkcs11.c
+++ b/security/nss/lib/softoken/pkcs11.c
@@ -2674,8 +2674,9 @@ sftk_CloseAllSessions(SFTKSlot *slot, PRBool logout)
} else {
SKIP_AFTER_FORK(PZ_Unlock(lock));
}
- if (session)
- sftk_FreeSession(session);
+ if (session) {
+ sftk_DestroySession(session);
+ }
} while (session != NULL);
}
return CKR_OK;
@@ -3910,8 +3911,6 @@ NSC_CloseSession(CK_SESSION_HANDLE hSession)
if (sftkqueue_is_queued(session, hSession, slot->head, slot->sessHashSize)) {
sessionFound = PR_TRUE;
sftkqueue_delete(session, hSession, slot->head, slot->sessHashSize);
- session->refCount--; /* can't go to zero while we hold the reference */
- PORT_Assert(session->refCount > 0);
}
PZ_Unlock(lock);
@@ -3932,6 +3931,8 @@ NSC_CloseSession(CK_SESSION_HANDLE hSession)
if (session->info.flags & CKF_RW_SESSION) {
(void)PR_ATOMIC_DECREMENT(&slot->rwSessionCount);
}
+ sftk_DestroySession(session);
+ session = NULL;
}
sftk_FreeSession(session);
diff --git a/security/nss/lib/softoken/pkcs11c.c b/security/nss/lib/softoken/pkcs11c.c
index 327a67d5c..4837961f1 100644
--- a/security/nss/lib/softoken/pkcs11c.c
+++ b/security/nss/lib/softoken/pkcs11c.c
@@ -1285,7 +1285,7 @@ NSC_EncryptUpdate(CK_SESSION_HANDLE hSession,
}
/* encrypt the current padded data */
rv = (*context->update)(context->cipherInfo, pEncryptedPart,
- &padoutlen, context->blockSize, context->padBuf,
+ &padoutlen, maxout, context->padBuf,
context->blockSize);
if (rv != SECSuccess) {
return sftk_MapCryptError(PORT_GetError());
diff --git a/security/nss/lib/softoken/pkcs11i.h b/security/nss/lib/softoken/pkcs11i.h
index 7e57dc5e5..1ba0bdb82 100644
--- a/security/nss/lib/softoken/pkcs11i.h
+++ b/security/nss/lib/softoken/pkcs11i.h
@@ -281,7 +281,6 @@ struct SFTKSessionStr {
SFTKSession *next;
SFTKSession *prev;
CK_SESSION_HANDLE handle;
- int refCount;
PZLock *objectLock;
int objectIDCount;
CK_SESSION_INFO info;
@@ -670,6 +669,7 @@ extern SFTKSlot *sftk_SlotFromSessionHandle(CK_SESSION_HANDLE handle);
extern CK_SLOT_ID sftk_SlotIDFromSessionHandle(CK_SESSION_HANDLE handle);
extern SFTKSession *sftk_SessionFromHandle(CK_SESSION_HANDLE handle);
extern void sftk_FreeSession(SFTKSession *session);
+extern void sftk_DestroySession(SFTKSession *session);
extern SFTKSession *sftk_NewSession(CK_SLOT_ID slotID, CK_NOTIFY notify,
CK_VOID_PTR pApplication, CK_FLAGS flags);
extern void sftk_update_state(SFTKSlot *slot, SFTKSession *session);
diff --git a/security/nss/lib/softoken/pkcs11u.c b/security/nss/lib/softoken/pkcs11u.c
index 7b5fe732f..8cb5d2e70 100644
--- a/security/nss/lib/softoken/pkcs11u.c
+++ b/security/nss/lib/softoken/pkcs11u.c
@@ -1772,7 +1772,6 @@ sftk_NewSession(CK_SLOT_ID slotID, CK_NOTIFY notify, CK_VOID_PTR pApplication,
return NULL;
session->next = session->prev = NULL;
- session->refCount = 1;
session->enc_context = NULL;
session->hash_context = NULL;
session->sign_context = NULL;
@@ -1796,11 +1795,10 @@ sftk_NewSession(CK_SLOT_ID slotID, CK_NOTIFY notify, CK_VOID_PTR pApplication,
}
/* free all the data associated with a session. */
-static void
+void
sftk_DestroySession(SFTKSession *session)
{
SFTKObjectList *op, *next;
- PORT_Assert(session->refCount == 0);
/* clean out the attributes */
/* since no one is referencing us, it's safe to walk the chain
@@ -1844,31 +1842,20 @@ sftk_SessionFromHandle(CK_SESSION_HANDLE handle)
PZ_Lock(lock);
sftkqueue_find(session, handle, slot->head, slot->sessHashSize);
- if (session)
- session->refCount++;
PZ_Unlock(lock);
return (session);
}
/*
- * release a reference to a session handle
+ * release a reference to a session handle. This method of using SFTKSessions
+ * is deprecated, but the pattern should be retained until a future effort
+ * to refactor all SFTKSession users at once is completed.
*/
void
sftk_FreeSession(SFTKSession *session)
{
- PRBool destroy = PR_FALSE;
- SFTKSlot *slot = sftk_SlotFromSession(session);
- PZLock *lock = SFTK_SESSION_LOCK(slot, session->handle);
-
- PZ_Lock(lock);
- if (session->refCount == 1)
- destroy = PR_TRUE;
- session->refCount--;
- PZ_Unlock(lock);
-
- if (destroy)
- sftk_DestroySession(session);
+ return;
}
void
diff --git a/security/nss/lib/softoken/softkver.h b/security/nss/lib/softoken/softkver.h
index ab2e91018..3c1842f6e 100644
--- a/security/nss/lib/softoken/softkver.h
+++ b/security/nss/lib/softoken/softkver.h
@@ -17,10 +17,10 @@
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <ECC>][ <Beta>]"
*/
-#define SOFTOKEN_VERSION "3.41.3" SOFTOKEN_ECC_STRING
+#define SOFTOKEN_VERSION "3.41.4" SOFTOKEN_ECC_STRING
#define SOFTOKEN_VMAJOR 3
#define SOFTOKEN_VMINOR 41
-#define SOFTOKEN_VPATCH 3
+#define SOFTOKEN_VPATCH 4
#define SOFTOKEN_VBUILD 0
#define SOFTOKEN_BETA PR_FALSE