[openssh-commits] [openssh] 06/07: upstream: Null out keys between test runs.
git+noreply at mindrot.org
git+noreply at mindrot.org
Sat May 24 17:23:56 AEST 2025
This is an automated email from the git hooks/post-receive script.
dtucker pushed a commit to branch master
in repository openssh.
commit f8967045ad9d588bc11426642070bf8549065e62
Author: dtucker at openbsd.org <dtucker at openbsd.org>
AuthorDate: Sat May 24 06:50:28 2025 +0000
upstream: Null out keys between test runs.
BENCH_START and BENCH_FINISH are actually a while() loop in disguise,
so if sshkey_generate does not reset the key pointer on failure the test
may incorrectly pass. It also confuses Coverity (CID 551234).
OpenBSD-Regress-ID: bf4d32079fc6df6dce1f26c2025f4ed492f13936
---
regress/unittests/sshkey/test_sshkey.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/regress/unittests/sshkey/test_sshkey.c b/regress/unittests/sshkey/test_sshkey.c
index 832ef9b20..9dbd91306 100644
--- a/regress/unittests/sshkey/test_sshkey.c
+++ b/regress/unittests/sshkey/test_sshkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_sshkey.c,v 1.29 2025/05/06 06:05:48 djm Exp $ */
+/* $OpenBSD: test_sshkey.c,v 1.30 2025/05/24 06:50:28 dtucker Exp $ */
/*
* Regress test for sshkey.h key management API
*
@@ -560,6 +560,7 @@ sshkey_benchmarks(void)
ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 1024, &k), 0);
ASSERT_PTR_NE(k, NULL);
sshkey_free(k);
+ k = NULL;
TEST_DONE();
BENCH_FINISH("keys");
@@ -568,15 +569,16 @@ sshkey_benchmarks(void)
ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 2048, &k), 0);
ASSERT_PTR_NE(k, NULL);
sshkey_free(k);
+ k = NULL;
TEST_DONE();
BENCH_FINISH("keys");
-
BENCH_START("generate ECDSA-256");
TEST_START("generate KEY_ECDSA");
ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 256, &k), 0);
ASSERT_PTR_NE(k, NULL);
sshkey_free(k);
+ k = NULL;
TEST_DONE();
BENCH_FINISH("keys");
@@ -585,6 +587,7 @@ sshkey_benchmarks(void)
ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 384, &k), 0);
ASSERT_PTR_NE(k, NULL);
sshkey_free(k);
+ k = NULL;
TEST_DONE();
BENCH_FINISH("keys");
@@ -593,6 +596,7 @@ sshkey_benchmarks(void)
ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 521, &k), 0);
ASSERT_PTR_NE(k, NULL);
sshkey_free(k);
+ k = NULL;
TEST_DONE();
BENCH_FINISH("keys");
#endif /* WITH_OPENSSL */
@@ -602,6 +606,7 @@ sshkey_benchmarks(void)
ASSERT_INT_EQ(sshkey_generate(KEY_ED25519, 256, &k), 0);
ASSERT_PTR_NE(k, NULL);
sshkey_free(k);
+ k = NULL;
TEST_DONE();
BENCH_FINISH("keys");
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list