зеркало из https://github.com/mozilla/pjs.git
Report invalid key when key import fails. Do not go on and use invalid
key handle. Bug 283642. r=relyea
This commit is contained in:
Родитель
076508a453
Коммит
f10a756e86
|
@ -583,6 +583,12 @@ PK11_VerifyRecover(SECKEYPublicKey *key,
|
|||
PK11_ReferenceSlot(slot);
|
||||
}
|
||||
|
||||
if (id == CK_INVALID_HANDLE) {
|
||||
PK11_FreeSlot(slot);
|
||||
PORT_SetError( SEC_ERROR_BAD_KEY );
|
||||
return SECFailure;
|
||||
}
|
||||
|
||||
session = pk11_GetNewSession(slot,&owner);
|
||||
if (!owner || !(slot->isThreadSafe)) PK11_EnterSlotMonitor(slot);
|
||||
crv = PK11_GETTAB(slot)->C_VerifyRecoverInit(session,&mech,id);
|
||||
|
@ -636,6 +642,12 @@ PK11_Verify(SECKEYPublicKey *key, SECItem *sig, SECItem *hash, void *wincx)
|
|||
PK11_ReferenceSlot(slot);
|
||||
}
|
||||
|
||||
if (id == CK_INVALID_HANDLE) {
|
||||
PK11_FreeSlot(slot);
|
||||
PORT_SetError( SEC_ERROR_BAD_KEY );
|
||||
return SECFailure;
|
||||
}
|
||||
|
||||
session = pk11_GetNewSession(slot,&owner);
|
||||
if (!owner || !(slot->isThreadSafe)) PK11_EnterSlotMonitor(slot);
|
||||
crv = PK11_GETTAB(slot)->C_VerifyInit(session,&mech,id);
|
||||
|
@ -793,6 +805,12 @@ pk11_PubEncryptRaw(SECKEYPublicKey *key, unsigned char *enc,
|
|||
|
||||
id = PK11_ImportPublicKey(slot,key,PR_FALSE);
|
||||
|
||||
if (id == CK_INVALID_HANDLE) {
|
||||
PK11_FreeSlot(slot);
|
||||
PORT_SetError( SEC_ERROR_BAD_KEY );
|
||||
return SECFailure;
|
||||
}
|
||||
|
||||
session = pk11_GetNewSession(slot,&owner);
|
||||
if (!owner || !(slot->isThreadSafe)) PK11_EnterSlotMonitor(slot);
|
||||
crv = PK11_GETTAB(slot)->C_EncryptInit(session, mech, id);
|
||||
|
|
Загрузка…
Ссылка в новой задаче