From nobody Mon Dec 2 14:39:17 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1730249969; cv=none; d=zohomail.com; s=zohoarc; b=ig/hZodpivK2DzW9ky/8jcgtjrtHc57B+UdgKSnAxLCCLDvrjYo+AtTqYNaPTgNmnShs01lalr8Ks7svFDQF44nCJF/mMBGT5XiHUgxD51xzzqCPidgcIDDCwW0g48nyrtRx+hk1p5rsOF10TEVp0ZTFFE6EGMs3W6Mi+4CbiBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730249969; h=Content-Type:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=+pHztxssJif2BLB7dAmmda2DjTMV69nA+UprrXN0fJk=; b=OLeRc4SBJBMAYwNhi4StRUBH8cggqxOI7XVhVboATwK75vv6h97BEeeUvraBD2SBQnTaN/uqj9Y38C3Dv/wvRZN1dkf4EdCzjCq/oA9kHqiUcQdno+bUIYMJGRWDHwDoYrPpf9sZtgz3BBRGe6VBn/XH26GULgKT7uk8N2phjk0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1730249969473818.7949003389177; Tue, 29 Oct 2024 17:59:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5x2p-00005w-GD; Tue, 29 Oct 2024 20:58:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5x2k-00005g-FG for qemu-devel@nongnu.org; Tue, 29 Oct 2024 20:58:38 -0400 Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t5x2g-0005kB-Le for qemu-devel@nongnu.org; Tue, 29 Oct 2024 20:58:37 -0400 Received: by mail-oo1-xc2f.google.com with SMTP id 006d021491bc7-5eb70a779baso3220139eaf.1 for ; Tue, 29 Oct 2024 17:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730249913; x=1730854713; darn=nongnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=+pHztxssJif2BLB7dAmmda2DjTMV69nA+UprrXN0fJk=; b=i5KXPAFqIIBmgfThnSzvYdnFHVCjY9pU1JtbXoQAYMaMmFBFQ88Img2WV8bt/wzlG7 iz+VmlyfHldYAeZw4y6Wc6/erP9hUYnTCc8W4w5hvCRMSeNHbZuiEHG3dEQNpSXQ7wzE wRASI3vzMocMkz6C8rmOmYyOLtWTUqkoqdz8G6LFdK7+aU66E7li+5Ui8JDkBc5aJvpR /lkN2WTKi90APzllhREFsxMevlj7ddm0xY9oUQnFI7wkO4Fw5gwBKU99nH0n8Jj24/Ou EfA8QnqNMBE/98DbMwvIq87Os9OMFSIvjCWX1EyJUV1m6ZpD+kZ/vi6LxLaAlswWLj6V uxBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730249913; x=1730854713; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+pHztxssJif2BLB7dAmmda2DjTMV69nA+UprrXN0fJk=; b=ZDjKfYvZifYdnM03GHL3cKUKAnSZGJNDZxCwsyCbht6NOJ0BSRAA0DU4NhswhqUA7o BKmVRI1m6SIaKHuj+QEpBRR/E2Li10JOH3ZyOutkn54K2G2gnHQiaXA3qS0Cpgr4coNp aDT25uc8KtvbI94E+/kAtc2JNWZFsB6eiR7SFBGegEHA6gnIEOeEr0QTg9TneWlxlGr+ PBWuGR+tONuRrmRSNfaEC30Or69iH7fnbUf3TMpC/nthxiYumLH8DYVNMVfv/LDufrR0 NQgIAMjF/xhTwQAsSqPKwXDd3ZmNqTzCIQEAI1v9+Zeoq5BUOz2RTHPuce32b8faI0gD 7kLA== X-Gm-Message-State: AOJu0YyPZgEci8NSCBaZBezbL/05Me/Vu8GcYNdLoy5SvOvMMu2Cq/as eNlgo80NgWT8NjwJNeDovGzuSxYK8TXuVM3pJyXaZL87bLVxUFmDippJDetmmI1yEMhs3VUBVyU H7U9z8Ui86Atd7/t+2YVpZR6y76UYiQ== X-Google-Smtp-Source: AGHT+IGYdC3SqUSUp/uzbhOuPfijV9CnpSwMpgzV3ts4JUxAxOHPkDu9Ev+a864Mch1jgA73MaiesmxyEo+LKZyvLyU= X-Received: by 2002:a05:6358:72a:b0:1b8:21d6:6034 with SMTP id e5c5f4694b2df-1c5e32cb7e9mr234583755d.8.1730249912563; Tue, 29 Oct 2024 17:58:32 -0700 (PDT) MIME-Version: 1.0 From: liequan che Date: Wed, 30 Oct 2024 08:58:21 +0800 Message-ID: Subject: [PATCH V3] crypto: Introduce SM3 hash hmac pbkdf algorithm To: qemu-devel@nongnu.org, =?UTF-8?Q?Daniel_P=2E_Berrang=C3=A9?= Content-Type: multipart/alternative; boundary="000000000000693dd60625a7336a" Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c2f; envelope-from=liequanche@gmail.com; helo=mail-oo1-xc2f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1730249970415116600 Content-Transfer-Encoding: quoted-printable --000000000000693dd60625a7336a MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 SW50cm9kdWNlIHRoZSBTTTMgY3J5cHRvZ3JhcGhpYyBoYXNoIGFsZ29yaXRobSAoR0IvVCAzMjkw NS0yMDE2KS4KClNNMyAoR0IvVCAzMjkwNS0yMDE2KSBpcyBhIGNyeXB0b2dyYXBoaWMgc3RhbmRh cmQgaXNzdWVkIGJ5IHRoZQpPcmdhbml6YXRpb24gb2YgU3RhdGUgQ29tbWVyY2lhbCBDcnlwdG9n cmFwaHkgQWRtaW5pc3RyYXRpb24gKE9TQ0NBKQphcyBhbiBhdXRob3JpemVkIGNyeXB0b2dyYXBo aWMgYWxnb3JpdGhtIGZvciB1c2Ugd2l0aGluIENoaW5hLgoKRGV0ZWN0IHRoZSBTTTMgY3J5cHRv Z3JhcGhpYyBoYXNoIGFsZ29yaXRobSBhbmQgZW5hYmxlIHRoZSBmZWF0dXJlIHNpbGVudGx5Cmlm IGl0IGlzIGF2YWlsYWJsZS4KClNpZ25lZC1vZmYtYnk6IGNoZWxpZXF1YW4gPGNoZWxpZXF1YW5A aW5zcHVyLmNvbT4KLS0tCiBjcnlwdG8vaGFzaC1nY3J5cHQuYyAgICAgICAgICAgfCAgMyArKysK IGNyeXB0by9oYXNoLW5ldHRsZS5jICAgICAgICAgICB8IDE0ICsrKysrKysrKysrKwogY3J5cHRv L2hhc2guYyAgICAgICAgICAgICAgICAgIHwgIDMgKysrCiBjcnlwdG8vaG1hYy1nY3J5cHQuYyAg ICAgICAgICAgfCAgMyArKysKIGNyeXB0by9obWFjLW5ldHRsZS5jICAgICAgICAgICB8IDExICsr KysrKysrKysKIGNyeXB0by9wYmtkZi1nY3J5cHQuYyAgICAgICAgICB8ICA2ICsrKysrKwogY3J5 cHRvL3Bia2RmLW5ldHRsZS5jICAgICAgICAgIHwgMTMgKysrKysrKysrKysrCiBpbmNsdWRlL2Ny eXB0by9oYXNoLmggICAgICAgICAgfCAgMSArCiBtZXNvbi5idWlsZCAgICAgICAgICAgICAgICAg ICAgfCAzOSArKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrCiBxYXBpL2NyeXB0by5q c29uICAgICAgICAgICAgICAgfCAgMyArKy0KIHRlc3RzL3VuaXQvdGVzdC1jcnlwdG8taGFzaC5j ICB8IDE2ICsrKysrKysrKysrKysrCiB0ZXN0cy91bml0L3Rlc3QtY3J5cHRvLWhtYWMuYyAgfCAg OCArKysrKysrCiB0ZXN0cy91bml0L3Rlc3QtY3J5cHRvLXBia2RmLmMgfCAxNiArKysrKysrKysr KysrKwogMTMgZmlsZXMgY2hhbmdlZCwgMTM1IGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkK CmRpZmYgLS1naXQgYS9jcnlwdG8vaGFzaC1nY3J5cHQuYyBiL2NyeXB0by9oYXNoLWdjcnlwdC5j CmluZGV4IDczNTMzYTQ5NDkuLmYwN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gPTNEIG5vdF9mb3VuZAogICAgIGVuZGlmCisgICAg Y3J5cHRvX3NtMyA9M0QgbmV0dGxlCisgICAgIyBTTTMgQUxHIGlzIGF2YWlsYWJsZSBpbiBuZXR0 bGUgPj0zRCAzLjgKKyAgICBpZiBuZXR0bGUuZm91bmQoKSBhbmQgbm90IGNjLmxpbmtzKCcnJwor ICAgICAgI2luY2x1ZGUgPG5ldHRsZS9zbTMuaD4KKyAgICAgICNpbmNsdWRlIDxuZXR0bGUvaG1h Yy5oPgorICAgICAgaW50IG1haW4odm9pZCkgeworICAgICAgc3RydWN0IHNtM19jdHggY3R4Owor ICAgICAgc3RydWN0IGhtYWNfc20zX2N0eCBobWFjX2N0eDsKKyAgICAgIHVuc2lnbmVkIGNoYXIg ZGF0YVs2NF0gPTNEIHswfTsKKyAgICAgIHVuc2lnbmVkIGNoYXIgb3V0cHV0WzMyXTsKKworICAg ICAgLy8gU00zIGhhc2ggZnVuY3Rpb24gdGVzdAorICAgICAgc20zX2luaXQoJmN0eCk7CisgICAg ICBzbTNfdXBkYXRlKCZjdHgsIDY0LCBkYXRhKTsKKyAgICAgIHNtM19kaWdlc3QoJmN0eCwgMzIs IGRhdGEpOworCisgICAgICAvLyBITUFDLVNNMyB0ZXN0CisgICAgICBobWFjX3NtM19zZXRfa2V5 KCZobWFjX2N0eCwgMzIsIGRhdGEpOworICAgICAgaG1hY19zbTNfdXBkYXRlKCZobWFjX2N0eCwg NjQsIGRhdGEpOworICAgICAgaG1hY19zbTNfZGlnZXN0KCZobWFjX2N0eCwgMzIsIG91dHB1dCk7 CisKKyAgICAgIHJldHVybiAwOworICAgICAgfScnJywgZGVwZW5kZW5jaWVzOiBuZXR0bGUpCisg ICAgICBjcnlwdG9fc20zID0zRCBub3RfZm91bmQKKyAgICBlbmRpZgogICBlbmRpZgogZW5kaWYK CkBAIC0yNDUzLDYgKzI0OTAsNyBAQCBjb25maWdfaG9zdF9kYXRhLnNldCgnQ09ORklHX1RBU04x JywgdGFzbj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zdHMvdW5p dC90ZXN0LWNyeXB0by1wYmtkZi5jIGIvdGVzdHMvdW5pdC90ZXN0LWNyeXB0by1wYmtkZi5jCmlu ZGV4IDEyZWU4MDhmYmMuLjA2MWE4ZGExMzkgMTAwNjQ0Ci0tLSBhL3Rlc3RzL3VuaXQvdGVzdC1j cnlwdG8tcGJrZGYuYworKysgYi90ZXN0cy91bml0L3Rlc3QtY3J5cHRvLXBia2RmLmMKQEAgLTMy NSw2ICszMjUsMjIgQEAgc3RhdGljIFFDcnlwdG9QYmtkZlRlc3REYXRhIHRlc3RfZGF0YVtdID0z RCB7CiAgICAgICAgICAgICAgICAiXHhjZVx4YmZceDkxXHgxNFx4OGJceDVjXHg0OFx4NDEiLAog ICAgICAgICAubm91dCA9M0QgMzIKICAgICB9LAorI2lmZGVmIENPTkZJR19DUllQVE9fU00zCisg ICAgeworICAgICAgICAucGF0aCA9M0QgIi9jcnlwdG8vcGJrZGYvbm9ucmZjL3NtMy9pdGVyMiIs CisgICAgICAgIC5oYXNoID0zRCBRQ1JZUFRPX0hBU0hfQUxHT19TTTMsCisgICAgICAgIC5pdGVy YXRpb25zID0zRCAyLAorICAgICAgICAua2V5ID0zRCAicGFzc3dvcmQiLAorICAgICAgICAubmtl eSA9M0QgOCwKKyAgICAgICAgLnNhbHQgPTNEICJBVEhFTkEuTUlULkVEVXJhZWJ1cm4iLAorICAg ICAgICAubnNhbHQgPTNEIDIxLAorICAgICAgICAub3V0ID0zRCAiXHg0OFx4NzFceDFiXHg1OFx4 YTNceGNiXHhjZVx4MDYiCisgIlx4YmFceGFkXHg3N1x4YThceGI1XHhiOVx4ZDhceDA3IgorICJc eDZhXHhlMlx4YjNceDViXHg5NVx4Y2VceGM4XHhjZSIKKyAiXHhlN1x4YjFceGNiXHhlZVx4NjFc eGRmXHgwNFx4ZWEiLAorICAgICAgICAubm91dCA9M0QgMzIKKyAgICB9LAorI2VuZGlmCiAjaWYg MAogICAgIHsKICAgICAgICAgLnBhdGggPTNEICIvY3J5cHRvL3Bia2RmL25vbnJmYy93aGlybHBv b2wvaXRlcjEyMDAiLAotLT0yMAoyLjMzLjA= --000000000000693dd60625a7336a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Introduce the SM3 cryptographic hash algo= rithm (GB/T 32905-2016).

SM3 (GB/T 32905-2016) is a cryptographic st= andard issued by the
Organization of State Commercial Cryptography Admin= istration (OSCCA)
as an authorized cryptographic algorithm for use withi= n China.

Detect the SM3 cryptographic hash algorithm and enable the = feature silently
if it is available.

Signed-off-by: cheliequan &l= t;cheliequan@ins= pur.com>
---
=C2=A0crypto/hash-gcrypt.c =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 | =C2=A03 +++
=C2=A0crypto/hash-nettle.c =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 | 14 ++++++++++++
=C2=A0crypto/hash.c =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A03 +++
=C2=A0cryp= to/hmac-gcrypt.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A03 +++
=C2=A0= crypto/hmac-nettle.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 11 ++++++++++
= =C2=A0crypto/pbkdf-gcrypt.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A06 +++= +++
=C2=A0crypto/pbkdf-nettle.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 13 += +++++++++++
=C2=A0include/crypto/hash.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0| =C2=A01 +
=C2=A0meson.build =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 39 ++++++++++++++++++++++++++++++++++
= =C2=A0qapi/crypto.json =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | = =C2=A03 ++-
=C2=A0tests/unit/test-crypto-hash.c =C2=A0| 16 +++++++++++++= +
=C2=A0tests/unit/test-crypto-hmac.c =C2=A0| =C2=A08 +++++++
=C2=A0t= ests/unit/test-crypto-pbkdf.c | 16 ++++++++++++++
=C2=A013 files changed= , 135 insertions(+), 1 deletion(-)

diff --git a/crypto/hash-gcrypt.c= b/crypto/hash-gcrypt.c
index 73533a4949..f04a9f553c 100644
--- a/cry= pto/hash-gcrypt.c
+++ b/crypto/hash-gcrypt.c
@@ -34,6 +34,9 @@ static= int qcrypto_hash_alg_map[QCRYPTO_HASH_ALGO__MAX] =3D {
=C2=A0 =C2=A0 = =C2=A0[QCRYPTO_HASH_ALGO_SHA384] =3D GCRY_MD_SHA384,
=C2=A0 =C2=A0 =C2= =A0[QCRYPTO_HASH_ALGO_SHA512] =3D GCRY_MD_SHA512,
=C2=A0 =C2=A0 =C2=A0[Q= CRYPTO_HASH_ALGO_RIPEMD160] =3D GCRY_MD_RMD160,
+#ifdef CONFIG_CRYPTO_SM= 3
+ =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SM3] =3D GCRY_MD_SM3,
+#endif
= =C2=A0};
=C2=A0
=C2=A0gboolean qcrypto_hash_supports(QCryptoHashAlgo = alg)
diff --git a/crypto/hash-nettle.c b/crypto/hash-nettle.c
index c= 78624b347..53f68301ef 100644
--- a/crypto/hash-nettle.c
+++ b/crypto/= hash-nettle.c
@@ -26,6 +26,9 @@
=C2=A0#include <nettle/md5.h>=C2=A0#include <nettle/sha.h>
=C2=A0#include <nettle/ripemd16= 0.h>
+#ifdef CONFIG_CRYPTO_SM3
+#include <nettle/sm3.h>
+= #endif
=C2=A0
=C2=A0typedef void (*qcrypto_nettle_init)(void *ctx);=C2=A0typedef void (*qcrypto_nettle_write)(void *ctx,
@@ -43,6 +46,9 @= @ union qcrypto_hash_ctx {
=C2=A0 =C2=A0 =C2=A0struct sha384_ctx sha384;=
=C2=A0 =C2=A0 =C2=A0struct sha512_ctx sha512;
=C2=A0 =C2=A0 =C2=A0st= ruct ripemd160_ctx ripemd160;
+#ifdef CONFIG_CRYPTO_SM3
+ =C2=A0 =C2= =A0struct sm3_ctx sm3;
+#endif
=C2=A0};
=C2=A0
=C2=A0struct qcr= ypto_hash_alg {
@@ -93,6 +99,14 @@ struct qcrypto_hash_alg {
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0.result =3D (qcrypto_nettle_result)ripemd160_dig= est,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.len =3D RIPEMD160_DIGEST_SIZE,=C2=A0 =C2=A0 =C2=A0},
+#ifdef CONFIG_CRYPTO_SM3
+ =C2=A0 =C2=A0[QC= RYPTO_HASH_ALGO_SM3] =3D {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.init =3D (qcryp= to_nettle_init)sm3_init,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.write =3D (qcrypt= o_nettle_write)sm3_update,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.result =3D (qcr= ypto_nettle_result)sm3_digest,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.len =3D SM3= _DIGEST_SIZE,
+ =C2=A0 =C2=A0},
+#endif
=C2=A0};
=C2=A0
=C2= =A0gboolean qcrypto_hash_supports(QCryptoHashAlgo alg)
diff --git a/cryp= to/hash.c b/crypto/hash.c
index 0c8548c568..7513769e42 100644
--- a/c= rypto/hash.c
+++ b/crypto/hash.c
@@ -33,6 +33,9 @@ static size_t qcry= pto_hash_alg_size[QCRYPTO_HASH_ALGO__MAX] =3D {
=C2=A0 =C2=A0 =C2=A0[QCR= YPTO_HASH_ALGO_SHA384] =C2=A0 =C2=A0=3D QCRYPTO_HASH_DIGEST_LEN_SHA384,
= =C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SHA512] =C2=A0 =C2=A0=3D QCRYPTO_HAS= H_DIGEST_LEN_SHA512,
=C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_RIPEMD160] = =3D QCRYPTO_HASH_DIGEST_LEN_RIPEMD160,
+#ifdef CONFIG_CRYPTO_SM3
+ = =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SM3] =3D QCRYPTO_HASH_DIGEST_LEN_SM3,
+#= endif
=C2=A0};
=C2=A0
=C2=A0size_t qcrypto_hash_digest_len(QCrypto= HashAlgo alg)
diff --git a/crypto/hmac-gcrypt.c b/crypto/hmac-gcrypt.cindex 19990cb6ed..090fe01c1e 100644
--- a/crypto/hmac-gcrypt.c
+++ = b/crypto/hmac-gcrypt.c
@@ -26,6 +26,9 @@ static int qcrypto_hmac_alg_map= [QCRYPTO_HASH_ALGO__MAX] =3D {
=C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SH= A384] =3D GCRY_MAC_HMAC_SHA384,
=C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_S= HA512] =3D GCRY_MAC_HMAC_SHA512,
=C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_= RIPEMD160] =3D GCRY_MAC_HMAC_RMD160,
+#ifdef CONFIG_CRYPTO_SM3
+ =C2= =A0 =C2=A0[QCRYPTO_HASH_ALGO_SM3] =3D GCRY_MAC_HMAC_SM3,
+#endif
=C2= =A0};
=C2=A0
=C2=A0typedef struct QCryptoHmacGcrypt QCryptoHmacGcrypt= ;
diff --git a/crypto/hmac-nettle.c b/crypto/hmac-nettle.c
index 54dd= 75d5ff..4755f2caca 100644
--- a/crypto/hmac-nettle.c
+++ b/crypto/hma= c-nettle.c
@@ -38,6 +38,9 @@ struct QCryptoHmacNettle {
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0struct hmac_sha256_ctx sha256_ctx; /* equals hmac_sha2= 24_ctx */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct hmac_sha512_ctx sha51= 2_ctx; /* equals hmac_sha384_ctx */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0st= ruct hmac_ripemd160_ctx ripemd160_ctx;
+#ifdef CONFIG_CRYPTO_SM3
+ st= ruct hmac_sm3_ctx ctx;
+#endif
=C2=A0 =C2=A0 =C2=A0} u;
=C2=A0};=C2=A0
@@ -89,6 +92,14 @@ struct qcrypto_nettle_hmac_alg {
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0.digest =3D (qcrypto_nettle_hmac_digest)hmac_rip= emd160_digest,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.len =3D RIPEMD160_DIGE= ST_SIZE,
=C2=A0 =C2=A0 =C2=A0},
+#ifdef CONFIG_CRYPTO_SM3
+ =C2=A0= =C2=A0[QCRYPTO_HASH_ALGO_SM3] =3D {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.setke= y =3D (qcrypto_nettle_hmac_setkey)hmac_sm3_set_key,
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0.update =3D (qcrypto_nettle_hmac_update)hmac_sm3_update,
+ =C2= =A0 =C2=A0 =C2=A0 =C2=A0.digest =3D (qcrypto_nettle_hmac_digest)hmac_sm3_di= gest,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.len =3D SM3_DIGEST_SIZE,
+ =C2=A0= =C2=A0},
+#endif
=C2=A0};
=C2=A0
=C2=A0bool qcrypto_hmac_suppo= rts(QCryptoHashAlgo alg)
diff --git a/crypto/pbkdf-gcrypt.c b/crypto/pbk= df-gcrypt.c
index 76bbb55f7a..e89b8b1c76 100644
--- a/crypto/pbkdf-gc= rypt.c
+++ b/crypto/pbkdf-gcrypt.c
@@ -33,6 +33,9 @@ bool qcrypto_pbk= df2_supports(QCryptoHashAlgo hash)
=C2=A0 =C2=A0 =C2=A0case QCRYPTO_HASH= _ALGO_SHA384:
=C2=A0 =C2=A0 =C2=A0case QCRYPTO_HASH_ALGO_SHA512:
=C2= =A0 =C2=A0 =C2=A0case QCRYPTO_HASH_ALGO_RIPEMD160:
+#ifdef CONFIG_CRYPTO= _SM3
+ =C2=A0 =C2=A0case QCRYPTO_HASH_ALGO_SM3:
+#endif
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0return qcrypto_hash_supports(hash);
=C2=A0 =C2= =A0 =C2=A0default:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return false;
@@= -54,6 +57,9 @@ int qcrypto_pbkdf2(QCryptoHashAlgo hash,
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SHA384] =3D GCRY_MD_SHA384,
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SHA512] =3D GCRY_MD_SHA51= 2,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_RIPEMD160] =3D G= CRY_MD_RMD160,
+#ifdef CONFIG_CRYPTO_SM3
+ =C2=A0 =C2=A0 =C2=A0 =C2= =A0[QCRYPTO_HASH_ALGO_SM3] =3D GCRY_MD_SM3,
+#endif
=C2=A0 =C2=A0 =C2= =A0};
=C2=A0 =C2=A0 =C2=A0int ret;
=C2=A0
diff --git a/crypto/pbkd= f-nettle.c b/crypto/pbkdf-nettle.c
index 93e686c2c6..3ef9c1b52c 100644--- a/crypto/pbkdf-nettle.c
+++ b/crypto/pbkdf-nettle.c
@@ -34,6 +3= 4,9 @@ bool qcrypto_pbkdf2_supports(QCryptoHashAlgo hash)
=C2=A0 =C2=A0 = =C2=A0case QCRYPTO_HASH_ALGO_SHA384:
=C2=A0 =C2=A0 =C2=A0case QCRYPTO_HA= SH_ALGO_SHA512:
=C2=A0 =C2=A0 =C2=A0case QCRYPTO_HASH_ALGO_RIPEMD160:+#ifdef CONFIG_CRYPTO_SM3
+ =C2=A0 =C2=A0case QCRYPTO_HASH_ALGO_SM3:+#endif
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return true;
=C2=A0 =C2=A0= =C2=A0default:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return false;
@@ -5= 5,6 +58,9 @@ int qcrypto_pbkdf2(QCryptoHashAlgo hash,
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0struct hmac_sha384_ctx sha384;
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0struct hmac_sha512_ctx sha512;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0struct hmac_ripemd160_ctx ripemd160;
+#ifdef CONFIG_CRYPTO_SM3
+ = =C2=A0 =C2=A0 =C2=A0 =C2=A0struct hmac_sm3_ctx sm3;
+#endif
=C2=A0 = =C2=A0 =C2=A0} ctx;
=C2=A0
=C2=A0 =C2=A0 =C2=A0if (iterations > UI= NT_MAX) {
@@ -106,6 +112,13 @@ int qcrypto_pbkdf2(QCryptoHashAlgo hash,<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PBKDF2(&ctx.ripemd160, hmac_ripemd= 160_update, hmac_ripemd160_digest,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 RIPEMD160_DIGEST_SIZE, iterations, nsalt, salt, nout, = out);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break;
+#ifdef CONFIG_CRYPTO_= SM3
+ =C2=A0 =C2=A0case QCRYPTO_HASH_ALGO_SM3:
+ =C2=A0 =C2=A0 =C2=A0= =C2=A0hmac_sm3_set_key(&ctx.sm3, nkey, key);
+ =C2=A0 =C2=A0 =C2=A0= =C2=A0PBKDF2(&ctx.sm3, hmac_sm3_update, hmac_sm3_digest,
+ =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SM3_DIGEST_SIZE, iterations, nsal= t, salt, nout, out);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0break;
+#endif
= =C2=A0
=C2=A0 =C2=A0 =C2=A0default:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0error_setg_errno(errp, ENOSYS,
diff --git a/include/crypto/hash.h b/i= nclude/crypto/hash.h
index 712cac79ee..1868d4a0f7 100644
--- a/includ= e/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -31,6 +31,7 @@
=C2= =A0#define QCRYPTO_HASH_DIGEST_LEN_SHA384 =C2=A0 =C2=A048
=C2=A0#define = QCRYPTO_HASH_DIGEST_LEN_SHA512 =C2=A0 =C2=A064
=C2=A0#define QCRYPTO_HAS= H_DIGEST_LEN_RIPEMD160 20
+#define QCRYPTO_HASH_DIGEST_LEN_SM3 =C2=A0 = =C2=A0 =C2=A0 32
=C2=A0
=C2=A0/* See also "QCryptoHashAlgo"= defined in qapi/crypto.json */
=C2=A0
diff --git a/meson.build b/mes= on.build
index 85594fd3f1..b378157638 100644
--- a/meson.build
+++= b/meson.build
@@ -1754,6 +1754,7 @@ gcrypt =3D not_found
=C2=A0nettl= e =3D not_found
=C2=A0hogweed =3D not_found
=C2=A0crypto_sm4 =3D not_= found
+crypto_sm3 =3D not_found
=C2=A0xts =3D 'none'
=C2= =A0
=C2=A0if get_option('nettle').enabled() and get_option('= gcrypt').enabled()
@@ -1789,6 +1790,17 @@ if not gnutls_crypto.found= ()
=C2=A0 =C2=A0 =C2=A0 =C2=A0}''', dependencies: gcrypt)=C2=A0 =C2=A0 =C2=A0 =C2=A0crypto_sm4 =3D not_found
=C2=A0 =C2=A0 =C2= =A0endif
+ =C2=A0 =C2=A0crypto_sm3 =3D gcrypt
+ =C2=A0 =C2=A0# SM3 AL= G is available in libgcrypt >=3D 1.9
+ =C2=A0 =C2=A0if gcrypt.found()= and not cc.links('''
+ =C2=A0 =C2=A0 =C2=A0#include <gcr= ypt.h>
+ =C2=A0 =C2=A0 =C2=A0int main(void) {
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0gcry_md_hd_t handler;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0gcry_md_ope= n(&handler, GCRY_MD_SM3, 0);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;<= br>+ =C2=A0 =C2=A0 =C2=A0}''', dependencies: gcrypt)
+ =C2= =A0 =C2=A0 =C2=A0crypto_sm3 =3D not_found
+ =C2=A0 =C2=A0endif
=C2=A0= =C2=A0endif
=C2=A0 =C2=A0if (not get_option('nettle').auto() or= have_system) and not gcrypt.found()
=C2=A0 =C2=A0 =C2=A0nettle =3D depe= ndency('nettle', version: '>=3D3.4',
@@ -1809,6 +1821= ,31 @@ if not gnutls_crypto.found()
=C2=A0 =C2=A0 =C2=A0 =C2=A0}'= 9;', dependencies: nettle)
=C2=A0 =C2=A0 =C2=A0 =C2=A0crypto_sm4 =3D= not_found
=C2=A0 =C2=A0 =C2=A0endif
+ =C2=A0 =C2=A0crypto_sm3 =3D ne= ttle
+ =C2=A0 =C2=A0# SM3 ALG is available in nettle >=3D 3.8
+ = =C2=A0 =C2=A0if nettle.found() and not cc.links('''
+ =C2=A0= =C2=A0 =C2=A0#include <nettle/sm3.h>
+ =C2=A0 =C2=A0 =C2=A0#inclu= de <nettle/hmac.h>
+ =C2=A0 =C2=A0 =C2=A0int main(void) {
+ =C2= =A0 =C2=A0 =C2=A0struct sm3_ctx ctx;
+ =C2=A0 =C2=A0 =C2=A0struct hmac_s= m3_ctx hmac_ctx;
+ =C2=A0 =C2=A0 =C2=A0unsigned char data[64] =3D {0};+ =C2=A0 =C2=A0 =C2=A0unsigned char output[32];
+ =C2=A0 =C2=A0
+ = =C2=A0 =C2=A0 =C2=A0// SM3 hash function test
+ =C2=A0 =C2=A0 =C2=A0sm3_= init(&ctx);
+ =C2=A0 =C2=A0 =C2=A0sm3_update(&ctx, 64, data);+ =C2=A0 =C2=A0 =C2=A0sm3_digest(&ctx, 32, data);
+
+ =C2=A0 =C2= =A0 =C2=A0// HMAC-SM3 test
+ =C2=A0 =C2=A0 =C2=A0hmac_sm3_set_key(&h= mac_ctx, 32, data);
+ =C2=A0 =C2=A0 =C2=A0hmac_sm3_update(&hmac_ctx,= 64, data);
+ =C2=A0 =C2=A0 =C2=A0hmac_sm3_digest(&hmac_ctx, 32, out= put);
+ =C2=A0 =C2=A0
+ =C2=A0 =C2=A0 =C2=A0return 0;
+ =C2=A0 =C2= =A0 =C2=A0}''', dependencies: nettle)
+ =C2=A0 =C2=A0 =C2=A0= crypto_sm3 =3D not_found
+ =C2=A0 =C2=A0endif
=C2=A0 =C2=A0endif
= =C2=A0endif
=C2=A0
@@ -2453,6 +2490,7 @@ config_host_data.set('CO= NFIG_TASN1', tasn1.found())
=C2=A0config_host_data.set('CONFIG_G= CRYPT', gcrypt.found())
=C2=A0config_host_data.set('CONFIG_NETTL= E', nettle.found())
=C2=A0config_host_data.set('CONFIG_CRYPTO_SM= 4', crypto_sm4.found())
+config_host_data.set('CONFIG_CRYPTO_SM3= ', crypto_sm3.found())
=C2=A0config_host_data.set('CONFIG_HOGWEE= D', hogweed.found())
=C2=A0config_host_data.set('CONFIG_QEMU_PRI= VATE_XTS', xts =3D=3D 'private')
=C2=A0config_host_data.set(= 'CONFIG_MALLOC_TRIM', has_malloc_trim)
@@ -4578,6 +4616,7 @@ if = nettle.found()
=C2=A0 =C2=A0 summary_info +=3D {' =C2=A0XTS': = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 xts !=3D 'private'}
= =C2=A0endif
=C2=A0summary_info +=3D {'SM4 ALG support': =C2=A0 c= rypto_sm4}
+summary_info +=3D {'SM3 ALG support': =C2=A0 crypto_= sm3}
=C2=A0summary_info +=3D {'AF_ALG support': =C2=A0 =C2=A0hav= e_afalg}
=C2=A0summary_info +=3D {'rng-none': =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0get_option('rng_none')}
=C2=A0summary_info +=3D= {'Linux keyring': =C2=A0 =C2=A0 have_keyring}
diff --git a/qapi= /crypto.json b/qapi/crypto.json
index 9431522768..4219d0fa16 100644
-= -- a/qapi/crypto.json
+++ b/qapi/crypto.json
@@ -55,11 +55,12 @@
= =C2=A0# @sha512: SHA-512. =C2=A0(since 2.7)
=C2=A0#
=C2=A0# @ripemd16= 0: RIPEMD-160. =C2=A0(since 2.7)
+# @sm3: SM3. (since 9.2.0)
=C2=A0#<= br>=C2=A0# Since: 2.6
=C2=A0##
=C2=A0{ 'enum': 'QCryptoHa= shAlgo',
- =C2=A0'data': ['md5', 'sha1', = 9;sha224', 'sha256', 'sha384', 'sha512', 'r= ipemd160']}
+ =C2=A0'data': ['md5', 'sha1', = 'sha224', 'sha256', 'sha384', 'sha512', = 9;ripemd160', 'sm3']}
=C2=A0
=C2=A0##
=C2=A0# @QCrypto= CipherAlgo:
diff --git a/tests/unit/test-crypto-hash.c b/tests/unit/test= -crypto-hash.c
index 76c4699c15..8fee1593f9 100644
--- a/tests/unit/t= est-crypto-hash.c
+++ b/tests/unit/test-crypto-hash.c
@@ -43,6 +43,9 = @@
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0"63b54e4cb2d2032b393994aa263c0dbb" \
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&q= uot;e00a9f2fe9ef6037352232a1eec55ee7"
=C2=A0#define OUTPUT_RIPEMD16= 0 "f3d658fad3fdfb2b52c9369cf0d441249ddfa8a0"
+#ifdef CONFIG_CR= YPTO_SM3
+#define OUTPUT_SM3 "d4a97db105b477b84c4f20ec9c31a6c814e27= 05a0b83a5a89748d75f0ef456a1"
+#endif
=C2=A0
=C2=A0#define OUT= PUT_MD5_B64 "Yo0gY3FWMDWrjvYvSSveyQ=3D=3D"
=C2=A0#define OUTPU= T_SHA1_B64 "sudPJnWKOkIeUJzuBFJEt4dTzAI=3D"
@@ -55,6 +58,10 @@=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0"7sVe5w=3D=3D"
=C2=A0#define OUTPUT= _RIPEMD160_B64 "89ZY+tP9+ytSyTac8NRBJJ3fqKA=3D"
=C2=A0
+#if= def CONFIG_CRYPTO_SM3
+#define OUTPUT_SM3_B64 "1Kl9sQW0d7hMTyDsnDGm= yBTicFoLg6Wol0jXXw70VqE=3D"
+#endif
+
=C2=A0static const char= *expected_outputs[] =3D {
=C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_MD5] = =3D OUTPUT_MD5,
=C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SHA1] =3D OUTPUT_= SHA1,
@@ -63,6 +70,9 @@ static const char *expected_outputs[] =3D {
= =C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SHA384] =3D OUTPUT_SHA384,
=C2=A0= =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SHA512] =3D OUTPUT_SHA512,
=C2=A0 =C2= =A0 =C2=A0[QCRYPTO_HASH_ALGO_RIPEMD160] =3D OUTPUT_RIPEMD160,
+#ifdef CO= NFIG_CRYPTO_SM3
+ =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SM3] =3D OUTPUT_SM3,+#endif
=C2=A0};
=C2=A0static const char *expected_outputs_b64[] = =3D {
=C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_MD5] =3D OUTPUT_MD5_B64,@@ -72,6 +82,9 @@ static const char *expected_outputs_b64[] =3D {
=C2= =A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SHA384] =3D OUTPUT_SHA384_B64,
=C2= =A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SHA512] =3D OUTPUT_SHA512_B64,
=C2= =A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_RIPEMD160] =3D OUTPUT_RIPEMD160_B64,+#ifdef CONFIG_CRYPTO_SM3
+ =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SM3] =3D OU= TPUT_SM3_B64,
+#endif
=C2=A0};
=C2=A0static const int expected_len= s[] =3D {
=C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_MD5] =3D 16,
@@ -81,= 6 +94,9 @@ static const int expected_lens[] =3D {
=C2=A0 =C2=A0 =C2=A0[Q= CRYPTO_HASH_ALGO_SHA384] =3D 48,
=C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_= SHA512] =3D 64,
=C2=A0 =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_RIPEMD160] =3D 20= ,
+#ifdef CONFIG_CRYPTO_SM3
+ =C2=A0 =C2=A0[QCRYPTO_HASH_ALGO_SM3] = =3D 32,
+#endif
=C2=A0};
=C2=A0
=C2=A0static const char hex[] = =3D "0123456789abcdef";
diff --git a/tests/unit/test-crypto-hm= ac.c b/tests/unit/test-crypto-hmac.c
index cdb8774443..d8774bed01 100644=
--- a/tests/unit/test-crypto-hmac.c
+++ b/tests/unit/test-crypto-hma= c.c
@@ -76,6 +76,14 @@ static QCryptoHmacTestData test_data[] =3D {
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"94964ed4c1155b62b668c= 241d67279e5"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"= 8a711676",
=C2=A0 =C2=A0 =C2=A0},
+#ifdef CONFIG_CRYPTO_SM3
+= =C2=A0 =C2=A0{
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.alg =3D QCRYPTO_HASH_ALGO_= SM3,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.hex_digest =3D
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0"760e3799332bc913819b930085360ddb"
+ = =C2=A0 =C2=A0"c05529261313d5b15b75bab4fd7ae91e",
+ =C2=A0 =C2= =A0},
+#endif
=C2=A0};
=C2=A0
=C2=A0static const char hex[] =3D= "0123456789abcdef";
diff --git a/tests/unit/test-crypto-pbkdf= .c b/tests/unit/test-crypto-pbkdf.c
index 12ee808fbc..061a8da139 100644<= br>--- a/tests/unit/test-crypto-pbkdf.c
+++ b/tests/unit/test-crypto-pbk= df.c
@@ -325,6 +325,22 @@ static QCryptoPbkdfTestData test_data[] =3D {<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "\xce\xbf\x= 91\x14\x8b\x5c\x48\x41",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.nout = =3D 32
=C2=A0 =C2=A0 =C2=A0},
+#ifdef CONFIG_CRYPTO_SM3
+ =C2=A0 = =C2=A0{
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.path =3D "/crypto/pbkdf/nonrf= c/sm3/iter2",
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.hash =3D QCRYPTO_HASH_A= LGO_SM3,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.iterations =3D 2,
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0.key =3D "password",
+ =C2=A0 =C2=A0 =C2=A0 = =C2=A0.nkey =3D 8,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.salt =3D "ATHENA.M= IT.EDUraeburn",
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.nsalt =3D 21,
+ = =C2=A0 =C2=A0 =C2=A0 =C2=A0.out =3D "\x48\x71\x1b\x58\xa3\xcb\xce\x06&= quot;
+ "\xba\xad\x77\xa8\xb5\xb9\xd8\x07"
+ "\x6a\x= e2\xb3\x5b\x95\xce\xc8\xce"
+ "\xe7\xb1\xcb\xee\x61\xdf\x04\x= ea",
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0.nout =3D 32
+ =C2=A0 =C2=A0},=
+#endif
=C2=A0#if 0
=C2=A0 =C2=A0 =C2=A0{
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0.path =3D "/crypto/pbkdf/nonrfc/whirlpool/iter1200"= ,
--
2.33.0
--000000000000693dd60625a7336a--