PORT_Assert(signerinfo); PORT_Assert(sigd); if (!sigd || !signerinfo) { PORT_SetError(SEC_ERROR_LIBRARY_FAILURE); return SECFailure; }
NSS_CMSSignedData_AddSignerInfo(NSSCMSSignedData *sigd,				NSSCMSSignerInfo *signerinfo){    void *mark;    SECStatus rv;    SECOidTag digestalgtag;    PLArenaPool *poolp;    poolp = sigd->cmsg->poolp;    mark = PORT_ArenaMark(poolp);    /* add signerinfo */    rv = NSS_CMSArray_Add(poolp, (void ***)&(sigd->signerInfos), (void *)signerinfo);    if (rv != SECSuccess)	goto loser;    /*     * add empty digest     * Empty because we don't have it yet. Either it gets created during encoding     * (if the data is present) or has to be set externally.     * XXX maybe pass it in optionally?     */    digestalgtag = NSS_CMSSignerInfo_GetDigestAlgTag(signerinfo);    rv = NSS_CMSSignedData_SetDigestValue(sigd, digestalgtag, NULL);    if (rv != SECSuccess)	goto loser;    /*     * The last thing to get consistency would be adding the digest.     */    PORT_ArenaUnmark(poolp, mark);    return SECSuccess;loser:    PORT_ArenaRelease (poolp, mark);    return SECFailure;}