summary refs log tree commit diff stats
path: root/crypto/hmac-gcrypt.c
diff options
context:
space:
mode:
authorliequan che <liequanche@gmail.com>2024-10-30 08:51:46 +0000
committerDaniel P. Berrangé <berrange@redhat.com>2024-11-05 18:37:18 +0000
commitd078da86d61cf0f188cd099bef9b7b2dcfeba5a7 (patch)
tree7fa359d1900f7460aead1f89e59a81f2f3648835 /crypto/hmac-gcrypt.c
parent62eb377e0a3179ff57274e096eca0102f96d0170 (diff)
downloadfocaccia-qemu-d078da86d61cf0f188cd099bef9b7b2dcfeba5a7.tar.gz
focaccia-qemu-d078da86d61cf0f188cd099bef9b7b2dcfeba5a7.zip
crypto: Introduce SM3 hash hmac pbkdf algorithm
Introduce the SM3 cryptographic hash algorithm (GB/T 32905-2016).

SM3 (GB/T 32905-2016) is a cryptographic standard issued by the
Organization of State Commercial Cryptography Administration (OSCCA)
as an authorized cryptographic algorithm for use within China.

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

Signed-off-by: cheliequan <cheliequan@inspur.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'crypto/hmac-gcrypt.c')
-rw-r--r--crypto/hmac-gcrypt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/hmac-gcrypt.c b/crypto/hmac-gcrypt.c
index 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] = {
     [QCRYPTO_HASH_ALGO_SHA384] = GCRY_MAC_HMAC_SHA384,
     [QCRYPTO_HASH_ALGO_SHA512] = GCRY_MAC_HMAC_SHA512,
     [QCRYPTO_HASH_ALGO_RIPEMD160] = GCRY_MAC_HMAC_RMD160,
+#ifdef CONFIG_CRYPTO_SM3
+    [QCRYPTO_HASH_ALGO_SM3] = GCRY_MAC_HMAC_SM3,
+#endif
 };
 
 typedef struct QCryptoHmacGcrypt QCryptoHmacGcrypt;