summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2022-12-03 08:21:38 +0000
committertb <>2022-12-03 08:21:38 +0000
commitc6d7a34e7fd867cf5c30482829d102f5f6af617c (patch)
tree658deae0ece1542bba39ed68d29fcc4d5d7ff131 /src
parent2144af446f33a4d2a7f49c3b448e506ed6f3cd62 (diff)
downloadopenbsd-c6d7a34e7fd867cf5c30482829d102f5f6af617c.tar.gz
openbsd-c6d7a34e7fd867cf5c30482829d102f5f6af617c.tar.bz2
openbsd-c6d7a34e7fd867cf5c30482829d102f5f6af617c.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libcrypto/bn/bn_mod_exp.c14
1 files changed, 8 insertions, 6 deletions
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 @@
1/* $OpenBSD: bn_mod_exp.c,v 1.6 2022/12/03 08:05:52 tb Exp $ */ 1/* $OpenBSD: bn_mod_exp.c,v 1.7 2022/12/03 08:21:38 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -157,18 +157,20 @@ main(int argc, char *argv[])
157 } 157 }
158 158
159 if (BN_cmp(r_simple, r_mont) != 0 || 159 if (BN_cmp(r_simple, r_mont) != 0 ||
160 BN_cmp(r_simple, r_mont_const) ||
160 BN_cmp(r_simple, r_recp) != 0 || 161 BN_cmp(r_simple, r_recp) != 0 ||
161 BN_cmp(r_simple, r_mont_const) != 0) { 162 BN_cmp(r_simple, r_mont_ct) != 0 ||
163 BN_cmp(r_simple, r_mont_nonct) != 0) {
162 if (BN_cmp(r_simple, r_mont) != 0) 164 if (BN_cmp(r_simple, r_mont) != 0)
163 printf("\nsimple and mont results differ\n"); 165 printf("\nsimple and mont results differ\n");
164 if (BN_cmp(r_simple, r_mont_const) != 0) 166 if (BN_cmp(r_simple, r_mont_const) != 0)
165 printf("\nsimple and mont const time results differ\n"); 167 printf("\nsimple and mont const time results differ\n");
166 if (BN_cmp(r_simple, r_recp) != 0) 168 if (BN_cmp(r_simple, r_recp) != 0)
167 printf("\nsimple and recp results differ\n"); 169 printf("\nsimple and recp results differ\n");
168 if (BN_cmp(r_mont, r_mont_ct) != 0) 170 if (BN_cmp(r_simple, r_mont_ct) != 0)
169 printf("\nmont_ct and mont results differ\n"); 171 printf("\nsimple and mont results differ\n");
170 if (BN_cmp(r_mont_ct, r_mont_nonct) != 0) 172 if (BN_cmp(r_simple, r_mont_nonct) != 0)
171 printf("\nmont_ct and mont_nonct results differ\n"); 173 printf("\nsimple and mont_nonct results differ\n");
172 174
173 printf("a (%3d) = ", BN_num_bits(a)); 175 printf("a (%3d) = ", BN_num_bits(a));
174 BN_print_fp(stdout, a); 176 BN_print_fp(stdout, a);