From c6d7a34e7fd867cf5c30482829d102f5f6af617c Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 3 Dec 2022 08:21:38 +0000 Subject: Add missing checks for BN_mod_exp_{non,}ct() Someone added a few more functions to test, but forgot to check their results, so if they would not do the expected thing that would only be noticed if one of the already tested functions would break. --- src/regress/lib/libcrypto/bn/bn_mod_exp.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/regress/lib/libcrypto/bn/bn_mod_exp.c b/src/regress/lib/libcrypto/bn/bn_mod_exp.c index f7be5110ea..4b98dea0d7 100644 --- a/src/regress/lib/libcrypto/bn/bn_mod_exp.c +++ b/src/regress/lib/libcrypto/bn/bn_mod_exp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mod_exp.c,v 1.6 2022/12/03 08:05:52 tb Exp $ */ +/* $OpenBSD: bn_mod_exp.c,v 1.7 2022/12/03 08:21:38 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -157,18 +157,20 @@ main(int argc, char *argv[]) } if (BN_cmp(r_simple, r_mont) != 0 || + BN_cmp(r_simple, r_mont_const) || BN_cmp(r_simple, r_recp) != 0 || - BN_cmp(r_simple, r_mont_const) != 0) { + BN_cmp(r_simple, r_mont_ct) != 0 || + BN_cmp(r_simple, r_mont_nonct) != 0) { if (BN_cmp(r_simple, r_mont) != 0) printf("\nsimple and mont results differ\n"); if (BN_cmp(r_simple, r_mont_const) != 0) printf("\nsimple and mont const time results differ\n"); if (BN_cmp(r_simple, r_recp) != 0) printf("\nsimple and recp results differ\n"); - if (BN_cmp(r_mont, r_mont_ct) != 0) - printf("\nmont_ct and mont results differ\n"); - if (BN_cmp(r_mont_ct, r_mont_nonct) != 0) - printf("\nmont_ct and mont_nonct results differ\n"); + if (BN_cmp(r_simple, r_mont_ct) != 0) + printf("\nsimple and mont results differ\n"); + if (BN_cmp(r_simple, r_mont_nonct) != 0) + printf("\nsimple and mont_nonct results differ\n"); printf("a (%3d) = ", BN_num_bits(a)); BN_print_fp(stdout, a); -- cgit v1.2.3-55-g6feb