/* * NSS_CMSDigestedData_Encode_BeforeData - do all the necessary things to a DigestedData * before the encapsulated data is passed through the encoder. * * In detail: * - set up the digests if necessary */ SECStatus NSS_CMSDigestedData_Encode_BeforeData(NSSCMSDigestedData *digd) { /* set up the digests */ if (digd->digestAlg.algorithm.len != 0 && digd->digest.len == 0) { /* if digest is already there, do nothing */ digd->contentInfo.digcx = NSS_CMSDigestContext_StartSingle(&(digd->digestAlg)); if (digd->contentInfo.digcx == NULL) return SECFailure; } return SECSuccess; }
/* * NSS_CMSDigestedData_Decode_BeforeData - do all the necessary things to a DigestedData * before the encapsulated data is passed through the encoder. * * In detail: * - set up the digests if necessary */ SECStatus NSS_CMSDigestedData_Decode_BeforeData(NSSCMSDigestedData *digd) { /* is there a digest algorithm yet? */ if (digd->digestAlg.algorithm.len == 0) return SECFailure; digd->contentInfo.digcx = NSS_CMSDigestContext_StartSingle(&(digd->digestAlg)); if (digd->contentInfo.digcx == NULL) return SECFailure; return SECSuccess; }
/* * NSS_CMSDigestedData_Decode_BeforeData - do all the necessary things to a DigestedData * before the encapsulated data is passed through the encoder. * * In detail: * - set up the digests if necessary */ SECStatus NSS_CMSDigestedData_Decode_BeforeData(NSSCMSDigestedData *digd) { SECStatus rv; /* is there a digest algorithm yet? */ if (digd->digestAlg.algorithm.len == 0) return SECFailure; rv = NSS_CMSContentInfo_Private_Init(&digd->contentInfo); if (rv != SECSuccess) { return SECFailure; } digd->contentInfo.privateInfo->digcx = NSS_CMSDigestContext_StartSingle(&(digd->digestAlg)); if (digd->contentInfo.privateInfo->digcx == NULL) return SECFailure; return SECSuccess; }