From: Hao Fang fanghao11@huawei.com
Hardware version numbers are used to distinguish different hardware.
Signed-off-by: Hao Fang fanghao11@huawei.com Tested-by: Junchong Pan panjunchong@hisilicon.com --- src/uadk.h | 4 ++-- src/uadk_cipher.c | 22 +++++++++++----------- test/sanity_test.sh | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/uadk.h b/src/uadk.h index a00f6ac..6d8d5d5 100644 --- a/src/uadk.h +++ b/src/uadk.h @@ -26,8 +26,8 @@ #define ENGINE_RECV_MAX_CNT 60000000
enum { - KUNPENG920, - KUNPENG930, + HW_V2, + HW_V3, };
extern const char *engine_uadk_id; diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c index b75cc99..cf7f4bb 100644 --- a/src/uadk_cipher.c +++ b/src/uadk_cipher.c @@ -76,7 +76,7 @@ static int platform;
#define SMALL_PACKET_OFFLOAD_THRESHOLD_DEFAULT 192
-static int cipher_920_nids[] = { +static int cipher_hw_v2_nids[] = { NID_aes_128_cbc, NID_aes_192_cbc, NID_aes_256_cbc, @@ -92,7 +92,7 @@ static int cipher_920_nids[] = { 0, };
-static int cipher_930_nids[] = { +static int cipher_hw_v3_nids[] = { NID_aes_128_cbc, NID_aes_192_cbc, NID_aes_256_cbc, @@ -341,9 +341,9 @@ static int uadk_get_accel_platform(char *alg_name) return 0;
if (!strcmp(dev->api, "hisi_qm_v2")) - platform = KUNPENG920; + platform = HW_V2; else - platform = KUNPENG930; + platform = HW_V3; free(dev);
return 1; @@ -357,12 +357,12 @@ static int uadk_e_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, int size; int i;
- if (platform == KUNPENG920) { - size = (sizeof(cipher_920_nids) - 1) / sizeof(int); - cipher_nids = cipher_920_nids; + if (platform == HW_V2) { + size = (sizeof(cipher_hw_v2_nids) - 1) / sizeof(int); + cipher_nids = cipher_hw_v2_nids; } else { - size = (sizeof(cipher_930_nids) - 1) / sizeof(int); - cipher_nids = cipher_930_nids; + size = (sizeof(cipher_hw_v3_nids) - 1) / sizeof(int); + cipher_nids = cipher_hw_v3_nids; }
if (!cipher) { @@ -1069,7 +1069,7 @@ int uadk_e_bind_cipher(ENGINE *e) }
bind_v2_cipher(); - if (platform > KUNPENG920) + if (platform > HW_V2) bind_v3_cipher();
return ENGINE_set_ciphers(e, uadk_e_engine_ciphers); @@ -1151,7 +1151,7 @@ void uadk_e_destroy_cipher(void) pthread_spin_destroy(&engine.lock);
destroy_v2_cipher(); - if (platform > KUNPENG920) + if (platform > HW_V2) destroy_v3_cipher(); }
diff --git a/test/sanity_test.sh b/test/sanity_test.sh index 4273310..c901796 100755 --- a/test/sanity_test.sh +++ b/test/sanity_test.sh @@ -91,7 +91,7 @@ if [[ $algs =~ "RSA" ]]; then openssl speed -elapsed -engine $engine_id -async_jobs 1 rsa4096 fi
-#ecdsa only supported in Kunpeng930 or later +#ecdsa only supported in HW_V3 or later if [[ $algs =~ "id-ecPublicKey" ]]; then echo "testing ECDSA" openssl speed -elapsed -engine $engine_id ecdsap224 @@ -104,21 +104,21 @@ if [[ $algs =~ "id-ecPublicKey" ]]; then openssl speed -elapsed -engine $engine_id -async_jobs 1 ecdsap521 fi
-#X25519 only supported in Kunpeng930 or later +#X25519 only supported in HW_V3 or later if [[ $algs =~ "X25519" ]]; then echo "testing X25519" openssl speed -elapsed -engine $engine_id ecdhx25519 openssl speed -elapsed -engine $engine_id -async_jobs 1 ecdhx25519 fi
-#X448 only supported in Kunpeng930 or later +#X448 only supported in HW_V3 or later if [[ $algs =~ "X448" ]]; then echo "testing X448" openssl speed -elapsed -engine $engine_id ecdhx448 openssl speed -elapsed -engine $engine_id -async_jobs 1 ecdhx448 fi
-#ecdh only supported in Kunpeng930 or later +#ecdh only supported in HW_V3 or later if [[ $algs =~ "id-ecPublicKey" ]]; then echo "testing ECDH" openssl speed -elapsed -engine $engine_id ecdhp192