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
This commit is contained in:
nelsonb%netscape.com 2003-12-04 00:35:02 +00:00
Родитель d0960c05d3
Коммит 8a0ca297e4
1 изменённых файлов: 13 добавлений и 9 удалений

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

@ -34,7 +34,7 @@
/* /*
* CMS digestedData methods. * CMS digestedData methods.
* *
* $Id: cmsdigdata.c,v 1.3 2002/01/25 19:08:17 relyea%netscape.com Exp $ * $Id: cmsdigdata.c,v 1.4 2003/12/04 00:35:02 nelsonb%netscape.com Exp $
*/ */
#include "cmslocal.h" #include "cmslocal.h"
@ -151,15 +151,17 @@ NSS_CMSDigestedData_Encode_BeforeData(NSSCMSDigestedData *digd)
SECStatus SECStatus
NSS_CMSDigestedData_Encode_AfterData(NSSCMSDigestedData *digd) NSS_CMSDigestedData_Encode_AfterData(NSSCMSDigestedData *digd)
{ {
SECStatus rv = SECSuccess;
/* did we have digest calculation going on? */ /* did we have digest calculation going on? */
if (digd->contentInfo.digcx) { if (digd->contentInfo.digcx) {
if (NSS_CMSDigestContext_FinishSingle(digd->contentInfo.digcx, rv = NSS_CMSDigestContext_FinishSingle(digd->contentInfo.digcx,
digd->cmsg->poolp, &(digd->digest)) != SECSuccess) digd->cmsg->poolp,
return SECFailure; /* error has been set by NSS_CMSDigestContext_FinishSingle */ &(digd->digest));
/* error has been set by NSS_CMSDigestContext_FinishSingle */
digd->contentInfo.digcx = NULL; digd->contentInfo.digcx = NULL;
} }
return SECSuccess; return rv;
} }
/* /*
@ -193,15 +195,17 @@ NSS_CMSDigestedData_Decode_BeforeData(NSSCMSDigestedData *digd)
SECStatus SECStatus
NSS_CMSDigestedData_Decode_AfterData(NSSCMSDigestedData *digd) NSS_CMSDigestedData_Decode_AfterData(NSSCMSDigestedData *digd)
{ {
SECStatus rv = SECSuccess;
/* did we have digest calculation going on? */ /* did we have digest calculation going on? */
if (digd->contentInfo.digcx) { if (digd->contentInfo.digcx) {
if (NSS_CMSDigestContext_FinishSingle(digd->contentInfo.digcx, rv = NSS_CMSDigestContext_FinishSingle(digd->contentInfo.digcx,
digd->cmsg->poolp, &(digd->cdigest)) != SECSuccess) digd->cmsg->poolp,
return SECFailure; /* error has been set by NSS_CMSDigestContext_FinishSingle */ &(digd->cdigest));
/* error has been set by NSS_CMSDigestContext_FinishSingle */
digd->contentInfo.digcx = NULL; digd->contentInfo.digcx = NULL;
} }
return SECSuccess; return rv;
} }
/* /*