summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorJohn M. Schanck <jschanck@mozilla.com>2022-03-22 17:01:16 +0000
committerJohn M. Schanck <jschanck@mozilla.com>2022-03-22 17:01:16 +0000
commita969fc161e573d67d30990bd014942ab7829ac6c (patch)
tree8eb110332ceba19a16c2d893f310448f1cc9977f /cmd
parent76d05f70afe7d7f7d3ce30f0356bb38dff9cccca (diff)
downloadnss-hg-a969fc161e573d67d30990bd014942ab7829ac6c.tar.gz
Bug 1602379 - Provide secure variants of mpp_pprime and mpp_make_prime. r=mt
Differential Revision: https://phabricator.services.mozilla.com/D139866
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mpitests/mpi-test.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd/mpitests/mpi-test.c b/cmd/mpitests/mpi-test.c
index b7953b6f6..80c0f951a 100644
--- a/cmd/mpitests/mpi-test.c
+++ b/cmd/mpitests/mpi-test.c
@@ -17,7 +17,9 @@
#include <limits.h>
#include <time.h>
+#include "blapi.h"
#include "mpi.h"
+#include "secmpi.h"
#include "mpprime.h"
#include "test-info.c"
@@ -2045,31 +2047,32 @@ test_pprime(void)
int err = 0;
mp_err res;
+ RNG_RNGInit();
mp_init(&p);
mp_read_radix(&p, mp7, 16);
- if (mpp_pprime(&p, 5) != MP_YES) {
+ if (mpp_pprime_secure(&p, 5) != MP_YES) {
reason("error: %s failed Rabin-Miller test, but is prime\n", mp7);
err = 1;
}
IFOK(mp_set_int(&p, 9));
- res = mpp_pprime(&p, 50);
+ res = mpp_pprime_secure(&p, 50);
if (res == MP_YES) {
reason("error: 9 is composite but passed Rabin-Miller test\n");
err = 1;
} else if (res != MP_NO) {
- reason("test mpp_pprime(9, 50) failed: error %d\n", res);
+ reason("test mpp_pprime_secure(9, 50) failed: error %d\n", res);
err = 1;
}
IFOK(mp_set_int(&p, 15));
- res = mpp_pprime(&p, 50);
+ res = mpp_pprime_secure(&p, 50);
if (res == MP_YES) {
reason("error: 15 is composite but passed Rabin-Miller test\n");
err = 1;
} else if (res != MP_NO) {
- reason("test mpp_pprime(15, 50) failed: error %d\n", res);
+ reason("test mpp_pprime_secure(15, 50) failed: error %d\n", res);
err = 1;
}