diff options
author | nelsonb%netscape.com <devnull@localhost> | 2003-12-04 00:35:02 +0000 |
---|---|---|
committer | nelsonb%netscape.com <devnull@localhost> | 2003-12-04 00:35:02 +0000 |
commit | d4f785e2ac9034e575001fe202cce20230ad9f6a (patch) | |
tree | 8b22f11ff4c53a35954faf2a19cf6105cdae1cc2 | |
parent | b494394f20fced94e1daa2a1fe58010da6e6e0ee (diff) | |
download | nss-hg-d4f785e2ac9034e575001fe202cce20230ad9f6a.tar.gz |
Functions NSS_CMSDigestedData_Encode_AfterData and
NSS_CMSDigestedData_Decode_AfterData
- Since NSS_CMSDigestContext_FinishSingle always destroys the context,
regardless of whether it returns SECSuccess or SECFailure, these
functions have been changed to always NULL out the context pointer
after calling NSS_CMSDigestContext_FinishSingle, regardless of the
outcome.
Bugscape bug 54208, r=relyea
-rw-r--r-- | security/nss/lib/smime/cmsdigdata.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/security/nss/lib/smime/cmsdigdata.c b/security/nss/lib/smime/cmsdigdata.c index 9d57a5266..23337446f 100644 --- a/security/nss/lib/smime/cmsdigdata.c +++ b/security/nss/lib/smime/cmsdigdata.c @@ -151,15 +151,17 @@ NSS_CMSDigestedData_Encode_BeforeData(NSSCMSDigestedData *digd) SECStatus NSS_CMSDigestedData_Encode_AfterData(NSSCMSDigestedData *digd) { + SECStatus rv = SECSuccess; /* did we have digest calculation going on? */ if (digd->contentInfo.digcx) { - if (NSS_CMSDigestContext_FinishSingle(digd->contentInfo.digcx, - digd->cmsg->poolp, &(digd->digest)) != SECSuccess) - return SECFailure; /* error has been set by NSS_CMSDigestContext_FinishSingle */ + rv = NSS_CMSDigestContext_FinishSingle(digd->contentInfo.digcx, + digd->cmsg->poolp, + &(digd->digest)); + /* error has been set by NSS_CMSDigestContext_FinishSingle */ digd->contentInfo.digcx = NULL; } - return SECSuccess; + return rv; } /* @@ -193,15 +195,17 @@ NSS_CMSDigestedData_Decode_BeforeData(NSSCMSDigestedData *digd) SECStatus NSS_CMSDigestedData_Decode_AfterData(NSSCMSDigestedData *digd) { + SECStatus rv = SECSuccess; /* did we have digest calculation going on? */ if (digd->contentInfo.digcx) { - if (NSS_CMSDigestContext_FinishSingle(digd->contentInfo.digcx, - digd->cmsg->poolp, &(digd->cdigest)) != SECSuccess) - return SECFailure; /* error has been set by NSS_CMSDigestContext_FinishSingle */ + rv = NSS_CMSDigestContext_FinishSingle(digd->contentInfo.digcx, + digd->cmsg->poolp, + &(digd->cdigest)); + /* error has been set by NSS_CMSDigestContext_FinishSingle */ digd->contentInfo.digcx = NULL; } - return SECSuccess; + return rv; } /* |