diff options
author | ddrinan%netscape.com <devnull@localhost> | 2001-10-23 02:33:19 +0000 |
---|---|---|
committer | ddrinan%netscape.com <devnull@localhost> | 2001-10-23 02:33:19 +0000 |
commit | f05d9e35b3f08e7b6b2716ae698f50a0d22760fc (patch) | |
tree | 4fed3b66c28c6f8012aba8b8da1babbce76cc5ca | |
parent | 33d2a127673dd4e02fb8389d336e1daefc275cfe (diff) | |
download | nss-hg-f05d9e35b3f08e7b6b2716ae698f50a0d22760fc.tar.gz |
smime bug fixes
-rw-r--r-- | security/nss/lib/smime/cmssigdata.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/security/nss/lib/smime/cmssigdata.c b/security/nss/lib/smime/cmssigdata.c index dc3744928..34c36284f 100644 --- a/security/nss/lib/smime/cmssigdata.c +++ b/security/nss/lib/smime/cmssigdata.c @@ -737,18 +737,31 @@ NSS_CMSSignedData_SetDigestValue(NSSCMSSignedData *sigd, SECItem *digest = NULL; PLArenaPool *poolp; void *mark; - int n; + int n, cnt; poolp = sigd->cmsg->poolp; mark = PORT_ArenaMark(poolp); + if (digestdata) { + digest = (SECItem *) PORT_ArenaZAlloc(poolp,sizeof(SECItem)); + /* copy digestdata item to arena (in case we have it and are not only making room) */ if (SECITEM_CopyItem(poolp, digest, digestdata) != SECSuccess) goto loser; } + /* now allocate one (same size as digestAlgorithms) */ + if (sigd->digests == NULL) { + cnt = NSS_CMSArray_Count((void **)sigd->digestAlgorithms); + sigd->digests = PORT_ArenaZAlloc(sigd->cmsg->poolp, (cnt + 1) * sizeof(SECItem *)); + if (sigd->digests == NULL) { + PORT_SetError(SEC_ERROR_NO_MEMORY); + return SECFailure; + } + } + n = -1; if (sigd->digestAlgorithms != NULL) n = NSS_CMSAlgArray_GetIndexByAlgTag(sigd->digestAlgorithms, digestalgtag); |