summaryrefslogtreecommitdiff
path: root/src/regress/lib
diff options
context:
space:
mode:
authortb <>2023-07-16 00:16:42 +0000
committertb <>2023-07-16 00:16:42 +0000
commit719f0117cb0150d298f8e762230fe437cdc92f14 (patch)
tree79076c3b4e3986393e7cfb10ea820046f743dc39 /src/regress/lib
parent002b3063d86e5feaaf936ce82467233e5660ef12 (diff)
downloadopenbsd-719f0117cb0150d298f8e762230fe437cdc92f14.tar.gz
openbsd-719f0117cb0150d298f8e762230fe437cdc92f14.tar.bz2
openbsd-719f0117cb0150d298f8e762230fe437cdc92f14.zip
ecdhtest: fix a couple bugs plus some cosmetic tweaks
Diffstat (limited to 'src/regress/lib')
-rw-r--r--src/regress/lib/libcrypto/ecdh/ecdhtest.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/regress/lib/libcrypto/ecdh/ecdhtest.c b/src/regress/lib/libcrypto/ecdh/ecdhtest.c
index fc534f14bd..bf9e9c007c 100644
--- a/src/regress/lib/libcrypto/ecdh/ecdhtest.c
+++ b/src/regress/lib/libcrypto/ecdh/ecdhtest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecdhtest.c,v 1.18 2023/07/15 23:35:02 tb Exp $ */ 1/* $OpenBSD: ecdhtest.c,v 1.19 2023/07/16 00:16:42 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 * 4 *
@@ -149,10 +149,9 @@ ecdh_keygen_test(int nid)
149 printf(" shared secret:\n"); 149 printf(" shared secret:\n");
150 hexdump(abuf, len); 150 hexdump(abuf, len);
151 151
152 printf("key b:\n");
153 EC_KEY_print_fp(stdout, keyb, 1); 152 EC_KEY_print_fp(stdout, keyb, 1);
154 printf(" shared secret:\n"); 153 printf(" shared secret:\n");
155 hexdump(abuf, len); 154 hexdump(bbuf, len);
156 155
157 fprintf(stderr, "Error in ECDH routines\n"); 156 fprintf(stderr, "Error in ECDH routines\n");
158 157
@@ -160,6 +159,7 @@ ecdh_keygen_test(int nid)
160 } 159 }
161 160
162 failed = 0; 161 failed = 0;
162
163 err: 163 err:
164 ERR_print_errors_fp(stderr); 164 ERR_print_errors_fp(stderr);
165 165
@@ -338,7 +338,7 @@ ecdh_kat(const struct ecdh_kat_test *kat)
338 BIGNUM *z = NULL; 338 BIGNUM *z = NULL;
339 unsigned char *want = NULL, *got = NULL; 339 unsigned char *want = NULL, *got = NULL;
340 int len = 0; 340 int len = 0;
341 int failed = 0; 341 int failed = 1;
342 342
343 if ((keya = mk_eckey(kat->nid, kat->keya)) == NULL) 343 if ((keya = mk_eckey(kat->nid, kat->keya)) == NULL)
344 goto err; 344 goto err;
@@ -380,7 +380,7 @@ ecdh_kat(const struct ecdh_kat_test *kat)
380 380
381 err: 381 err:
382 if (failed) { 382 if (failed) {
383 printf("ECDH shared secret with %s failed", OBJ_nid2sn(kat->nid)); 383 printf("shared secret with %s failed", OBJ_nid2sn(kat->nid));
384 384
385 fprintf(stderr, "Error in ECDH routines\n"); 385 fprintf(stderr, "Error in ECDH routines\n");
386 ERR_print_errors_fp(stderr); 386 ERR_print_errors_fp(stderr);
@@ -396,7 +396,7 @@ ecdh_kat(const struct ecdh_kat_test *kat)
396} 396}
397 397
398int 398int
399main(int argc, char *argv[]) 399main(void)
400{ 400{
401 EC_builtin_curve *curves = NULL; 401 EC_builtin_curve *curves = NULL;
402 size_t i, n_curves; 402 size_t i, n_curves;