diff options
author | tb <> | 2022-12-01 13:55:22 +0000 |
---|---|---|
committer | tb <> | 2022-12-01 13:55:22 +0000 |
commit | 31bd65f66329da0883d7ff572fa5a574fcd1afa2 (patch) | |
tree | 1a223b88c05f71c79e7bb7ec24c22b5758fff1bc /src | |
parent | c36581ceccff1012990506e217c7be4b1aff5235 (diff) | |
download | openbsd-31bd65f66329da0883d7ff572fa5a574fcd1afa2.tar.gz openbsd-31bd65f66329da0883d7ff572fa5a574fcd1afa2.tar.bz2 openbsd-31bd65f66329da0883d7ff572fa5a574fcd1afa2.zip |
Make tests silent on success.
Also, run all x25519 tests, don't stop on first failure.
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libcrypto/curve25519/ed25519test.c | 7 | ||||
-rw-r--r-- | src/regress/lib/libcrypto/curve25519/x25519test.c | 31 |
2 files changed, 17 insertions, 21 deletions
diff --git a/src/regress/lib/libcrypto/curve25519/ed25519test.c b/src/regress/lib/libcrypto/curve25519/ed25519test.c index 29fa06573f..78ed85c065 100644 --- a/src/regress/lib/libcrypto/curve25519/ed25519test.c +++ b/src/regress/lib/libcrypto/curve25519/ed25519test.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ed25519test.c,v 1.9 2022/11/23 15:52:43 tb Exp $ */ | 1 | /* $OpenBSD: ed25519test.c,v 1.10 2022/12/01 13:55:22 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2019, 2022 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2019, 2022 Theo Buehler <tb@openbsd.org> |
4 | * | 4 | * |
@@ -470,10 +470,5 @@ main(int argc, char *argv[]) | |||
470 | failed |= test_ED25519_sign(); | 470 | failed |= test_ED25519_sign(); |
471 | failed |= test_ED25519_signature_malleability(); | 471 | failed |= test_ED25519_signature_malleability(); |
472 | 472 | ||
473 | if (failed) | ||
474 | fprintf(stderr, "FAILED\n"); | ||
475 | else | ||
476 | fprintf(stderr, "PASS\n"); | ||
477 | |||
478 | return failed; | 473 | return failed; |
479 | } | 474 | } |
diff --git a/src/regress/lib/libcrypto/curve25519/x25519test.c b/src/regress/lib/libcrypto/curve25519/x25519test.c index 02da807bd9..321aac4d71 100644 --- a/src/regress/lib/libcrypto/curve25519/x25519test.c +++ b/src/regress/lib/libcrypto/curve25519/x25519test.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x25519test.c,v 1.2 2018/07/17 17:06:49 tb Exp $ */ | 1 | /* $OpenBSD: x25519test.c,v 1.3 2022/12/01 13:55:22 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2015, Google Inc. | 3 | * Copyright (c) 2015, Google Inc. |
4 | * | 4 | * |
@@ -67,16 +67,16 @@ x25519_test(void) | |||
67 | X25519(out, kScalar1, kPoint1); | 67 | X25519(out, kScalar1, kPoint1); |
68 | if (memcmp(kExpected1, out, sizeof(out)) != 0) { | 68 | if (memcmp(kExpected1, out, sizeof(out)) != 0) { |
69 | fprintf(stderr, "X25519 test one failed.\n"); | 69 | fprintf(stderr, "X25519 test one failed.\n"); |
70 | return 0; | 70 | return 1; |
71 | } | 71 | } |
72 | 72 | ||
73 | X25519(out, kScalar2, kPoint2); | 73 | X25519(out, kScalar2, kPoint2); |
74 | if (memcmp(kExpected2, out, sizeof(out)) != 0) { | 74 | if (memcmp(kExpected2, out, sizeof(out)) != 0) { |
75 | fprintf(stderr, "X25519 test two failed.\n"); | 75 | fprintf(stderr, "X25519 test two failed.\n"); |
76 | return 0; | 76 | return 1; |
77 | } | 77 | } |
78 | 78 | ||
79 | return 1; | 79 | return 0; |
80 | } | 80 | } |
81 | 81 | ||
82 | static int | 82 | static int |
@@ -101,10 +101,10 @@ x25519_iterated_test(void) | |||
101 | 101 | ||
102 | if (memcmp(kExpected, scalar, sizeof(kExpected)) != 0) { | 102 | if (memcmp(kExpected, scalar, sizeof(kExpected)) != 0) { |
103 | fprintf(stderr, "Iterated X25519 test failed\n"); | 103 | fprintf(stderr, "Iterated X25519 test failed\n"); |
104 | return 0; | 104 | return 1; |
105 | } | 105 | } |
106 | 106 | ||
107 | return 1; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | static int | 110 | static int |
@@ -122,19 +122,20 @@ x25519_small_order_test(void) | |||
122 | memset(private_key, 0x11, sizeof(private_key)); | 122 | memset(private_key, 0x11, sizeof(private_key)); |
123 | if (X25519(out, private_key, kSmallOrderPoint)) { | 123 | if (X25519(out, private_key, kSmallOrderPoint)) { |
124 | fprintf(stderr, "X25519 returned success with a small-order input.\n"); | 124 | fprintf(stderr, "X25519 returned success with a small-order input.\n"); |
125 | return 0; | 125 | return 1; |
126 | } | 126 | } |
127 | 127 | ||
128 | return 1; | 128 | return 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | int | 131 | int |
132 | main(int argc, char **argv) { | 132 | main(int argc, char **argv) |
133 | if (!x25519_test() || | 133 | { |
134 | !x25519_iterated_test() || | 134 | int failed = 0; |
135 | !x25519_small_order_test()) | ||
136 | return 1; | ||
137 | 135 | ||
138 | printf("PASS\n"); | 136 | failed |= x25519_test(); |
139 | return 0; | 137 | failed |= x25519_iterated_test(); |
138 | failed |= x25519_small_order_test(); | ||
139 | |||
140 | return failed; | ||
140 | } | 141 | } |