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

@ -96,8 +96,8 @@ SECMOD_Shutdown()
return SECSuccess;
}
int
secmod_GetSystemFIPSEnabled(void)
PRBool
SECMOD_GetSystemFIPSEnabled(void)
{
#ifdef LINUX
#ifndef NSS_FIPS_DISABLED
@ -107,20 +107,20 @@ secmod_GetSystemFIPSEnabled(void)
f = fopen("/proc/sys/crypto/fips_enabled", "r");
if (!f) {
return 0;
return PR_FALSE;
}
size = fread(&d, 1, sizeof(d), f);
fclose(f);
if (size != sizeof(d)) {
return 0;
return PR_FALSE;
}
if (d == '1') {
return 1;
return PR_TRUE;
}
#endif
#endif
return 0;
return PR_FALSE;
}
/*
@ -452,11 +452,13 @@ SECMOD_DeleteModule(const char *name, int *type)
SECStatus
SECMOD_DeleteInternalModule(const char *name)
{
#ifndef NSS_FIPS_DISABLED
SECMODModuleList *mlp;
SECMODModuleList **mlpp;
#endif
SECStatus rv = SECFailure;
if (secmod_GetSystemFIPSEnabled() || pendingModule) {
if (SECMOD_GetSystemFIPSEnabled() || pendingModule) {
PORT_SetError(SEC_ERROR_MODULE_STUCK);
return rv;
}
@ -468,8 +470,7 @@ SECMOD_DeleteInternalModule(const char *name)
#ifdef NSS_FIPS_DISABLED
PORT_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR);
return rv;
#endif
#else
SECMOD_GetWriteLock(moduleLock);
for (mlpp = &modules, mlp = modules;
mlp != NULL; mlpp = &mlp->next, mlp = *mlpp) {
@ -541,6 +542,7 @@ SECMOD_DeleteInternalModule(const char *name)
internalModule = newModule; /* adopt the module */
}
return rv;
#endif
}
SECStatus
@ -991,7 +993,7 @@ SECMOD_CanDeleteInternalModule(void)
#ifdef NSS_FIPS_DISABLED
return PR_FALSE;
#else
return (PRBool)((pendingModule == NULL) && !secmod_GetSystemFIPSEnabled());
return (PRBool)((pendingModule == NULL) && !SECMOD_GetSystemFIPSEnabled());
#endif
}
@ -1002,6 +1004,8 @@ SECMOD_CanDeleteInternalModule(void)
* C_GetSlotList(flag, &data, &count) so that the array doesn't accidently
* grow on the caller. It is permissible for the slots to increase between
* successive calls with NULL to get the size.
*
* Caller must not hold a module list read lock.
*/
SECStatus
SECMOD_UpdateSlotList(SECMODModule *mod)
@ -1344,14 +1348,27 @@ loser:
PRBool
SECMOD_HasRemovableSlots(SECMODModule *mod)
{
int i;
PRBool ret = PR_FALSE;
if (!moduleLock) {
PORT_SetError(SEC_ERROR_NOT_INITIALIZED);
return ret;
}
SECMOD_GetReadLock(moduleLock);
ret = SECMOD_LockedModuleHasRemovableSlots(mod);
SECMOD_ReleaseReadLock(moduleLock);
return ret;
}
PRBool
SECMOD_LockedModuleHasRemovableSlots(SECMODModule *mod)
{
int i;
PRBool ret;
if (mod->slotCount == 0) {
return PR_TRUE;
}
ret = PR_FALSE;
for (i = 0; i < mod->slotCount; i++) {
PK11SlotInfo *slot = mod->slots[i];
/* perm modules are not inserted or removed */
@ -1361,10 +1378,6 @@ SECMOD_HasRemovableSlots(SECMODModule *mod)
ret = PR_TRUE;
break;
}
if (mod->slotCount == 0) {
ret = PR_TRUE;
}
SECMOD_ReleaseReadLock(moduleLock);
return ret;
}
@ -1382,7 +1395,7 @@ secmod_UserDBOp(PK11SlotInfo *slot, CK_OBJECT_CLASS objClass,
PK11_SETATTRS(attrs, CKA_CLASS, &objClass, sizeof(objClass));
attrs++;
PK11_SETATTRS(attrs, CKA_NETSCAPE_MODULE_SPEC, (unsigned char *)sendSpec,
PK11_SETATTRS(attrs, CKA_NSS_MODULE_SPEC, (unsigned char *)sendSpec,
strlen(sendSpec) + 1);
attrs++;
@ -1496,7 +1509,7 @@ SECMOD_OpenNewSlot(SECMODModule *mod, const char *moduleSpec)
PORT_SetError(SEC_ERROR_NO_MEMORY);
return NULL;
}
rv = secmod_UserDBOp(slot, CKO_NETSCAPE_NEWSLOT, sendSpec);
rv = secmod_UserDBOp(slot, CKO_NSS_NEWSLOT, sendSpec);
PR_smprintf_free(sendSpec);
PK11_FreeSlot(slot);
if (rv != SECSuccess) {
@ -1638,7 +1651,7 @@ SECMOD_CloseUserDB(PK11SlotInfo *slot)
PORT_SetError(SEC_ERROR_NO_MEMORY);
return SECFailure;
}
rv = secmod_UserDBOp(slot, CKO_NETSCAPE_DELSLOT, sendSpec);
rv = secmod_UserDBOp(slot, CKO_NSS_DELSLOT, sendSpec);
PR_smprintf_free(sendSpec);
/* if we are in the delay period for the "isPresent" call, reset
* the delay since we know things have probably changed... */