diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-04-05 11:03:12 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-04-05 11:03:12 +0000 |
commit | 2e793860dc4f39a588a2559d5bc1b13c8dcfbedd (patch) | |
tree | 0a74083637a0af79711acfea3003860963965618 /regress | |
parent | c94e51d5d0ec53788d70695bf227548ed538571b (diff) |
bn_mod_sqrt: Improve a handful of comments and a printf
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libcrypto/bn/bn_mod_sqrt.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/regress/lib/libcrypto/bn/bn_mod_sqrt.c b/regress/lib/libcrypto/bn/bn_mod_sqrt.c index 43338297d3e..5273aba7c2a 100644 --- a/regress/lib/libcrypto/bn/bn_mod_sqrt.c +++ b/regress/lib/libcrypto/bn/bn_mod_sqrt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mod_sqrt.c,v 1.7 2023/04/05 10:47:00 tb Exp $ */ +/* $OpenBSD: bn_mod_sqrt.c,v 1.8 2023/04/05 11:03:11 tb Exp $ */ /* * Copyright (c) 2022,2023 Theo Buehler <tb@openbsd.org> @@ -21,7 +21,11 @@ #include <openssl/bn.h> -/* Test that sqrt * sqrt = A (mod p) where p is a prime */ +/* + * Test that .sqrt * .sqrt = .a (mod .p) where .p is a prime. If .sqrt is + * omitted, .a does not have a square root and BN_mod_sqrt() fails. + */ + struct mod_sqrt_test { const char *a; const char *p; @@ -1455,7 +1459,7 @@ struct mod_sqrt_test { }, /* - * p = 1 (mod 8), short initial segment of residues + * p = 1 (mod 8), short initial segment of quadratic residues */ { @@ -2140,7 +2144,7 @@ struct mod_sqrt_test { }, /* - * p = 1 (mod 8), long initial segment of residues + * p = 1 (mod 8), long initial segment of quadratic residues */ { @@ -2872,7 +2876,7 @@ mod_sqrt_test(struct mod_sqrt_test *test, BN_CTX *ctx) if (!BN_is_zero(diff) && !BN_is_zero(sum)) { fprintf(stderr, "a: %s\n", test->a); fprintf(stderr, "p: %s\n", test->p); - fprintf(stderr, "want: %s:", test->sqrt); + fprintf(stderr, "want: %s\n", test->sqrt); fprintf(stderr, "got: "); BN_print_fp(stderr, got); fprintf(stderr, "\n\n"); |