diff options
author | tb <> | 2018-07-17 17:10:04 +0000 |
---|---|---|
committer | tb <> | 2018-07-17 17:10:04 +0000 |
commit | 59ed52d48725b92ddea20603444a3ab70908379d (patch) | |
tree | a90c51dc940f32442b8d63b8ec3ab1efbb131918 /src | |
parent | e806d7b1499fb96531e6798a88d2cdfe39719b98 (diff) | |
download | openbsd-59ed52d48725b92ddea20603444a3ab70908379d.tar.gz openbsd-59ed52d48725b92ddea20603444a3ab70908379d.tar.bz2 openbsd-59ed52d48725b92ddea20603444a3ab70908379d.zip |
some more style fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libcrypto/ecdsa/ecdsatest.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/regress/lib/libcrypto/ecdsa/ecdsatest.c b/src/regress/lib/libcrypto/ecdsa/ecdsatest.c index a7fcf52bee..097768d11e 100644 --- a/src/regress/lib/libcrypto/ecdsa/ecdsatest.c +++ b/src/regress/lib/libcrypto/ecdsa/ecdsatest.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* crypto/ecdsa/ecdsatest.c */ | 1 | /* $OpenBSD: ecdsatest.c,v 1.6 2018/07/17 17:10:04 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -88,7 +88,8 @@ int x9_62_test_internal(BIO *out, int nid, const char *r, const char *s); | |||
88 | int test_builtin(BIO *); | 88 | int test_builtin(BIO *); |
89 | 89 | ||
90 | /* some tests from the X9.62 draft */ | 90 | /* some tests from the X9.62 draft */ |
91 | int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in) | 91 | int |
92 | x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in) | ||
92 | { | 93 | { |
93 | int ret = 0; | 94 | int ret = 0; |
94 | const char message[] = "abc"; | 95 | const char message[] = "abc"; |
@@ -137,7 +138,7 @@ int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in) | |||
137 | 138 | ||
138 | BIO_printf(out, " ok\n"); | 139 | BIO_printf(out, " ok\n"); |
139 | ret = 1; | 140 | ret = 1; |
140 | x962_int_err: | 141 | x962_int_err: |
141 | if (!ret) | 142 | if (!ret) |
142 | BIO_printf(out, " failed\n"); | 143 | BIO_printf(out, " failed\n"); |
143 | if (key) | 144 | if (key) |
@@ -152,10 +153,11 @@ x962_int_err: | |||
152 | return ret; | 153 | return ret; |
153 | } | 154 | } |
154 | 155 | ||
155 | int test_builtin(BIO *out) | 156 | int |
157 | test_builtin(BIO *out) | ||
156 | { | 158 | { |
157 | EC_builtin_curve *curves = NULL; | 159 | EC_builtin_curve *curves = NULL; |
158 | size_t crv_len = 0, n = 0; | 160 | size_t num_curves = 0, n = 0; |
159 | EC_KEY *eckey = NULL, *wrong_eckey = NULL; | 161 | EC_KEY *eckey = NULL, *wrong_eckey = NULL; |
160 | EC_GROUP *group; | 162 | EC_GROUP *group; |
161 | ECDSA_SIG *ecdsa_sig = NULL; | 163 | ECDSA_SIG *ecdsa_sig = NULL; |
@@ -176,22 +178,22 @@ int test_builtin(BIO *out) | |||
176 | "with some internal curves:\n"); | 178 | "with some internal curves:\n"); |
177 | 179 | ||
178 | /* get a list of all internal curves */ | 180 | /* get a list of all internal curves */ |
179 | crv_len = EC_get_builtin_curves(NULL, 0); | 181 | num_curves = EC_get_builtin_curves(NULL, 0); |
180 | 182 | ||
181 | curves = reallocarray(NULL, sizeof(EC_builtin_curve), crv_len); | 183 | curves = reallocarray(NULL, sizeof(EC_builtin_curve), num_curves); |
182 | 184 | ||
183 | if (curves == NULL) { | 185 | if (curves == NULL) { |
184 | BIO_printf(out, "malloc error\n"); | 186 | BIO_printf(out, "reallocarray error\n"); |
185 | goto builtin_err; | 187 | goto builtin_err; |
186 | } | 188 | } |
187 | 189 | ||
188 | if (!EC_get_builtin_curves(curves, crv_len)) { | 190 | if (!EC_get_builtin_curves(curves, num_curves)) { |
189 | BIO_printf(out, "unable to get internal curves\n"); | 191 | BIO_printf(out, "unable to get internal curves\n"); |
190 | goto builtin_err; | 192 | goto builtin_err; |
191 | } | 193 | } |
192 | 194 | ||
193 | /* now create and verify a signature for every curve */ | 195 | /* now create and verify a signature for every curve */ |
194 | for (n = 0; n < crv_len; n++) { | 196 | for (n = 0; n < num_curves; n++) { |
195 | unsigned char dirt, offset; | 197 | unsigned char dirt, offset; |
196 | 198 | ||
197 | nid = curves[n].nid; | 199 | nid = curves[n].nid; |
@@ -360,13 +362,10 @@ int test_builtin(BIO *out) | |||
360 | } | 362 | } |
361 | 363 | ||
362 | ret = 1; | 364 | ret = 1; |
363 | builtin_err: | 365 | builtin_err: |
364 | if (eckey) | 366 | EC_KEY_free(eckey); |
365 | EC_KEY_free(eckey); | 367 | EC_KEY_free(wrong_eckey); |
366 | if (wrong_eckey) | 368 | ECDSA_SIG_free(ecdsa_sig); |
367 | EC_KEY_free(wrong_eckey); | ||
368 | if (ecdsa_sig) | ||
369 | ECDSA_SIG_free(ecdsa_sig); | ||
370 | free(signature); | 369 | free(signature); |
371 | free(raw_buf); | 370 | free(raw_buf); |
372 | free(curves); | 371 | free(curves); |
@@ -374,7 +373,8 @@ builtin_err: | |||
374 | return ret; | 373 | return ret; |
375 | } | 374 | } |
376 | 375 | ||
377 | int main(void) | 376 | int |
377 | main(void) | ||
378 | { | 378 | { |
379 | int ret = 1; | 379 | int ret = 1; |
380 | BIO *out; | 380 | BIO *out; |
@@ -388,7 +388,7 @@ int main(void) | |||
388 | goto err; | 388 | goto err; |
389 | 389 | ||
390 | ret = 0; | 390 | ret = 0; |
391 | err: | 391 | err: |
392 | if (ret) | 392 | if (ret) |
393 | BIO_printf(out, "\nECDSA test failed\n"); | 393 | BIO_printf(out, "\nECDSA test failed\n"); |
394 | else | 394 | else |