git: e40474f3de84 - main - siphash: minor improvements to siphash unit test

From: Warner Losh <imp_at_FreeBSD.org>
Date: Mon, 29 Jul 2024 20:47:50 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e40474f3de84f3c7b885af45d9a9391c6cf448c2

commit e40474f3de84f3c7b885af45d9a9391c6cf448c2
Author:     Mark O'Donovan <shiftee@posteo.net>
AuthorDate: 2024-07-11 17:50:48 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-07-29 20:44:41 +0000

    siphash: minor improvements to siphash unit test
    
    Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
    Reviewed by: imp, cperciva
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1324
---
 sys/crypto/siphash/siphash_test.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/crypto/siphash/siphash_test.c b/sys/crypto/siphash/siphash_test.c
index a9af5a5ebe58..a9f5bcf062bb 100644
--- a/sys/crypto/siphash/siphash_test.c
+++ b/sys/crypto/siphash/siphash_test.c
@@ -115,7 +115,7 @@ SipHash24_TestVectors(void)
 	for (i = 0; i < 16; ++i)
 		k[i] = i;
 
-	/* Step through differnet length. */
+	/* Step through different lengths */
 	for (i = 0; i < MAXLEN; ++i) {
 		in[i] = i;
 
@@ -124,14 +124,14 @@ SipHash24_TestVectors(void)
 		SipHash_Update(&ctx, in, i);
 		SipHash_Final(out, &ctx);
 
-		if (memcmp(out, vectors[i], 8))
+		if (memcmp(out, vectors[i], 8)) {
+			fail++;
 #if 0
 			printf("%i: test vector failed\n", i);
-		else
+		} else {
 			printf("%i: test vector correct\n", i);
-#else
-			fail++;
 #endif
+		}
 	}
 
 	return ((fail == 0));