mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Bug 129303 NSS needs to expose interfaces to deal with multiple token sources of certs
r=kaie
This commit is contained in:
parent
a22503418d
commit
4b7f9f6804
@ -2392,3 +2392,46 @@ PK11_ListCertsInSlot(PK11SlotInfo *slot)
|
|||||||
return certs;
|
return certs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PK11SlotList *
|
||||||
|
PK11_GetAllSlotsForCert(CERTCertificate *cert, void *arg)
|
||||||
|
{
|
||||||
|
NSSCertificate *c = STAN_GetNSSCertificate(cert);
|
||||||
|
/* add multiple instances to the cert list */
|
||||||
|
nssCryptokiObject **ip;
|
||||||
|
nssCryptokiObject **instances = nssPKIObject_GetInstances(&c->object);
|
||||||
|
PK11SlotList *slotList;
|
||||||
|
PRBool found = PR_FALSE;
|
||||||
|
|
||||||
|
if (!cert) {
|
||||||
|
PORT_SetError(SEC_ERROR_INVALID_ARGS);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!instances) {
|
||||||
|
PORT_SetError(SEC_ERROR_NO_TOKEN);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
slotList = PK11_NewSlotList();
|
||||||
|
if (!slotList) {
|
||||||
|
nssCryptokiObjectArray_Destroy(instances);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ip = instances; *ip; ip++) {
|
||||||
|
nssCryptokiObject *instance = *ip;
|
||||||
|
PK11SlotInfo *slot = instance->token->pk11slot;
|
||||||
|
if (slot) {
|
||||||
|
PK11_AddSlotToList(slotList, slot);
|
||||||
|
found = PR_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
PK11_FreeSlotList(slotList);
|
||||||
|
PORT_SetError(SEC_ERROR_NO_TOKEN);
|
||||||
|
slotList = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
nssCryptokiObjectArray_Destroy(instances);
|
||||||
|
return slotList;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user