certHandle = pk11_AllFindCertObjectByRecipientNew(recipientlist, wincx, &rlIndex); if (certHandle == CK_INVALID_HANDLE) {
cert = pk11_AllFindCertObjectByRecipientNew(recipientlist, wincx, &rlIndex); if (!cert) {
PK11_FindCertAndKeyByRecipientListNew(NSSCMSRecipient **recipientlist, void *wincx){    CK_OBJECT_HANDLE certHandle = CK_INVALID_HANDLE;    CK_OBJECT_HANDLE keyHandle = CK_INVALID_HANDLE;    NSSCMSRecipient *rl;    int rlIndex;    certHandle = pk11_AllFindCertObjectByRecipientNew(recipientlist, wincx, &rlIndex);    if (certHandle == CK_INVALID_HANDLE) {	return -1;    }    rl = recipientlist[rlIndex];    /* at this point, rl->slot is set */    /* authenticate to the token */    if (PK11_Authenticate(rl->slot, PR_TRUE, wincx) != SECSuccess) {	PK11_FreeSlot(rl->slot);	rl->slot = NULL;	return -1;    }    /* try to get a private key handle for the cert we found */    keyHandle = PK11_MatchItem(rl->slot, certHandle, CKO_PRIVATE_KEY);    if (keyHandle == CK_INVALID_HANDLE) { 	PK11_FreeSlot(rl->slot);	rl->slot = NULL;	return -1;    }    /* make a private key out of the handle */    rl->privkey = PK11_MakePrivKey(rl->slot, nullKey, PR_TRUE, keyHandle, wincx);    if (rl->privkey == NULL) {	PK11_FreeSlot(rl->slot);	rl->slot = NULL;	return -1;    }    /* make a cert from the cert handle */    rl->cert = PK11_MakeCertFromHandle(rl->slot, certHandle, NULL);    if (rl->cert == NULL) {	PK11_FreeSlot(rl->slot);	SECKEY_DestroyPrivateKey(rl->privkey);	rl->slot = NULL;	rl->privkey = NULL;	return -1;    }    return rlIndex;}