diff options
Diffstat (limited to '')
| -rw-r--r-- | src/regress/lib/libcrypto/bn/Makefile | 14 | ||||
| -rw-r--r-- | src/regress/lib/libcrypto/bn/bn_isqrt_tables.txt | 30 |
2 files changed, 43 insertions, 1 deletions
diff --git a/src/regress/lib/libcrypto/bn/Makefile b/src/regress/lib/libcrypto/bn/Makefile index b5d146c71b..7dc5ef75c8 100644 --- a/src/regress/lib/libcrypto/bn/Makefile +++ b/src/regress/lib/libcrypto/bn/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.9 2022/12/01 21:21:51 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.10 2022/12/01 22:31:59 tb Exp $ |
| 2 | 2 | ||
| 3 | PROGS += bn_add_sub | 3 | PROGS += bn_add_sub |
| 4 | PROGS += bn_cmp | 4 | PROGS += bn_cmp |
| @@ -32,9 +32,21 @@ run-$p: $p | |||
| 32 | ./$p | 32 | ./$p |
| 33 | .endfor | 33 | .endfor |
| 34 | 34 | ||
| 35 | # Verify that the bn_isqrt -C output isn't changed by accident. | ||
| 35 | isqrt-print-tables: bn_isqrt | 36 | isqrt-print-tables: bn_isqrt |
| 36 | @./bn_isqrt -C | 37 | @./bn_isqrt -C |
| 37 | 38 | ||
| 39 | CLEANFILES += bn_isqrt_gen_tables.txt.tmp bn_isqrt_gen_tables.txt | ||
| 40 | bn_isqrt_gen_tables.txt: bn_isqrt | ||
| 41 | ${.MAKE} -C ${.CURDIR} isqrt-print-tables > $@.tmp | ||
| 42 | mv -f $@.tmp $@ | ||
| 43 | |||
| 44 | REGRESS_TARGETS += run-bn_isqrt_check_tables | ||
| 45 | .PHONY: run-bn_isqrt_check_tables | ||
| 46 | run-bn_isqrt_check_tables: bn_isqrt_gen_tables.txt | ||
| 47 | diff -pu ${.CURDIR}/bn_isqrt_tables.txt bn_isqrt_gen_tables.txt | ||
| 48 | |||
| 49 | |||
| 38 | # Keep bn_test last since it is special | 50 | # Keep bn_test last since it is special |
| 39 | PROGS += bn_test | 51 | PROGS += bn_test |
| 40 | STATIC_LINK += bn_test | 52 | STATIC_LINK += bn_test |
diff --git a/src/regress/lib/libcrypto/bn/bn_isqrt_tables.txt b/src/regress/lib/libcrypto/bn/bn_isqrt_tables.txt new file mode 100644 index 0000000000..bc045a220e --- /dev/null +++ b/src/regress/lib/libcrypto/bn/bn_isqrt_tables.txt | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | const uint8_t is_square_mod_11[] = { | ||
| 2 | 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, | ||
| 3 | }; | ||
| 4 | CTASSERT(sizeof(is_square_mod_11) == 11); | ||
| 5 | |||
| 6 | const uint8_t is_square_mod_63[] = { | ||
| 7 | 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, | ||
| 8 | 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, | ||
| 9 | 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, | ||
| 10 | 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, | ||
| 11 | }; | ||
| 12 | CTASSERT(sizeof(is_square_mod_63) == 63); | ||
| 13 | |||
| 14 | const uint8_t is_square_mod_64[] = { | ||
| 15 | 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, | ||
| 16 | 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, | ||
| 17 | 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, | ||
| 18 | 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, | ||
| 19 | }; | ||
| 20 | CTASSERT(sizeof(is_square_mod_64) == 64); | ||
| 21 | |||
| 22 | const uint8_t is_square_mod_65[] = { | ||
| 23 | 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, | ||
| 24 | 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, | ||
| 25 | 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, | ||
| 26 | 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, | ||
| 27 | 1, | ||
| 28 | }; | ||
| 29 | CTASSERT(sizeof(is_square_mod_65) == 65); | ||
| 30 | |||
