diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2022-12-01 13:55:23 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2022-12-01 13:55:23 +0000 |
commit | 5a7dbf41d213e01ce98bc1208987abd46fd49931 (patch) | |
tree | 3ab2e36053adee73e8fc4225c6737f9aa38fd15b /regress | |
parent | 433a80aa1e16d7af9e4b41189bbf23324942dfaa (diff) |
Make tests silent on success.
Also, run all x25519 tests, don't stop on first failure.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libcrypto/curve25519/ed25519test.c | 7 | ||||
-rw-r--r-- | regress/lib/libcrypto/curve25519/x25519test.c | 31 |
2 files changed, 17 insertions, 21 deletions
diff --git a/regress/lib/libcrypto/curve25519/ed25519test.c b/regress/lib/libcrypto/curve25519/ed25519test.c index 29fa06573f6..78ed85c0651 100644 --- a/regress/lib/libcrypto/curve25519/ed25519test.c +++ b/regress/lib/libcrypto/curve25519/ed25519test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ed25519test.c,v 1.9 2022/11/23 15:52:43 tb Exp $ */ +/* $OpenBSD: ed25519test.c,v 1.10 2022/12/01 13:55:22 tb Exp $ */ /* * Copyright (c) 2019, 2022 Theo Buehler <tb@openbsd.org> * @@ -470,10 +470,5 @@ main(int argc, char *argv[]) failed |= test_ED25519_sign(); failed |= test_ED25519_signature_malleability(); - if (failed) - fprintf(stderr, "FAILED\n"); - else - fprintf(stderr, "PASS\n"); - return failed; } diff --git a/regress/lib/libcrypto/curve25519/x25519test.c b/regress/lib/libcrypto/curve25519/x25519test.c index 02da807bd96..321aac4d719 100644 --- a/regress/lib/libcrypto/curve25519/x25519test.c +++ b/regress/lib/libcrypto/curve25519/x25519test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x25519test.c,v 1.2 2018/07/17 17:06:49 tb Exp $ */ +/* $OpenBSD: x25519test.c,v 1.3 2022/12/01 13:55:22 tb Exp $ */ /* * Copyright (c) 2015, Google Inc. * @@ -67,16 +67,16 @@ x25519_test(void) X25519(out, kScalar1, kPoint1); if (memcmp(kExpected1, out, sizeof(out)) != 0) { fprintf(stderr, "X25519 test one failed.\n"); - return 0; + return 1; } X25519(out, kScalar2, kPoint2); if (memcmp(kExpected2, out, sizeof(out)) != 0) { fprintf(stderr, "X25519 test two failed.\n"); - return 0; + return 1; } - return 1; + return 0; } static int @@ -101,10 +101,10 @@ x25519_iterated_test(void) if (memcmp(kExpected, scalar, sizeof(kExpected)) != 0) { fprintf(stderr, "Iterated X25519 test failed\n"); - return 0; + return 1; } - return 1; + return 0; } static int @@ -122,19 +122,20 @@ x25519_small_order_test(void) memset(private_key, 0x11, sizeof(private_key)); if (X25519(out, private_key, kSmallOrderPoint)) { fprintf(stderr, "X25519 returned success with a small-order input.\n"); - return 0; + return 1; } - return 1; + return 0; } int -main(int argc, char **argv) { - if (!x25519_test() || - !x25519_iterated_test() || - !x25519_small_order_test()) - return 1; +main(int argc, char **argv) +{ + int failed = 0; - printf("PASS\n"); - return 0; + failed |= x25519_test(); + failed |= x25519_iterated_test(); + failed |= x25519_small_order_test(); + + return failed; } |