From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH v2 3/4] tests/unit: drop conditionals for SM3
Date: Mon, 2 Nov 2026 12:23:42 +0000 [thread overview]
Message-ID: <20261102122343.3348956-4-berrange@redhat.com> (raw)
In-Reply-To: <20261102122343.3348956-1-berrange@redhat.com>
There is no need to conditionalize test data for SM3, since the
test explicitly checks whether each algorithm is supported.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
tests/unit/test-crypto-hash.c | 10 ----------
tests/unit/test-crypto-hmac.c | 4 +---
2 files changed, 1 insertion(+), 13 deletions(-)
diff --git a/tests/unit/test-crypto-hash.c b/tests/unit/test-crypto-hash.c
index 8fee1593f94..1813e77b5a5 100644
--- a/tests/unit/test-crypto-hash.c
+++ b/tests/unit/test-crypto-hash.c
@@ -43,9 +43,7 @@
"63b54e4cb2d2032b393994aa263c0dbb" \
"e00a9f2fe9ef6037352232a1eec55ee7"
#define OUTPUT_RIPEMD160 "f3d658fad3fdfb2b52c9369cf0d441249ddfa8a0"
-#ifdef CONFIG_CRYPTO_SM3
#define OUTPUT_SM3 "d4a97db105b477b84c4f20ec9c31a6c814e2705a0b83a5a89748d75f0ef456a1"
-#endif
#define OUTPUT_MD5_B64 "Yo0gY3FWMDWrjvYvSSveyQ=="
#define OUTPUT_SHA1_B64 "sudPJnWKOkIeUJzuBFJEt4dTzAI="
@@ -58,9 +56,7 @@
"7sVe5w=="
#define OUTPUT_RIPEMD160_B64 "89ZY+tP9+ytSyTac8NRBJJ3fqKA="
-#ifdef CONFIG_CRYPTO_SM3
#define OUTPUT_SM3_B64 "1Kl9sQW0d7hMTyDsnDGmyBTicFoLg6Wol0jXXw70VqE="
-#endif
static const char *expected_outputs[] = {
[QCRYPTO_HASH_ALGO_MD5] = OUTPUT_MD5,
@@ -70,9 +66,7 @@ static const char *expected_outputs[] = {
[QCRYPTO_HASH_ALGO_SHA384] = OUTPUT_SHA384,
[QCRYPTO_HASH_ALGO_SHA512] = OUTPUT_SHA512,
[QCRYPTO_HASH_ALGO_RIPEMD160] = OUTPUT_RIPEMD160,
-#ifdef CONFIG_CRYPTO_SM3
[QCRYPTO_HASH_ALGO_SM3] = OUTPUT_SM3,
-#endif
};
static const char *expected_outputs_b64[] = {
[QCRYPTO_HASH_ALGO_MD5] = OUTPUT_MD5_B64,
@@ -82,9 +76,7 @@ static const char *expected_outputs_b64[] = {
[QCRYPTO_HASH_ALGO_SHA384] = OUTPUT_SHA384_B64,
[QCRYPTO_HASH_ALGO_SHA512] = OUTPUT_SHA512_B64,
[QCRYPTO_HASH_ALGO_RIPEMD160] = OUTPUT_RIPEMD160_B64,
-#ifdef CONFIG_CRYPTO_SM3
[QCRYPTO_HASH_ALGO_SM3] = OUTPUT_SM3_B64,
-#endif
};
static const int expected_lens[] = {
[QCRYPTO_HASH_ALGO_MD5] = 16,
@@ -94,9 +86,7 @@ static const int expected_lens[] = {
[QCRYPTO_HASH_ALGO_SHA384] = 48,
[QCRYPTO_HASH_ALGO_SHA512] = 64,
[QCRYPTO_HASH_ALGO_RIPEMD160] = 20,
-#ifdef CONFIG_CRYPTO_SM3
[QCRYPTO_HASH_ALGO_SM3] = 32,
-#endif
};
static const char hex[] = "0123456789abcdef";
diff --git a/tests/unit/test-crypto-hmac.c b/tests/unit/test-crypto-hmac.c
index 20c60eb9d8b..f7158621908 100644
--- a/tests/unit/test-crypto-hmac.c
+++ b/tests/unit/test-crypto-hmac.c
@@ -76,14 +76,12 @@ static QCryptoHmacTestData test_data[] = {
"94964ed4c1155b62b668c241d67279e5"
"8a711676",
},
-#ifdef CONFIG_CRYPTO_SM3
{
.alg = QCRYPTO_HASH_ALGO_SM3,
.hex_digest =
"760e3799332bc913819b930085360ddb"
- "c05529261313d5b15b75bab4fd7ae91e",
+ "c05529261313d5b15b75bab4fd7ae91e",
},
-#endif
};
static const char hex[] = "0123456789abcdef";
--
2.56.0
next prev parent reply other threads:[~2026-11-02 12:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 12:23 [PATCH v2 0/4] crypto: robustness fixes to handling of SM3 hash Daniel P. Berrangé
2026-11-02 12:23 ` [PATCH v2 1/4] crypto: set default initializer hmac/hash arrays to -1 Daniel P. Berrangé
2026-11-02 12:23 ` [PATCH v2 2/4] crypto: unconditionally report SM3 hash length Daniel P. Berrangé
2026-11-02 12:23 ` Daniel P. Berrangé [this message]
2026-11-02 12:23 ` [PATCH v2 4/4] tests/unit: register one test per hash/hmac algorithm Daniel P. Berrangé
2026-11-12 18:00 ` [PATCH v2 0/4] crypto: robustness fixes to handling of SM3 hash Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261102122343.3348956-4-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=philmd@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.