if ((cnt = nss_CMSArray_Count(envelopeOptions.recipients)) == 0) {
if ((cnt = nss_CMSArray_Count((void **)envelopeOptions->recipients)) == 0) {
enveloped_data(struct envelopeOptionsStr envelopeOptions){    NSSCMSMessage *cmsg = NULL;    NSSCMSContentInfo *cinfo;    NSSCMSEnvelopedData *envd;    NSSCMSRecipientInfo *recipientinfo;    CERTCertificate **recipientcerts;    CERTCertDBHandle *dbhandle;    PLArenaPool *tmppoolp = NULL;    SECOidTag bulkalgtag;    int keysize, i;    int cnt;    dbhandle = envelopeOptions.options->certHandle;    /* count the recipients */    if ((cnt = nss_CMSArray_Count(envelopeOptions.recipients)) == 0) {	fprintf(stderr, "ERROR: please name at least one recipient.\n");	goto loser;    }    if ((tmppoolp = PORT_NewArena (1024)) == NULL) {	fprintf(stderr, "ERROR: out of memory.\n");	goto loser;    }    /* XXX find the recipient's certs by email address or nickname */    if ((recipientcerts =          (CERTCertificate **)PORT_ArenaZAlloc(tmppoolp, 					     (cnt+1)*sizeof(CERTCertificate*)))            == NULL) {	fprintf(stderr, "ERROR: out of memory.\n");	goto loser;    }    for (i=0; envelopeOptions.recipients[i] != NULL; i++) {	if ((recipientcerts[i] = 	      CERT_FindCertByNicknameOrEmailAddr(dbhandle,  	                                        envelopeOptions.recipients[i]))	        == NULL) {	    SECU_PrintError(progName, "cannot find certificate for \"%s\"", 	                    envelopeOptions.recipients[i]);	    goto loser;	}    }    recipientcerts[i] = NULL;    /* find a nice bulk algorithm */    if (NSS_SMIMEUtil_FindBulkAlgForRecipients(recipientcerts, &bulkalgtag,                                                &keysize) != SECSuccess) {	fprintf(stderr, "ERROR: cannot find common bulk algorithm.\n");	goto loser;    }    /*     * create the message object     */    cmsg = NSS_CMSMessage_Create(NULL); /* create a message on its own pool */    if (cmsg == NULL) {	fprintf(stderr, "ERROR: cannot create CMS message.\n");	goto loser;    }    /*     * build chain of objects: message->envelopedData->data     */    if ((envd = NSS_CMSEnvelopedData_Create(cmsg, bulkalgtag, keysize))           == NULL) {	fprintf(stderr, "ERROR: cannot create CMS envelopedData object.\n");	goto loser;    }    cinfo = NSS_CMSMessage_GetContentInfo(cmsg);    if (NSS_CMSContentInfo_SetContent_EnvelopedData(cmsg, cinfo, envd)           != SECSuccess) {	fprintf(stderr, "ERROR: cannot attach CMS envelopedData object.\n");	goto loser;    }    cinfo = NSS_CMSEnvelopedData_GetContentInfo(envd);    /* we're always passing data in, so the content is NULL */    if (NSS_CMSContentInfo_SetContent_Data(cmsg, cinfo, NULL, PR_FALSE)           != SECSuccess) {	fprintf(stderr, "ERROR: cannot attach CMS data object.\n");	goto loser;    }    /*      * create & attach recipient information     */    for (i = 0; recipientcerts[i] != NULL; i++) {	if ((recipientinfo = NSS_CMSRecipientInfo_Create(cmsg, 	                                                 recipientcerts[i])) 	      == NULL) {	    fprintf(stderr, "ERROR: cannot create CMS recipientInfo object.\n");	    goto loser;	}	if (NSS_CMSEnvelopedData_AddRecipient(envd, recipientinfo) 	      != SECSuccess) {	    fprintf(stderr, "ERROR: cannot add CMS recipientInfo object.\n");	    goto loser;	}    }    if (tmppoolp)	PORT_FreeArena(tmppoolp, PR_FALSE);    return cmsg;loser:    if (cmsg)	NSS_CMSMessage_Destroy(cmsg);    if (tmppoolp)	PORT_FreeArena(tmppoolp, PR_FALSE);    return NULL;}