Bugzilla bug 288657: fixed the bug that pk11_AnyUnwrapKey returns a

partially constructed symKey object if C_UnwrapKey fails with
CKR_DEVICE_ERROR.  r=relyea.
This commit is contained in:
wtchang%redhat.com 2005-04-01 22:27:44 +00:00
Родитель 5807972621
Коммит 1ddbee0247
1 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -1810,12 +1810,15 @@ pk11_AnyUnwrapKey(PK11SlotInfo *slot, CK_OBJECT_HANDLE wrappingKey,
pk11_ExitKeyMonitor(symKey);
}
if (param_free) SECITEM_FreeItem(param_free,PR_TRUE);
if ((crv != CKR_OK) && (crv != CKR_DEVICE_ERROR)) {
/* try hand Unwrapping */
if (crv != CKR_OK) {
PK11_FreeSymKey(symKey);
symKey = pk11_HandUnwrap(slot, wrappingKey, &mechanism, wrappedKey,
target, keyTemplate, templateCount, keySize,
wincx, NULL, isPerm);
symKey = NULL;
if (crv != CKR_DEVICE_ERROR) {
/* try hand Unwrapping */
symKey = pk11_HandUnwrap(slot, wrappingKey, &mechanism, wrappedKey,
target, keyTemplate, templateCount,
keySize, wincx, NULL, isPerm);
}
}
return symKey;