mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 15:27:32 +09:00
Replace NSS with Pale Moon's
This commit is contained in:
parent
ff1e5e48bf
commit
8c2e376f94
2870 changed files with 1762232 additions and 1374220 deletions
|
|
@ -13,7 +13,7 @@
|
|||
#include "prlink.h"
|
||||
|
||||
/*
|
||||
* define XP_WIN, XP_BEOS, or XP_UNIX, in case they are not defined
|
||||
* define XP_WIN, or XP_UNIX, in case they are not defined
|
||||
* by anyone else
|
||||
*/
|
||||
#ifdef _WINDOWS
|
||||
|
|
@ -27,12 +27,6 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
#ifndef XP_BEOS
|
||||
#define XP_BEOS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef unix
|
||||
#ifndef XP_UNIX
|
||||
#define XP_UNIX
|
||||
|
|
@ -126,6 +120,15 @@ SEC_END_PROTOS
|
|||
* ignored. See more details in Bug 1588015. */
|
||||
#define PORT_AssertArg PR_ASSERT_ARG
|
||||
|
||||
/* Assert the current location can't be reached, passing a reason-string. */
|
||||
#define PORT_AssertNotReached(reasonStr) PR_NOT_REACHED(reasonStr)
|
||||
|
||||
/* macros to handle endian based byte conversion */
|
||||
#define PORT_GET_BYTE_BE(value, offset, len) \
|
||||
((unsigned char)(((len) - (offset)-1) >= sizeof(value) ? 0 : (((value) >> (((len) - (offset)-1) * PR_BITS_PER_BYTE)) & 0xff)))
|
||||
#define PORT_GET_BYTE_LE(value, offset, len) \
|
||||
((unsigned char)((offset) > sizeof(value) ? 0 : (((value) >> ((offset)*PR_BITS_PER_BYTE)) & 0xff)))
|
||||
|
||||
/* This runs a function that should return SECSuccess.
|
||||
* Intended for NSS internal use only.
|
||||
* The return value is asserted in a debug build, otherwise it is ignored.
|
||||
|
|
@ -258,6 +261,7 @@ extern int NSS_PutEnv(const char *envVarName, const char *envValue);
|
|||
|
||||
extern int NSS_SecureMemcmp(const void *a, const void *b, size_t n);
|
||||
extern unsigned int NSS_SecureMemcmpZero(const void *mem, size_t n);
|
||||
extern void NSS_SecureSelect(void *dest, const void *src0, const void *src1, size_t n, unsigned char b);
|
||||
|
||||
/*
|
||||
* Load a shared library called "newShLibName" in the same directory as
|
||||
|
|
@ -296,4 +300,69 @@ PORT_LoadLibraryFromOrigin(const char *existingShLibName,
|
|||
|
||||
SEC_END_PROTOS
|
||||
|
||||
/*
|
||||
* Constant time macros
|
||||
*/
|
||||
/* These macros use the fact that arithmetic shift shifts-in the sign bit.
|
||||
* However, this is not ensured by the C standard so you may need to replace
|
||||
* them with something else for odd compilers. These macros work for object
|
||||
* sizes up to 32 bits. The inequalities will produce incorrect results if
|
||||
* abs(a-b) >= PR_UINT32_MAX/2. This can be a voided if unsigned values stay
|
||||
* within the range 0-PRUINT32_MAX/2 and signed values stay within the range
|
||||
* -PRINT32_MAX/2-PRINT32_MAX/2. If these are insufficient, we can fix
|
||||
* this by either expanding the PORT_CT_DUPLICATE_MSB_TO_ALL to PRUint64
|
||||
* or by creating the following new macros for inequality:
|
||||
*
|
||||
* PORT_CT_OVERFLOW prevents the overflow condition by handling the case
|
||||
* where the high bits in a and b are different specially. Basically if
|
||||
* the high bit in a and b differs we can just
|
||||
* copy the high bit of one of the parameters to determine the result as
|
||||
* follows:
|
||||
* GxU if a has the high bit on, a>b, so d=a
|
||||
* LxU if b has the high bit on, a<b, so d=b
|
||||
* GxS if b has the high bit on, it's negative a>b so d=b
|
||||
* LxS if a has the high bit on, it's negative a<b so d=a
|
||||
* where PORT_CT_xxU() macros do unsigned compares and PORT_CT_xxS() do signed
|
||||
* compares.
|
||||
*
|
||||
* #define PORT_CT_OVERFLOW(a,b,c,d) \
|
||||
* PORT_CT_SEL(PORT_CT_DUPLICATE_MSB_TO_ALL((a)^(b)), \
|
||||
* (PORT_CT_DUPLICATE_MSB_TO_ALL(d)),c)
|
||||
* #define PORT_CT_GTU(a,b) PORT_CT_OVERFLOW(a,b,PORT_CT_GT(a,b),a)
|
||||
* #define PORT_CT_LTU(a,b) PORT_CT_OVERFLOW(a,b,PORT_CT_LT(a,b),b)
|
||||
* #define PORT_CT_GEU(a,b) PORT_CT_OVERFLOW(a,b,PORT_CT_GE(a,b),a)
|
||||
* #define PORT_CT_LEU(a,b) PORT_CT_OVERFLOW(a,b,PORT_CT_LE(a,b),b)
|
||||
* #define PORT_CT_GTS(a,b) PORT_CT_OVERFLOW(a,b,PORT_CT_GT(a,b),b)
|
||||
* #define PORT_CT_LTS(a,b) PORT_CT_OVERFLOW(a,b,PORT_CT_LT(a,b),a)
|
||||
* #define PORT_CT_GES(a,b) PORT_CT_OVERFLOW(a,b,PORT_CT_GE(a,b),b)
|
||||
* #define PORT_CT_LES(a,b) PORT_CT_OVERFLOW(a,b,PORT_CT_LE(a,b),a)
|
||||
*
|
||||
*
|
||||
* */
|
||||
/* Constant-time helper macro that copies the MSB of x to all other bits. */
|
||||
#define PORT_CT_DUPLICATE_MSB_TO_ALL(x) ((PRUint32)((PRInt32)(x) >> (sizeof(PRInt32) * 8 - 1)))
|
||||
|
||||
/* Constant-time helper macro that selects l or r depending on all-1 or all-0
|
||||
* mask m */
|
||||
#define PORT_CT_SEL(m, l, r) (((m) & (l)) | (~(m) & (r)))
|
||||
|
||||
/* Constant-time helper macro that returns all-1s if x is not 0; and all-0s
|
||||
* otherwise. */
|
||||
#define PORT_CT_NOT_ZERO(x) (PORT_CT_DUPLICATE_MSB_TO_ALL(((x) | (0 - (x)))))
|
||||
|
||||
/* Constant-time helper macro that returns all-1s if x is 0; and all-0s
|
||||
* otherwise. */
|
||||
#define PORT_CT_ZERO(x) (~PORT_CT_DUPLICATE_MSB_TO_ALL(((x) | (0 - (x)))))
|
||||
|
||||
/* Constant-time helper macro for equalities and inequalities.
|
||||
* returns all-1's for true and all-0's for false */
|
||||
#define PORT_CT_EQ(a, b) PORT_CT_ZERO(((a) - (b)))
|
||||
#define PORT_CT_NE(a, b) PORT_CT_NOT_ZERO(((a) - (b)))
|
||||
#define PORT_CT_GT(a, b) PORT_CT_DUPLICATE_MSB_TO_ALL((b) - (a))
|
||||
#define PORT_CT_LT(a, b) PORT_CT_DUPLICATE_MSB_TO_ALL((a) - (b))
|
||||
#define PORT_CT_GE(a, b) (~PORT_CT_LT(a, b))
|
||||
#define PORT_CT_LE(a, b) (~PORT_CT_GT(a, b))
|
||||
#define PORT_CT_TRUE (~0)
|
||||
#define PORT_CT_FALSE 0
|
||||
|
||||
#endif /* _SECPORT_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue