1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00

[NSS] Fix instances of softoken attributes freed after owning object.

This commit is contained in:
Moonchild
2026-05-24 10:09:28 +02:00
committed by roytam1
parent 7bbdccd376
commit 300dd371b2
+7 -3
View File
@@ -5752,8 +5752,10 @@ NSC_WrapKey(CK_SESSION_HANDLE hSession,
/* Find out if this is a block cipher. */
crv = sftk_GetContext(hSession, &context, SFTK_ENCRYPT, PR_FALSE, NULL);
if (crv != CKR_OK || !context)
if (crv != CKR_OK || !context) {
sftk_FreeAttribute(attribute);
break;
}
if (context->blockSize > 1) {
unsigned int remainder = pText.len % context->blockSize;
if (!context->doPad && remainder) {
@@ -5767,6 +5769,7 @@ NSC_WrapKey(CK_SESSION_HANDLE hSession,
memcpy(pText.data, attribute->attrib.pValue,
attribute->attrib.ulValueLen);
else {
sftk_FreeAttribute(attribute);
crv = CKR_HOST_MEMORY;
break;
}
@@ -7577,8 +7580,8 @@ NSC_DeriveKey(CK_SESSION_HANDLE hSession,
if (keySize == 0)
keySize = tmpKeySize;
if (keySize > tmpKeySize) {
sftk_FreeObject(newKey);
sftk_FreeAttribute(att2);
sftk_FreeObject(newKey);
crv = CKR_TEMPLATE_INCONSISTENT;
break;
}
@@ -8485,12 +8488,13 @@ NSC_DigestKey(CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hKey)
}
/* get the key value */
att = sftk_FindAttribute(key, CKA_VALUE);
sftk_FreeObject(key);
if (!att) {
sftk_FreeObject(key);
return CKR_KEY_HANDLE_INVALID;
}
crv = NSC_DigestUpdate(hSession, (CK_BYTE_PTR)att->attrib.pValue,
att->attrib.ulValueLen);
sftk_FreeAttribute(att);
sftk_FreeObject(key);
return crv;
}