mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-25 18:07:31 +09:00
re-introduce old nss im too tired for this
This commit is contained in:
parent
3c46be320d
commit
3a838106b9
2871 changed files with 1374431 additions and 1762417 deletions
|
|
@ -337,7 +337,11 @@ sec_pkcs12_decoder_safe_bag_update(void *arg, const char *data,
|
|||
SEC_PKCS12DecoderContext *p12dcx;
|
||||
SECStatus rv;
|
||||
|
||||
if (!safeContentsCtx || !safeContentsCtx->p12dcx || !safeContentsCtx->currentSafeBagA1Dcx) {
|
||||
/* make sure that we are not skipping the current safeBag,
|
||||
* and that there are no errors. If so, just return rather
|
||||
* than continuing to process.
|
||||
*/
|
||||
if (!safeContentsCtx || !safeContentsCtx->p12dcx || safeContentsCtx->skipCurrentSafeBag) {
|
||||
return;
|
||||
}
|
||||
p12dcx = safeContentsCtx->p12dcx;
|
||||
|
|
@ -1361,10 +1365,32 @@ sec_pkcs12_decoder_verify_mac(SEC_PKCS12DecoderContext *p12dcx)
|
|||
iteration);
|
||||
|
||||
algtag = SECOID_GetAlgorithmTag(&p12dcx->macData.safeMac.digestAlgorithm);
|
||||
integrityMech = sec_pkcs12_algtag_to_keygen_mech(algtag);
|
||||
if (integrityMech == CKM_INVALID_MECHANISM) {
|
||||
goto loser;
|
||||
switch (algtag) {
|
||||
case SEC_OID_SHA1:
|
||||
integrityMech = CKM_NETSCAPE_PBE_SHA1_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_MD5:
|
||||
integrityMech = CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_MD2:
|
||||
integrityMech = CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA224:
|
||||
integrityMech = CKM_NSS_PKCS12_PBE_SHA224_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA256:
|
||||
integrityMech = CKM_NSS_PKCS12_PBE_SHA256_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA384:
|
||||
integrityMech = CKM_NSS_PKCS12_PBE_SHA384_HMAC_KEY_GEN;
|
||||
break;
|
||||
case SEC_OID_SHA512:
|
||||
integrityMech = CKM_NSS_PKCS12_PBE_SHA512_HMAC_KEY_GEN;
|
||||
break;
|
||||
default:
|
||||
goto loser;
|
||||
}
|
||||
|
||||
symKey = PK11_KeyGen(NULL, integrityMech, params, 0, NULL);
|
||||
PK11_DestroyPBEParams(params);
|
||||
params = NULL;
|
||||
|
|
@ -2778,7 +2804,7 @@ SEC_PKCS12DecoderValidateBags(SEC_PKCS12DecoderContext *p12dcx,
|
|||
SEC_PKCS12NicknameCollisionCallback nicknameCb)
|
||||
{
|
||||
SECStatus rv;
|
||||
int i, probCnt, errorVal = 0;
|
||||
int i, noInstallCnt, probCnt, bagCnt, errorVal = 0;
|
||||
if (!p12dcx || p12dcx->error || !p12dcx->safeBags) {
|
||||
PORT_SetError(SEC_ERROR_INVALID_ARGS);
|
||||
return SECFailure;
|
||||
|
|
@ -2789,9 +2815,12 @@ SEC_PKCS12DecoderValidateBags(SEC_PKCS12DecoderContext *p12dcx,
|
|||
p12dcx->bagsVerified = PR_TRUE;
|
||||
}
|
||||
|
||||
probCnt = 0;
|
||||
noInstallCnt = probCnt = bagCnt = 0;
|
||||
i = 0;
|
||||
while (p12dcx->safeBags[i]) {
|
||||
bagCnt++;
|
||||
if (p12dcx->safeBags[i]->noInstall)
|
||||
noInstallCnt++;
|
||||
if (p12dcx->safeBags[i]->problem) {
|
||||
probCnt++;
|
||||
errorVal = p12dcx->safeBags[i]->error;
|
||||
|
|
@ -2799,6 +2828,15 @@ SEC_PKCS12DecoderValidateBags(SEC_PKCS12DecoderContext *p12dcx,
|
|||
i++;
|
||||
}
|
||||
|
||||
/* formerly was erroneous code here that assumed that if all bags
|
||||
* failed to import, then the problem was duplicated data;
|
||||
* that is, it assume that the problem must be that the file had
|
||||
* previously been successfully imported. But importing a
|
||||
* previously imported file causes NO ERRORS at all, and this
|
||||
* false assumption caused real errors to be hidden behind false
|
||||
* errors about duplicated data.
|
||||
*/
|
||||
|
||||
if (probCnt) {
|
||||
PORT_SetError(errorVal);
|
||||
return SECFailure;
|
||||
|
|
@ -3378,7 +3416,8 @@ sec_pkcs12_decoder_create_cert(SEC_PKCS12DecoderContext *p12dcx,
|
|||
|
||||
oid = SECOID_FindOIDByTag(SEC_OID_PKCS12_V1_CERT_BAG_ID);
|
||||
certBag = PORT_ArenaZNew(p12dcx->arena, sec_PKCS12SafeBag);
|
||||
if (!certBag || !oid || (SECITEM_CopyItem(p12dcx->arena, &certBag->safeBagType, &oid->oid) != SECSuccess)) {
|
||||
if (!certBag || !oid || (SECITEM_CopyItem(p12dcx->arena,
|
||||
&certBag->safeBagType, &oid->oid) != SECSuccess)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue