summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-04-25 15:30:03 +0000
committertb <>2023-04-25 15:30:03 +0000
commit9b04c1f12fcd8569361a003ef3f515bde1d39a0f (patch)
tree029f9b670aafbc3198aad53cf88a77174d14fca5 /src
parentef61ceedfd430ca7ea41d394bf3e1eb4735f0735 (diff)
downloadopenbsd-9b04c1f12fcd8569361a003ef3f515bde1d39a0f.tar.gz
openbsd-9b04c1f12fcd8569361a003ef3f515bde1d39a0f.tar.bz2
openbsd-9b04c1f12fcd8569361a003ef3f515bde1d39a0f.zip
bn_primes: the NIST primes will go away, so remove their tests
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libcrypto/bn/bn_primes.c42
1 files changed, 1 insertions, 41 deletions
diff --git a/src/regress/lib/libcrypto/bn/bn_primes.c b/src/regress/lib/libcrypto/bn/bn_primes.c
index cd552dc3ac..8180b0d78a 100644
--- a/src/regress/lib/libcrypto/bn/bn_primes.c
+++ b/src/regress/lib/libcrypto/bn/bn_primes.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_primes.c,v 1.2 2022/12/06 18:23:29 tb Exp $ */ 1/* $OpenBSD: bn_primes.c,v 1.3 2023/04/25 15:30:03 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -98,19 +98,6 @@ static const struct test_dynamic_api {
98 98
99#define N_DYNAMIC_TESTS (sizeof(dynamic_api_data) / sizeof(dynamic_api_data[0])) 99#define N_DYNAMIC_TESTS (sizeof(dynamic_api_data) / sizeof(dynamic_api_data[0]))
100 100
101static const struct test_const_api {
102 const BIGNUM *(*fn)(void);
103 const char *name;
104} const_api_data[] = {
105 BN_PRIME_FN_INIT(BN_get0_nist_prime_192),
106 BN_PRIME_FN_INIT(BN_get0_nist_prime_224),
107 BN_PRIME_FN_INIT(BN_get0_nist_prime_256),
108 BN_PRIME_FN_INIT(BN_get0_nist_prime_384),
109 BN_PRIME_FN_INIT(BN_get0_nist_prime_521),
110};
111
112#define N_CONST_TESTS (sizeof(const_api_data) / sizeof(const_api_data[0]))
113
114static int 101static int
115test_prime_dynamic_api(const struct test_dynamic_api *tc) 102test_prime_dynamic_api(const struct test_dynamic_api *tc)
116{ 103{
@@ -137,30 +124,6 @@ test_prime_dynamic_api(const struct test_dynamic_api *tc)
137} 124}
138 125
139static int 126static int
140test_prime_const_api(const struct test_const_api *tc)
141{
142 const BIGNUM *prime;
143 int ret;
144 int failed = 1;
145
146 if ((prime = tc->fn()) == NULL) {
147 fprintf(stderr, "%s failed\n", tc->name);
148 goto err;
149 }
150
151 if ((ret = BN_is_prime_fasttest_ex(prime, 1, NULL, 1, NULL)) != 1) {
152 fprintf(stderr, "%s: %s: want 1, got %d\n", tc->name,
153 "BN_is_prime_fasttest_ex", ret);
154 goto err;
155 }
156
157 failed = 0;
158
159 err:
160 return failed;
161}
162
163static int
164test_prime_constants(void) 127test_prime_constants(void)
165{ 128{
166 size_t i; 129 size_t i;
@@ -169,9 +132,6 @@ test_prime_constants(void)
169 for (i = 0; i < N_DYNAMIC_TESTS; i++) 132 for (i = 0; i < N_DYNAMIC_TESTS; i++)
170 failed |= test_prime_dynamic_api(&dynamic_api_data[i]); 133 failed |= test_prime_dynamic_api(&dynamic_api_data[i]);
171 134
172 for (i = 0; i < N_CONST_TESTS; i++)
173 failed |= test_prime_const_api(&const_api_data[i]);
174
175 return failed; 135 return failed;
176} 136}
177 137