48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
From 1fd2648b118e62cff58c88e4ad71f1fe57d7905d Mon Sep 17 00:00:00 2001
|
|
From: Wenkai Lin <linwenkai6@hisilicon.com>
|
|
Date: Thu, 9 Nov 2023 11:23:44 +0800
|
|
Subject: [PATCH 62/63] cipher: add sm4 ecb mode
|
|
|
|
The sm4 ecb disappeared in the previous modification
|
|
and added its support again.
|
|
|
|
Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com>
|
|
---
|
|
src/uadk_cipher.c | 7 +++++++
|
|
src/uadk_cipher_adapter.c | 1 +
|
|
2 files changed, 8 insertions(+)
|
|
|
|
diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c
|
|
index 63cc738..12830b7 100644
|
|
--- a/src/uadk_cipher.c
|
|
+++ b/src/uadk_cipher.c
|
|
@@ -878,6 +878,13 @@ EVP_CIPHER *uadk_create_cipher_meth(int nid)
|
|
EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv);
|
|
cipher = uadk_sm4_cbc;
|
|
break;
|
|
+ case NID_sm4_ecb:
|
|
+ UADK_CIPHER_DESCR(sm4_ecb, 16, 16, 0, EVP_CIPH_ECB_MODE,
|
|
+ sizeof(struct cipher_priv_ctx), uadk_e_cipher_init,
|
|
+ uadk_e_do_cipher, uadk_e_cipher_cleanup,
|
|
+ EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv);
|
|
+ cipher = uadk_sm4_ecb;
|
|
+ break;
|
|
case NID_des_ede3_cbc:
|
|
UADK_CIPHER_DESCR(des_ede3_cbc, 8, 24, 8, EVP_CIPH_CBC_MODE,
|
|
sizeof(struct cipher_priv_ctx), uadk_e_cipher_init,
|
|
diff --git a/src/uadk_cipher_adapter.c b/src/uadk_cipher_adapter.c
|
|
index 2c4ed15..065575b 100644
|
|
--- a/src/uadk_cipher_adapter.c
|
|
+++ b/src/uadk_cipher_adapter.c
|
|
@@ -32,6 +32,7 @@ static int cipher_hw_v2_nids[] = {
|
|
NID_aes_128_xts,
|
|
NID_aes_256_xts,
|
|
NID_sm4_cbc,
|
|
+ NID_sm4_ecb,
|
|
NID_des_ede3_cbc,
|
|
NID_des_ede3_ecb,
|
|
NID_aes_128_gcm,
|
|
--
|
|
2.25.1
|
|
|