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

@ -126,6 +126,8 @@ mpp_random(mp_int *a)
/* }}} */
static mpp_random_fn mpp_random_insecure = &mpp_random;
/* {{{ mpp_random_size(a, prec) */
mp_err
@ -138,7 +140,7 @@ mpp_random_size(mp_int *a, mp_size prec)
if ((res = s_mp_pad(a, prec)) != MP_OKAY)
return res;
return mpp_random(a);
return (*mpp_random_insecure)(a);
} /* end mpp_random_size() */
@ -271,6 +273,12 @@ mpp_fermat_list(mp_int *a, const mp_digit *primes, mp_size nPrimes)
mp_err
mpp_pprime(mp_int *a, int nt)
{
return mpp_pprime_ext_random(a, nt, mpp_random_insecure);
}
mp_err
mpp_pprime_ext_random(mp_int *a, int nt, mpp_random_fn random)
{
mp_err res;
mp_int x, amo, m, z; /* "amo" = "a minus one" */
@ -306,7 +314,7 @@ mpp_pprime(mp_int *a, int nt)
/* Choose a random value for 1 < x < a */
MP_CHECKOK(s_mp_pad(&x, USED(a)));
mpp_random(&x);
MP_CHECKOK((*random)(&x));
MP_CHECKOK(mp_mod(&x, a, &x));
if (mp_cmp_d(&x, 1) <= 0) {
iter--; /* don't count this iteration */
@ -403,6 +411,12 @@ mpp_sieve(mp_int *trial, const mp_digit *primes, mp_size nPrimes,
mp_err
mpp_make_prime(mp_int *start, mp_size nBits, mp_size strong)
{
return mpp_make_prime_ext_random(start, nBits, strong, mpp_random_insecure);
}
mp_err
mpp_make_prime_ext_random(mp_int *start, mp_size nBits, mp_size strong, mpp_random_fn random)
{
mp_digit np;
mp_err res;
@ -490,7 +504,7 @@ mpp_make_prime(mp_int *start, mp_size nBits, mp_size strong)
FPUTC('+', stderr);
/* If that passed, run some Miller-Rabin tests */
res = mpp_pprime(&trial, num_tests);
res = mpp_pprime_ext_random(&trial, num_tests, random);
if (res != MP_OKAY) {
if (res == MP_NO)
continue; /* was composite */
@ -528,7 +542,7 @@ mpp_make_prime(mp_int *start, mp_size nBits, mp_size strong)
}
/* And test with Miller-Rabin, as with its parent ... */
res = mpp_pprime(&q, num_tests);
res = mpp_pprime_ext_random(&q, num_tests, random);
if (res != MP_YES) {
mp_clear(&q);
if (res == MP_NO)