From: tb Date: Thu, 1 Dec 2022 13:55:22 +0000 (+0000) Subject: Make tests silent on success. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d20a2f80d6c4d0bcee8d4e0093faa01ff0fddfed;p=openbsd Make tests silent on success. Also, run all x25519 tests, don't stop on first failure. --- 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 * @@ -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; }