default: PORT_SetError(SEC_ERROR_INVALID_ARGS); return -1;
nss_cms_recipients_traverse(NSSCMSRecipientInfo **recipientinfos, NSSCMSRecipient **recipient_list){    int count = 0;    int rlindex = 0;    int i, j;    NSSCMSRecipient *rle;    NSSCMSRecipientInfo *ri;    NSSCMSRecipientEncryptedKey *rek;    for (i = 0; recipientinfos[i] != NULL; i++) {	ri = recipientinfos[i];	switch (ri->recipientInfoType) {	case NSSCMSRecipientInfoID_KeyTrans:	    if (recipient_list) {		/* alloc one & fill it out */		rle = (NSSCMSRecipient *)PORT_ZAlloc(sizeof(NSSCMSRecipient));		if (rle == NULL)		    return -1;				rle->riIndex = i;		rle->subIndex = -1;		switch (ri->ri.keyTransRecipientInfo.recipientIdentifier.identifierType) {		case NSSCMSRecipientID_IssuerSN:		    rle->kind = RLIssuerSN;		    rle->id.issuerAndSN = ri->ri.keyTransRecipientInfo.recipientIdentifier.id.issuerAndSN;		    break;		case NSSCMSRecipientID_SubjectKeyID:		    rle->kind = RLSubjKeyID;		    rle->id.subjectKeyID = ri->ri.keyTransRecipientInfo.recipientIdentifier.id.subjectKeyID;		    break;		}		recipient_list[rlindex++] = rle;	    } else {		count++;	    }	    break;	case NSSCMSRecipientInfoID_KeyAgree:	    if (ri->ri.keyAgreeRecipientInfo.recipientEncryptedKeys == NULL)		break;	    for (j=0; ri->ri.keyAgreeRecipientInfo.recipientEncryptedKeys[j] != NULL; j++) {		if (recipient_list) {		    rek = ri->ri.keyAgreeRecipientInfo.recipientEncryptedKeys[j];		    /* alloc one & fill it out */		    rle = (NSSCMSRecipient *)PORT_ZAlloc(sizeof(NSSCMSRecipient));		    if (rle == NULL)			return -1;		    		    rle->riIndex = i;		    rle->subIndex = j;		    switch (rek->recipientIdentifier.identifierType) {		    case NSSCMSKeyAgreeRecipientID_IssuerSN:			rle->kind = RLIssuerSN;			rle->id.issuerAndSN = rek->recipientIdentifier.id.issuerAndSN;			break;		    case NSSCMSKeyAgreeRecipientID_RKeyID:			rle->kind = RLSubjKeyID;			rle->id.subjectKeyID = rek->recipientIdentifier.id.recipientKeyIdentifier.subjectKeyIdentifier;			break;		    }		    recipient_list[rlindex++] = rle;		} else {		    count++;		}	    }	    break;	case NSSCMSRecipientInfoID_KEK:	    /* KEK is not implemented */	    break;	}    }    /* if we have a recipient list, we return on success (-1, above, on failure) */    /* otherwise, we return the count. */    if (recipient_list) {	recipient_list[rlindex] = NULL;	return 0;    } else {	return count;    }}