Replace NSS with Pale Moon's

This commit is contained in:
wuggy 2026-06-29 21:29:25 +01:00
commit 8c2e376f94
2870 changed files with 1762232 additions and 1374220 deletions

View file

@ -26,8 +26,6 @@ include $(CORE_DEPTH)/coreconf/config.mk
# (4) Include "local" platform-dependent assignments (OPTIONAL). #
#######################################################################
-include config.mk
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
@ -44,5 +42,4 @@ include $(CORE_DEPTH)/coreconf/rules.mk
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################
export:: private_export

View file

@ -1035,7 +1035,7 @@ CERT_CertChainFromCert(CERTCertificate *cert, SECCertUsage usage,
NSSCertificate *stanCert;
PLArenaPool *arena;
NSSUsage nssUsage;
int i, len;
int i = 0, len;
NSSTrustDomain *td = STAN_GetDefaultTrustDomain();
NSSCryptoContext *cc = STAN_GetDefaultCryptoContext();
@ -1072,7 +1072,6 @@ CERT_CertChainFromCert(CERTCertificate *cert, SECCertUsage usage,
chain->certs = (SECItem *)PORT_ArenaAlloc(arena, len * sizeof(SECItem));
if (!chain->certs)
goto loser;
i = 0;
stanCert = stanChain[i];
while (stanCert) {
SECItem derCert;
@ -1084,7 +1083,7 @@ CERT_CertChainFromCert(CERTCertificate *cert, SECCertUsage usage,
derCert.data = (unsigned char *)stanCert->encoding.data;
derCert.type = siBuffer;
if (SECITEM_CopyItem(arena, &chain->certs[i], &derCert) != SECSuccess) {
CERT_DestroyCertificate(cCert);
/* loser: will release stanChain[i]; don't release it here too. */
goto loser;
}
stanCert = stanChain[++i];
@ -1106,7 +1105,9 @@ CERT_CertChainFromCert(CERTCertificate *cert, SECCertUsage usage,
nss_ZFreeIf(stanChain);
return chain;
loser:
i = 0;
/* Release only the chain entries not already released by the copy
* loop above; entries 0..i-1 have already had their BuildChain
* reference dropped, so start at i to avoid an over-release. */
stanCert = stanChain[i];
while (stanCert) {
CERTCertificate *cCert = STAN_GetCERTCertificate(stanCert);

View file

@ -65,14 +65,11 @@ checkKeyParams(const SECAlgorithmID *sigAlgorithm, const SECKEYPublicKey *key)
!(policyFlags & NSS_USE_ALG_IN_CERT_SIGNATURE)) {
PORT_SetError(SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED);
return SECFailure;
} else {
return SECSuccess;
}
} else {
PORT_SetError(SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE);
return SECFailure;
return SECSuccess;
}
return SECSuccess;
PORT_SetError(SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE);
return SECFailure;
case SEC_OID_PKCS1_RSA_PSS_SIGNATURE: {
PORTCheapArenaPool tmpArena;
@ -465,7 +462,7 @@ static const unsigned char CAWoSignRootDN[72] = {
0x57, 0x6F, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x43, 0x41, 0x20, 0x4C, 0x69, 0x6D,
0x69, 0x74, 0x65, 0x64, 0x31, 0x1B, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03,
0x0C, 0x12, 0x43, 0x41, 0x20, 0xE6, 0xB2, 0x83, 0xE9, 0x80, 0x9A, 0xE6, 0xA0,
0xB9, 0xE8, 0xAF, 0x81, 0xE4, 0xB9, 0xA6,
0xB9, 0xE8, 0xAF, 0x81, 0xE4, 0xB9, 0xA6
};
/* /C=CN/O=WoSign CA Limited/CN=CA WoSign ECC Root */
@ -475,7 +472,7 @@ static const unsigned char CAWoSignECCRootDN[72] = {
0x57, 0x6F, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x43, 0x41, 0x20, 0x4C, 0x69, 0x6D,
0x69, 0x74, 0x65, 0x64, 0x31, 0x1B, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03,
0x13, 0x12, 0x43, 0x41, 0x20, 0x57, 0x6F, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x45,
0x43, 0x43, 0x20, 0x52, 0x6F, 0x6F, 0x74,
0x43, 0x43, 0x20, 0x52, 0x6F, 0x6F, 0x74
};
/* /C=CN/O=WoSign CA Limited/CN=Certification Authority of WoSign */
@ -486,7 +483,7 @@ static const unsigned char CertificationAuthorityofWoSignDN[87] = {
0x69, 0x74, 0x65, 0x64, 0x31, 0x2A, 0x30, 0x28, 0x06, 0x03, 0x55, 0x04, 0x03,
0x13, 0x21, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6F, 0x6E, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x20,
0x6F, 0x66, 0x20, 0x57, 0x6F, 0x53, 0x69, 0x67, 0x6E,
0x6F, 0x66, 0x20, 0x57, 0x6F, 0x53, 0x69, 0x67, 0x6E
};
/* /C=CN/O=WoSign CA Limited/CN=Certification Authority of WoSign G2 */
@ -497,7 +494,7 @@ static const unsigned char CertificationAuthorityofWoSignG2DN[90] = {
0x69, 0x74, 0x65, 0x64, 0x31, 0x2D, 0x30, 0x2B, 0x06, 0x03, 0x55, 0x04, 0x03,
0x13, 0x24, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6F, 0x6E, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x20,
0x6F, 0x66, 0x20, 0x57, 0x6F, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x47, 0x32,
0x6F, 0x66, 0x20, 0x57, 0x6F, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x47, 0x32
};
/* /C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Certification Authority */
@ -511,7 +508,7 @@ static const unsigned char StartComCertificationAuthorityDN[127] = {
0x69, 0x67, 0x6E, 0x69, 0x6E, 0x67, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03, 0x55,
0x04, 0x03, 0x13, 0x20, 0x53, 0x74, 0x61, 0x72, 0x74, 0x43, 0x6F, 0x6D, 0x20,
0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E,
0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79,
0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79
};
/* /C=IL/O=StartCom Ltd./CN=StartCom Certification Authority G2 */
@ -522,7 +519,7 @@ static const unsigned char StartComCertificationAuthorityG2DN[85] = {
0x31, 0x2C, 0x30, 0x2A, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x23, 0x53, 0x74,
0x61, 0x72, 0x74, 0x43, 0x6F, 0x6D, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66,
0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F,
0x72, 0x69, 0x74, 0x79, 0x20, 0x47, 0x32,
0x72, 0x69, 0x74, 0x79, 0x20, 0x47, 0x32
};
struct DataAndLength {
@ -725,7 +722,7 @@ cert_VerifyCertChainOld(CERTCertDBHandle *handle, CERTCertificate *cert,
certsList = tmpCertsList;
}
for (i = 0; i < subjectNameListLen; i++) {
certsList[namesCount + i] = subjectCert;
certsList[namesCount + i] = CERT_DupCertificate(subjectCert);
}
namesCount += subjectNameListLen;
namesList = cert_CombineNamesLists(namesList, subjectNameList);
@ -737,6 +734,16 @@ cert_VerifyCertChainOld(CERTCertDBHandle *handle, CERTCertificate *cert,
LOG_ERROR_OR_EXIT(log, subjectCert, count, 0);
}
/* check that the signatureAlgorithm field of the certificate
* matches the signature field of the tbsCertificate */
if (SECOID_CompareAlgorithmID(
&subjectCert->signatureWrap.signatureAlgorithm,
&subjectCert->signature)) {
PORT_SetError(SEC_ERROR_ALGORITHM_MISMATCH);
LOG_ERROR(log, subjectCert, count, 0);
goto loser;
}
/* find the certificate of the issuer */
issuerCert = CERT_FindCertIssuer(subjectCert, t, certUsage);
if (!issuerCert) {
@ -972,6 +979,11 @@ loser:
rv = SECFailure;
done:
if (certsList != NULL) {
for (int i = 0; i < namesCount; i++) {
if (certsList[i]) {
CERT_DestroyCertificate(certsList[i]);
}
}
PORT_Free(certsList);
}
if (issuerCert) {
@ -1903,15 +1915,19 @@ CERT_GetCertNicknameWithValidity(PLArenaPool *arena, CERTCertificate *cert,
{
SECCertTimeValidity validity;
char *nickname = NULL, *tmpstr = NULL;
const char *srcNickname = cert->nickname;
if (!srcNickname) {
srcNickname = "{???}";
}
validity = CERT_CheckCertValidTimes(cert, PR_Now(), PR_FALSE);
/* if the cert is good, then just use the nickname directly */
if (validity == secCertTimeValid) {
if (arena == NULL) {
nickname = PORT_Strdup(cert->nickname);
nickname = PORT_Strdup(srcNickname);
} else {
nickname = PORT_ArenaStrdup(arena, cert->nickname);
nickname = PORT_ArenaStrdup(arena, srcNickname);
}
if (nickname == NULL) {
@ -1923,11 +1939,11 @@ CERT_GetCertNicknameWithValidity(PLArenaPool *arena, CERTCertificate *cert,
* end
*/
if (validity == secCertTimeExpired) {
tmpstr = PR_smprintf("%s%s", cert->nickname,
tmpstr = PR_smprintf("%s%s", srcNickname,
expiredString);
} else if (validity == secCertTimeNotValidYet) {
/* not yet valid */
tmpstr = PR_smprintf("%s%s", cert->nickname,
tmpstr = PR_smprintf("%s%s", srcNickname,
notYetGoodString);
} else {
/* undetermined */
@ -2122,6 +2138,7 @@ CERT_GetCertChainFromCert(CERTCertificate *cert, PRTime time, SECCertUsage usage
chain = CERT_NewCertList();
if (NULL == chain) {
CERT_DestroyCertificate(cert);
PORT_SetError(SEC_ERROR_NO_MEMORY);
return NULL;
}
@ -2129,6 +2146,7 @@ CERT_GetCertChainFromCert(CERTCertificate *cert, PRTime time, SECCertUsage usage
while (cert != NULL && ++count <= CERT_MAX_CERT_CHAIN) {
if (SECSuccess != CERT_AddCertToListTail(chain, cert)) {
/* return partial chain */
CERT_DestroyCertificate(cert);
PORT_SetError(SEC_ERROR_NO_MEMORY);
return chain;
}
@ -2142,6 +2160,7 @@ CERT_GetCertChainFromCert(CERTCertificate *cert, PRTime time, SECCertUsage usage
}
/* return partial chain */
CERT_DestroyCertificate(cert);
PORT_SetError(SEC_ERROR_UNKNOWN_ISSUER);
return chain;
}

View file

@ -411,7 +411,7 @@ cleanup:
static PKIX_Error *
cert_CreatePkixProcessingParams(
CERTCertificate *cert,
PRBool checkSig, /* not used yet. See bug 391476 */
PRBool checkSig,
PRTime time,
void *wincx,
PRBool useArena,
@ -441,15 +441,12 @@ cert_CreatePkixProcessingParams(
*pplContext = plContext;
#ifdef PKIX_NOTDEF
/* Functions should be implemented in patch for 390532 */
PKIX_CHECK(
pkix_pl_NssContext_SetCertSignatureCheck(checkSig,
(PKIX_PL_NssContext *)plContext),
PKIX_NSSCONTEXTSETCERTSIGNCHECKFAILED);
#endif /* PKIX_NOTDEF */
PKIX_CHECK(
PKIX_ProcessingParams_Create(&procParams, plContext),
PKIX_PROCESSINGPARAMSCREATEFAILED);
@ -820,6 +817,8 @@ cert_PkixErrorToNssCode(
void *plContext)
{
int errLevel = 0;
(void)errLevel; /* Suppress unused var warning (Bug 1738028) */
PKIX_Int32 nssErr = 0;
PKIX_Error *errPtr = error;
@ -836,11 +835,9 @@ cert_PkixErrorToNssCode(
}
if (pkixLog) {
#ifdef PKIX_ERROR_DESCRIPTION
PR_LOG(pkixLog, 2, ("Error at level %d: %s\n", errLevel,
PKIX_ErrorText[errPtr->errCode]));
PR_LOG(pkixLog, 2, ("Error at level %d: %s\n", errLevel, PKIX_ErrorText[errPtr->errCode]));
#else
PR_LOG(pkixLog, 2, ("Error at level %d: Error code %d\n", errLevel,
errPtr->errCode));
PR_LOG(pkixLog, 2, ("Error at level %d: Error code %d\n", errLevel, errPtr->errCode));
#endif /* PKIX_ERROR_DESCRIPTION */
}
errPtr = errPtr->cause;

View file

@ -1,15 +0,0 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Override TARGETS variable so that only static libraries
# are specifed as dependencies within rules.mk.
#
TARGETS = $(LIBRARY)
SHARED_LIBRARY =
IMPORT_LIBRARY =
PROGRAM =

View file

@ -29,6 +29,7 @@ CSRCS = \
$(NULL)
LIBRARY_NAME = certhi
SHARED_LIBRARY = $(NULL)
# This part of the code, including all sub-dirs, can be optimized for size
export ALLOW_OPT_CODE_SIZE = 1

View file

@ -146,8 +146,7 @@ cert_DupOCSPCertID(const CERTOCSPCertID *src);
#define OCSP_TRACE_CERT(cert) dumpCertificate(cert)
#define OCSP_TRACE_CERTID(certid) dumpCertID(certid)
#if defined(XP_UNIX) || defined(XP_WIN32) || defined(XP_BEOS) || \
defined(XP_MACOSX)
#if defined(XP_UNIX) || defined(XP_WIN32) || defined(XP_MACOSX)
#define NSS_HAVE_GETENV 1
#endif
@ -2600,7 +2599,7 @@ ocsp_DecodeResponseBytes(PLArenaPool *arena, ocspResponseBytes *rbytes)
rbytes->decodedResponse.basic = basicResponse;
} break;
/*
/*
* Add new/future response types here.
*/