aboutsummaryrefslogtreecommitdiffstats
path: root/test/exptest.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2017-05-08 12:09:41 +1000
committerRichard Levitte <levitte@openssl.org>2017-05-09 21:30:29 +0200
commitdc352c193755525292310c8992e3c9b81a556a31 (patch)
tree9ff9ee27744faf975cabca0120b05c791cb43ccd /test/exptest.c
parent5e3766e2f15b3a8ea696b194c32a141cbe668d4e (diff)
downloadopenssl-dc352c193755525292310c8992e3c9b81a556a31.tar.gz
Add BN support to the test infrastructure.
This includes support for: - comparisions between pairs of BIGNUMs - comparisions between BIGNUMs and zero - equality comparison between BIGNUMs and one - equality comparisons between BIGNUMs and constants - parity checks for BIGNUMs Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3405)
Diffstat (limited to 'test/exptest.c')
-rw-r--r--test/exptest.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/exptest.c b/test/exptest.c
index e15c0519b9..ee1bff168c 100644
--- a/test/exptest.c
+++ b/test/exptest.c
@@ -109,7 +109,7 @@ static int test_mod_exp_zero()
if (!TEST_true(BN_mod_exp_mont_word(r, one_word, p, m, ctx, NULL)))
goto err;
- if (!TEST_true(BN_is_zero(r))) {
+ if (!TEST_BN_eq_zero(r)) {
fprintf(stderr, "BN_mod_exp_mont_word failed:\n");
fprintf(stderr, "1 ** 0 mod 1 = r (should be 0)\n");
BN_print_var(r);
@@ -173,15 +173,15 @@ static int test_mod_exp(int round)
|| !TEST_true(BN_mod_exp_mont_consttime(r_mont_const, a, b, m, ctx, NULL)))
goto err;
- if (!TEST_int_eq(BN_cmp(r_simple, r_mont), 0)
- || !TEST_int_eq(BN_cmp(r_simple, r_recp), 0)
- || !TEST_int_eq(BN_cmp(r_simple, r_mont_const), 0)) {
+ if (!TEST_BN_eq(r_simple, r_mont)
+ || !TEST_BN_eq(r_simple, r_recp)
+ || !TEST_BN_eq(r_simple, r_mont_const)) {
if (BN_cmp(r_simple, r_mont) != 0)
- fprintf(stderr, "simple and mont results differ\n");
+ TEST_info("simple and mont results differ");
if (BN_cmp(r_simple, r_mont_const) != 0)
- fprintf(stderr, "simple and mont const time results differ\n");
+ TEST_info("simple and mont const time results differ");
if (BN_cmp(r_simple, r_recp) != 0)
- fprintf(stderr, "simple and recp results differ\n");
+ TEST_info("simple and recp results differ");
BN_print_var(a);
BN_print_var(b);