[NSS] Update NSS to pick up fixes.

This commit is contained in:
Moonchild 2023-02-19 15:26:44 +01:00 committed by roytam1
commit cdda874cff
4 changed files with 18 additions and 7 deletions

View file

@ -10,4 +10,3 @@
*/ */
#error "Do not include this header file." #error "Do not include this header file."

View file

@ -341,27 +341,38 @@ sec_pkcs12_decoder_safe_bag_update(void *arg, const char *data,
* and that there are no errors. If so, just return rather * and that there are no errors. If so, just return rather
* than continuing to process. * than continuing to process.
*/ */
if (!safeContentsCtx || !safeContentsCtx->p12dcx || if (!safeContentsCtx || !safeContentsCtx->p12dcx || safeContentsCtx->skipCurrentSafeBag) {
safeContentsCtx->p12dcx->error || safeContentsCtx->skipCurrentSafeBag) {
return; return;
} }
p12dcx = safeContentsCtx->p12dcx; p12dcx = safeContentsCtx->p12dcx;
/* make sure that there are no errors and we are not skipping the current safeBag */
if (p12dcx->error || safeContentsCtx->skipCurrentSafeBag) {
goto loser;
}
rv = SEC_ASN1DecoderUpdate(safeContentsCtx->currentSafeBagA1Dcx, data, len); rv = SEC_ASN1DecoderUpdate(safeContentsCtx->currentSafeBagA1Dcx, data, len);
if (rv != SECSuccess) { if (rv != SECSuccess) {
p12dcx->errorValue = PORT_GetError(); p12dcx->errorValue = PORT_GetError();
p12dcx->error = PR_TRUE;
goto loser;
}
/* The update may have set safeContentsCtx->skipCurrentSafeBag, and we
* may not get another opportunity to clean up the decoder context.
*/
if (safeContentsCtx->skipCurrentSafeBag) {
goto loser; goto loser;
} }
return; return;
loser: loser:
/* set the error, and finish the decoder context. because there /* Finish the decoder context. Because there
* is not a way of returning an error message, it may be worth * is not a way of returning an error message, it may be worth
* while to do a check higher up and finish any decoding contexts * while to do a check higher up and finish any decoding contexts
* that are still open. * that are still open.
*/ */
p12dcx->error = PR_TRUE;
SEC_ASN1DecoderFinish(safeContentsCtx->currentSafeBagA1Dcx); SEC_ASN1DecoderFinish(safeContentsCtx->currentSafeBagA1Dcx);
safeContentsCtx->currentSafeBagA1Dcx = NULL; safeContentsCtx->currentSafeBagA1Dcx = NULL;
return; return;

View file

@ -73,6 +73,7 @@ struct sec_PKCS12SafeBagStr {
sec_PKCS12CRLBag *crlBag; sec_PKCS12CRLBag *crlBag;
sec_PKCS12SecretBag *secretBag; sec_PKCS12SecretBag *secretBag;
sec_PKCS12SafeContents *safeContents; sec_PKCS12SafeContents *safeContents;
SECItem *unknownBag;
} safeBagContent; } safeBagContent;
sec_PKCS12Attribute **attribs; sec_PKCS12Attribute **attribs;

View file

@ -30,12 +30,12 @@ sec_pkcs12_choose_safe_bag_type(void *src_or_dest, PRBool encoding)
oiddata = SECOID_FindOID(&safeBag->safeBagType); oiddata = SECOID_FindOID(&safeBag->safeBagType);
if (oiddata == NULL) { if (oiddata == NULL) {
return SEC_ASN1_GET(SEC_AnyTemplate); return SEC_ASN1_GET(SEC_PointerToAnyTemplate);
} }
switch (oiddata->offset) { switch (oiddata->offset) {
default: default:
theTemplate = SEC_ASN1_GET(SEC_AnyTemplate); theTemplate = SEC_ASN1_GET(SEC_PointerToAnyTemplate);
break; break;
case SEC_OID_PKCS12_V1_KEY_BAG_ID: case SEC_OID_PKCS12_V1_KEY_BAG_ID:
theTemplate = SEC_ASN1_GET(SECKEY_PointerToPrivateKeyInfoTemplate); theTemplate = SEC_ASN1_GET(SECKEY_PointerToPrivateKeyInfoTemplate);