attempt to fix bug 51882 (sig data w/ no signer infos)

This commit is contained in:
mcgreer%netscape.com 2000-09-13 06:15:13 +00:00
Родитель 580046560f
Коммит 3e3eee6676
1 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -34,7 +34,7 @@
/* /*
* CMS signedData methods. * CMS signedData methods.
* *
* $Id: cmssigdata.c,v 1.2 2000/06/13 21:56:31 chrisk%netscape.com Exp $ * $Id: cmssigdata.c,v 1.3 2000/09/13 06:15:13 mcgreer%netscape.com Exp $
*/ */
#include "cmslocal.h" #include "cmslocal.h"
@ -150,9 +150,9 @@ NSS_CMSSignedData_Encode_BeforeStart(NSSCMSSignedData *sigd)
version = NSS_CMS_SIGNED_DATA_VERSION_EXT; version = NSS_CMS_SIGNED_DATA_VERSION_EXT;
signerinfos = sigd->signerInfos; signerinfos = sigd->signerInfos;
/* prepare all the SignerInfos */ /* prepare all the SignerInfos (there may be none) */
for (i = 0; signerinfos[i] != NULL; i++) { while (signerinfos) {
signerinfo = signerinfos[i]; signerinfo = *signerinfos;
/* RFC2630 5.1 "version is the syntax version number..." */ /* RFC2630 5.1 "version is the syntax version number..." */
if (NSS_CMSSignerInfo_GetVersion(signerinfo) != NSS_CMS_SIGNER_INFO_VERSION_ISSUERSN) if (NSS_CMSSignerInfo_GetVersion(signerinfo) != NSS_CMS_SIGNER_INFO_VERSION_ISSUERSN)
@ -175,6 +175,7 @@ NSS_CMSSignedData_Encode_BeforeStart(NSSCMSSignedData *sigd)
} else { } else {
/* found it, nothing to do */ /* found it, nothing to do */
} }
signerinfos++;
} }
dummy = SEC_ASN1EncodeInteger(poolp, &(sigd->version), (long)version); dummy = SEC_ASN1EncodeInteger(poolp, &(sigd->version), (long)version);
@ -225,7 +226,7 @@ NSS_CMSSignedData_Encode_AfterData(NSSCMSSignedData *sigd)
SECStatus rv; SECStatus rv;
SECItem *contentType; SECItem *contentType;
int certcount; int certcount;
int i, ci, cli, n, rci, si; int ci, cli, n, rci, si;
PLArenaPool *poolp; PLArenaPool *poolp;
CERTCertificateList *certlist; CERTCertificateList *certlist;
extern const SEC_ASN1Template NSSCMSSignerInfoTemplate[]; extern const SEC_ASN1Template NSSCMSSignerInfoTemplate[];
@ -244,9 +245,9 @@ NSS_CMSSignedData_Encode_AfterData(NSSCMSSignedData *sigd)
signerinfos = sigd->signerInfos; signerinfos = sigd->signerInfos;
certcount = 0; certcount = 0;
/* prepare all the SignerInfos */ /* prepare all the SignerInfos (there may be none) */
for (i = 0; signerinfos[i] != NULL; i++) { while (signerinfos) {
signerinfo = signerinfos[i]; signerinfo = *signerinfos;
/* find correct digest for this signerinfo */ /* find correct digest for this signerinfo */
digestalgtag = NSS_CMSSignerInfo_GetDigestAlgTag(signerinfo); digestalgtag = NSS_CMSSignerInfo_GetDigestAlgTag(signerinfo);
@ -274,6 +275,7 @@ NSS_CMSSignedData_Encode_AfterData(NSSCMSSignedData *sigd)
certlist = NSS_CMSSignerInfo_GetCertList(signerinfo); certlist = NSS_CMSSignerInfo_GetCertList(signerinfo);
if (certlist) if (certlist)
certcount += certlist->len; certcount += certlist->len;
signerinfos++;
} }
/* this is a SET OF, so we need to sort them guys */ /* this is a SET OF, so we need to sort them guys */