derCrl->data = crlData.pValue; derCrl->len = crlData.ulValueLen;
derCrl->data = crlData[0].pValue; derCrl->len = crlData[0].ulValueLen;
PK11_FindCrlByName(PK11SlotInfo **slot, CK_OBJECT_HANDLE *crlHandle,						 SECItem *name, int type){    CK_OBJECT_CLASS crlClass = CKO_NETSCAPE_CRL;    CK_ATTRIBUTE theTemplate[] = {	{ CKA_SUBJECT, NULL, 0 },	{ CKA_CLASS, NULL, 0 },	{ CKA_NETSCAPE_KRL, NULL, 0 },    };    CK_ATTRIBUTE crlData = { CKA_VALUE, NULL, 0 };    /* if you change the array, change the variable below as well */    int tsize = sizeof(theTemplate)/sizeof(theTemplate[0]);    CK_BBOOL ck_true = CK_TRUE;    CK_BBOOL ck_false = CK_FALSE;    CK_OBJECT_HANDLE crlh = CK_INVALID_HANDLE;    CK_ATTRIBUTE *attrs = theTemplate;    CK_RV crv;    SECItem *derCrl = NULL;    PK11_SETATTRS(attrs, CKA_SUBJECT, name->data, name->len); attrs++;    PK11_SETATTRS(attrs, CKA_CLASS, &crlClass, sizeof(crlClass)); attrs++;    PK11_SETATTRS(attrs, CKA_NETSCAPE_KRL, (type == SEC_CRL_TYPE) ? 			&ck_false : &ck_true, sizeof (CK_BBOOL)); attrs++;    if (*slot) {    	crlh = pk11_FindObjectByTemplate(*slot,theTemplate,tsize);    } else {	PK11SlotList *list = PK11_GetAllTokens(CKM_INVALID_MECHANISM,							PR_FALSE,PR_TRUE,NULL);	PK11SlotListElement *le;	/* loop through all the fortezza tokens */	for (le = list->head; le; le = le->next) {	    crlh = pk11_FindObjectByTemplate(le->slot,theTemplate,tsize);	    if (crlh != CK_INVALID_HANDLE) {		*slot = PK11_ReferenceSlot(le->slot);		break;	    }	}	PK11_FreeSlotList(list);    }        if (crlh == CK_INVALID_HANDLE) {	PORT_SetError(SEC_ERROR_NO_KRL);	return NULL;    }    crv = PK11_GetAttributes(NULL,*slot,crlh,&crlData,1);    if (crv != CKR_OK) {	PORT_SetError(PK11_MapError (crv));	goto loser;    }    derCrl = (SECItem *)PORT_ZAlloc(sizeof(SECItem));        if (derCrl == NULL) {	goto loser;    }    derCrl->data = crlData.pValue;    derCrl->len = crlData.ulValueLen;    if (crlHandle) {        *crlHandle = crlh;    }loser:    if (!derCrl) {	if (crlData.pValue) PORT_Free(crlData.pValue);    }    return derCrl;}