Skip to content

Commit

Permalink
Allow NSS_CMSDigestContext objects to be created, even when there are
Browse files Browse the repository at this point in the history
no valid digest algorithm OIDs.  This allows "certs only" messages to
be decoded.  Bugzilla bug 228707. r=jpierre, wtc.
  • Loading branch information
nelsonb%netscape.com committed Dec 17, 2003
1 parent 420dc3e commit 608afdc
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions security/nss/lib/smime/cmsdigest.c
Expand Up @@ -78,17 +78,15 @@ NSS_CMSDigestContext_StartMultiple(SECAlgorithmID **digestalgs)
NSSCMSDigestContext *cmsdigcx;
int digcnt;
int i;
int num_digests = 0;

#ifdef CMS_FIND_LEAK_MULTIPLE
PORT_Assert(global_num_digests == 0 || !stop_on_err);
#endif

digcnt = (digestalgs == NULL) ? 0 : NSS_CMSArray_Count((void **)digestalgs);
if (digcnt <= 0) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return NULL;
}
/* It's OK if digcnt is zero. We have to allow this for "certs only"
** messages.
*/
pool = PORT_NewArena(2048);
if (!pool)
return NULL;
Expand Down Expand Up @@ -130,14 +128,12 @@ NSS_CMSDigestContext_StartMultiple(SECAlgorithmID **digestalgs)
(*digobj->begin) (digcx);
cmsdigcx->digPairs[i].digobj = digobj;
cmsdigcx->digPairs[i].digcx = digcx;
num_digests++;
#ifdef CMS_FIND_LEAK_MULTIPLE
global_num_digests++;
#endif
}
}
if (num_digests > 0)
return cmsdigcx;
return cmsdigcx;

loser:
/* no digest objects have been created, or need to be destroyed. */
Expand Down

0 comments on commit 608afdc

Please sign in to comment.