DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] cryptodev: add algo enums to string conversion APIs
@ 2022-12-12 15:10 Akhil Goyal
  2022-12-13  7:31 ` Ruifeng Wang
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Akhil Goyal @ 2022-12-12 15:10 UTC (permalink / raw)
  To: dev
  Cc: ciara.power, fanzhang.oss, kai.ji, pablo.de.lara.guarch,
	hemant.agrawal, matan, g.singh, ruifeng.wang, anoobj,
	radu.nicolau, vfialko, ktraynor, david.marchand, thomas,
	Akhil Goyal

Symmetric/Asymmetric algorithm strings are accessed by application
using arrays in cryptodev lib, which hampers new algorithms addition
in the array due to ABI breakage.
These arrays are now deprecated and will be removed in next ABI break
release.
New APIs are added for getting the algorithm strings based on enum values.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
---
 app/test-crypto-perf/cperf_options_parsing.c |   6 +-
 app/test/test_cryptodev_asym.c               |   2 +-
 app/test/test_cryptodev_security_ipsec.c     |   8 +-
 doc/guides/rel_notes/deprecation.rst         |   7 +
 drivers/crypto/openssl/rte_openssl_pmd_ops.c |   2 +-
 drivers/crypto/qat/qat_sym_session.c         |   7 +-
 examples/l2fwd-crypto/main.c                 |  12 +-
 lib/cryptodev/cryptodev_trace_points.c       |  12 ++
 lib/cryptodev/rte_crypto_asym.h              |   1 +
 lib/cryptodev/rte_crypto_sym.h               |   3 +
 lib/cryptodev/rte_cryptodev.c                | 182 ++++++++++++++++++-
 lib/cryptodev/rte_cryptodev.h                |  52 ++++++
 lib/cryptodev/rte_cryptodev_trace.h          |  32 ++++
 lib/cryptodev/version.map                    |  10 +
 14 files changed, 309 insertions(+), 27 deletions(-)

diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index bc5e312c81..f8ddb6ac56 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -1373,7 +1373,7 @@ cperf_options_dump(struct cperf_options *opts)
 			opts->op_type == CPERF_CIPHER_THEN_AUTH ||
 			opts->op_type == CPERF_AUTH_THEN_CIPHER) {
 		printf("# auth algorithm: %s\n",
-			rte_crypto_auth_algorithm_strings[opts->auth_algo]);
+			rte_cryptodev_get_auth_algo_string(opts->auth_algo));
 		printf("# auth operation: %s\n",
 			rte_crypto_auth_operation_strings[opts->auth_op]);
 		printf("# auth key size: %u\n", opts->auth_key_sz);
@@ -1386,7 +1386,7 @@ cperf_options_dump(struct cperf_options *opts)
 			opts->op_type == CPERF_CIPHER_THEN_AUTH ||
 			opts->op_type == CPERF_AUTH_THEN_CIPHER) {
 		printf("# cipher algorithm: %s\n",
-			rte_crypto_cipher_algorithm_strings[opts->cipher_algo]);
+			rte_cryptodev_get_cipher_algo_string(opts->cipher_algo));
 		printf("# cipher operation: %s\n",
 			rte_crypto_cipher_operation_strings[opts->cipher_op]);
 		printf("# cipher key size: %u\n", opts->cipher_key_sz);
@@ -1396,7 +1396,7 @@ cperf_options_dump(struct cperf_options *opts)
 
 	if (opts->op_type == CPERF_AEAD) {
 		printf("# aead algorithm: %s\n",
-			rte_crypto_aead_algorithm_strings[opts->aead_algo]);
+			rte_cryptodev_get_aead_algo_string(opts->aead_algo));
 		printf("# aead operation: %s\n",
 			rte_crypto_aead_operation_strings[opts->aead_op]);
 		printf("# aead key size: %u\n", opts->aead_key_sz);
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index c58c7f488b..5b16dcab56 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -974,7 +974,7 @@ static inline void print_asym_capa(
 	int i = 0;
 
 	printf("\nxform type: %s\n===================\n",
-			rte_crypto_asym_xform_strings[capa->xform_type]);
+			rte_cryptodev_asym_get_xform_string(capa->xform_type));
 	printf("operation supported -");
 
 	for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c
index 833be94c09..417ff10a1b 100644
--- a/app/test/test_cryptodev_security_ipsec.c
+++ b/app/test/test_cryptodev_security_ipsec.c
@@ -625,20 +625,20 @@ test_ipsec_display_alg(const struct crypto_param *param1,
 {
 	if (param1->type == RTE_CRYPTO_SYM_XFORM_AEAD) {
 		printf("\t%s [%d]",
-		       rte_crypto_aead_algorithm_strings[param1->alg.aead],
+		       rte_cryptodev_get_aead_algo_string(param1->alg.aead),
 		       param1->key_length * 8);
 	} else if (param1->type == RTE_CRYPTO_SYM_XFORM_AUTH) {
 		printf("\t%s",
-		       rte_crypto_auth_algorithm_strings[param1->alg.auth]);
+		       rte_cryptodev_get_auth_algo_string(param1->alg.auth));
 		if (param1->alg.auth != RTE_CRYPTO_AUTH_NULL)
 			printf(" [%dB ICV]", param1->digest_length);
 	} else {
 		printf("\t%s",
-		       rte_crypto_cipher_algorithm_strings[param1->alg.cipher]);
+		       rte_cryptodev_get_cipher_algo_string(param1->alg.cipher));
 		if (param1->alg.cipher != RTE_CRYPTO_CIPHER_NULL)
 			printf(" [%d]", param1->key_length * 8);
 		printf(" %s",
-		       rte_crypto_auth_algorithm_strings[param2->alg.auth]);
+		       rte_cryptodev_get_auth_algo_string(param2->alg.auth));
 		if (param2->alg.auth != RTE_CRYPTO_AUTH_NULL)
 			printf(" [%dB ICV]", param2->digest_length);
 	}
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index b9b02dcef0..e18ac344ef 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -114,6 +114,13 @@ Deprecation Notices
   which got error interrupt to the application,
   so that application can reset that particular queue pair.
 
+* cryptodev: The arrays of algorithm strings ``rte_crypto_cipher_algorithm_strings``,
+  ``rte_crypto_auth_algorithm_strings``, ``rte_crypto_aead_algorithm_strings`` and
+  ``rte_crypto_asym_xform_strings`` are deprecated and will be removed in DPDK 23.11.
+  Application can use the new APIs ``rte_cryptodev_get_cipher_algo_string``,
+  ``rte_cryptodev_get_auth_algo_string``, ``rte_cryptodev_get_aead_algo_string`` and
+  ``rte_cryptodev_asym_get_xform_string`` respectively.
+
 * flow_classify: The flow_classify library and example have no maintainer.
   The library is experimental and, as such, it could be removed from DPDK.
   Its removal has been postponed to let potential users report interest
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index defed4429e..29ad1b9505 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -823,7 +823,7 @@ static int openssl_set_asym_session_parameters(
 	if ((xform->xform_type != RTE_CRYPTO_ASYM_XFORM_DH) &&
 		(xform->next != NULL)) {
 		OPENSSL_LOG(ERR, "chained xfrms are not supported on %s",
-			rte_crypto_asym_xform_strings[xform->xform_type]);
+			rte_cryptodev_asym_get_xform_string(xform->xform_type));
 		return ret;
 	}
 
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 0ebc66f89e..714002dce3 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -436,8 +436,8 @@ qat_sym_session_configure_cipher(struct rte_cryptodev *dev,
 		if (!qat_is_cipher_alg_supported(
 			cipher_xform->algo, internals)) {
 			QAT_LOG(ERR, "%s not supported on this device",
-				rte_crypto_cipher_algorithm_strings
-					[cipher_xform->algo]);
+				rte_cryptodev_get_cipher_algo_string(
+					cipher_xform->algo));
 			ret = -ENOTSUP;
 			goto error_out;
 		}
@@ -772,8 +772,7 @@ qat_sym_session_configure_auth(struct rte_cryptodev *dev,
 	case RTE_CRYPTO_AUTH_ZUC_EIA3:
 		if (!qat_is_auth_alg_supported(auth_xform->algo, internals)) {
 			QAT_LOG(ERR, "%s not supported on this device",
-				rte_crypto_auth_algorithm_strings
-				[auth_xform->algo]);
+				rte_cryptodev_get_auth_algo_string(auth_xform->algo));
 			return -ENOTSUP;
 		}
 		session->qat_hash_alg = ICP_QAT_HW_AUTH_ALGO_ZUC_3G_128_EIA3;
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index b13e5c526e..efe7eea2a7 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -1536,7 +1536,7 @@ display_cipher_info(struct l2fwd_crypto_options *options)
 {
 	printf("\n---- Cipher information ---\n");
 	printf("Algorithm: %s\n",
-		rte_crypto_cipher_algorithm_strings[options->cipher_xform.cipher.algo]);
+		rte_cryptodev_get_cipher_algo_string(options->cipher_xform.cipher.algo));
 	rte_hexdump(stdout, "Cipher key:",
 			options->cipher_xform.cipher.key.data,
 			options->cipher_xform.cipher.key.length);
@@ -1548,7 +1548,7 @@ display_auth_info(struct l2fwd_crypto_options *options)
 {
 	printf("\n---- Authentication information ---\n");
 	printf("Algorithm: %s\n",
-		rte_crypto_auth_algorithm_strings[options->auth_xform.auth.algo]);
+		rte_cryptodev_get_auth_algo_string(options->auth_xform.auth.algo));
 	rte_hexdump(stdout, "Auth key:",
 			options->auth_xform.auth.key.data,
 			options->auth_xform.auth.key.length);
@@ -1560,7 +1560,7 @@ display_aead_info(struct l2fwd_crypto_options *options)
 {
 	printf("\n---- AEAD information ---\n");
 	printf("Algorithm: %s\n",
-		rte_crypto_aead_algorithm_strings[options->aead_xform.aead.algo]);
+		rte_cryptodev_get_aead_algo_string(options->aead_xform.aead.algo));
 	rte_hexdump(stdout, "AEAD key:",
 			options->aead_xform.aead.key.data,
 			options->aead_xform.aead.key.length);
@@ -1864,7 +1864,7 @@ check_device_support_cipher_algo(const struct l2fwd_crypto_options *options,
 	if (cap->op == RTE_CRYPTO_OP_TYPE_UNDEFINED) {
 		printf("Algorithm %s not supported by cryptodev %u"
 			" or device not of preferred type (%s)\n",
-			rte_crypto_cipher_algorithm_strings[opt_cipher_algo],
+			rte_cryptodev_get_cipher_algo_string(opt_cipher_algo),
 			cdev_id,
 			options->string_type);
 		return NULL;
@@ -1898,7 +1898,7 @@ check_device_support_auth_algo(const struct l2fwd_crypto_options *options,
 	if (cap->op == RTE_CRYPTO_OP_TYPE_UNDEFINED) {
 		printf("Algorithm %s not supported by cryptodev %u"
 			" or device not of preferred type (%s)\n",
-			rte_crypto_auth_algorithm_strings[opt_auth_algo],
+			rte_cryptodev_get_auth_algo_string(opt_auth_algo),
 			cdev_id,
 			options->string_type);
 		return NULL;
@@ -1932,7 +1932,7 @@ check_device_support_aead_algo(const struct l2fwd_crypto_options *options,
 	if (cap->op == RTE_CRYPTO_OP_TYPE_UNDEFINED) {
 		printf("Algorithm %s not supported by cryptodev %u"
 			" or device not of preferred type (%s)\n",
-			rte_crypto_aead_algorithm_strings[opt_aead_algo],
+			rte_cryptodev_get_aead_algo_string(opt_aead_algo),
 			cdev_id,
 			options->string_type);
 		return NULL;
diff --git a/lib/cryptodev/cryptodev_trace_points.c b/lib/cryptodev/cryptodev_trace_points.c
index 63a81511a9..4980bcc9be 100644
--- a/lib/cryptodev/cryptodev_trace_points.c
+++ b/lib/cryptodev/cryptodev_trace_points.c
@@ -72,6 +72,15 @@ RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_auth_algo_enum,
 RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_cipher_algo_enum,
 	lib.cryptodev.get.cipher.algo.enum)
 
+RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_aead_algo_string,
+	lib.cryptodev.get.aead.algo.string)
+
+RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_auth_algo_string,
+	lib.cryptodev.get.auth.algo.string)
+
+RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_cipher_algo_string,
+	lib.cryptodev.get.cipher.algo.string)
+
 RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_dev_id,
 	lib.cryptodev.get.dev.id)
 
@@ -126,6 +135,9 @@ RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_get_private_session_size,
 RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_get_xform_enum,
 	lib.cryptodev.asym.get.xform.enum)
 
+RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_get_xform_string,
+	lib.cryptodev.asym.get.xform.string)
+
 RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_xform_capability_check_modlen,
 	lib.cryptodev.asym.xform.capability.check.modlen)
 
diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h
index 38c8b60779..989f38323f 100644
--- a/lib/cryptodev/rte_crypto_asym.h
+++ b/lib/cryptodev/rte_crypto_asym.h
@@ -30,6 +30,7 @@ extern "C" {
 struct rte_cryptodev_asym_session;
 
 /** asym xform type name strings */
+__rte_deprecated
 extern const char *
 rte_crypto_asym_xform_strings[];
 
diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index 33b4966e16..dc847da7b8 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -177,6 +177,7 @@ enum rte_crypto_cipher_algorithm {
 };
 
 /** Cipher algorithm name strings */
+__rte_deprecated
 extern const char *
 rte_crypto_cipher_algorithm_strings[];
 
@@ -378,6 +379,7 @@ enum rte_crypto_auth_algorithm {
 };
 
 /** Authentication algorithm name strings */
+__rte_deprecated
 extern const char *
 rte_crypto_auth_algorithm_strings[];
 
@@ -482,6 +484,7 @@ enum rte_crypto_aead_algorithm {
 };
 
 /** AEAD algorithm name strings */
+__rte_deprecated
 extern const char *
 rte_crypto_aead_algorithm_strings[];
 
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 2165a0688c..1e98f13dac 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -64,9 +64,11 @@ struct rte_cryptodev_callback {
 };
 
 /**
+ * @deprecated
  * The crypto cipher algorithm strings identifiers.
  * It could be used in application command line.
  */
+__rte_deprecated
 const char *
 rte_crypto_cipher_algorithm_strings[] = {
 	[RTE_CRYPTO_CIPHER_3DES_CBC]	= "3des-cbc",
@@ -95,6 +97,39 @@ rte_crypto_cipher_algorithm_strings[] = {
 	[RTE_CRYPTO_CIPHER_SM4_CTR]	= "sm4-ctr"
 };
 
+/**
+ * The crypto cipher algorithm strings identifiers.
+ * Not to be used in application directly.
+ * Application can use rte_cryptodev_get_cipher_algo_string().
+ */
+static const char *
+crypto_cipher_algorithm_strings[] = {
+	[RTE_CRYPTO_CIPHER_3DES_CBC]	= "3des-cbc",
+	[RTE_CRYPTO_CIPHER_3DES_ECB]	= "3des-ecb",
+	[RTE_CRYPTO_CIPHER_3DES_CTR]	= "3des-ctr",
+
+	[RTE_CRYPTO_CIPHER_AES_CBC]	= "aes-cbc",
+	[RTE_CRYPTO_CIPHER_AES_CTR]	= "aes-ctr",
+	[RTE_CRYPTO_CIPHER_AES_DOCSISBPI]	= "aes-docsisbpi",
+	[RTE_CRYPTO_CIPHER_AES_ECB]	= "aes-ecb",
+	[RTE_CRYPTO_CIPHER_AES_F8]	= "aes-f8",
+	[RTE_CRYPTO_CIPHER_AES_XTS]	= "aes-xts",
+
+	[RTE_CRYPTO_CIPHER_ARC4]	= "arc4",
+
+	[RTE_CRYPTO_CIPHER_DES_CBC]     = "des-cbc",
+	[RTE_CRYPTO_CIPHER_DES_DOCSISBPI]	= "des-docsisbpi",
+
+	[RTE_CRYPTO_CIPHER_NULL]	= "null",
+
+	[RTE_CRYPTO_CIPHER_KASUMI_F8]	= "kasumi-f8",
+	[RTE_CRYPTO_CIPHER_SNOW3G_UEA2]	= "snow3g-uea2",
+	[RTE_CRYPTO_CIPHER_ZUC_EEA3]	= "zuc-eea3",
+	[RTE_CRYPTO_CIPHER_SM4_ECB]	= "sm4-ecb",
+	[RTE_CRYPTO_CIPHER_SM4_CBC]	= "sm4-cbc",
+	[RTE_CRYPTO_CIPHER_SM4_CTR]	= "sm4-ctr"
+};
+
 /**
  * The crypto cipher operation strings identifiers.
  * It could be used in application command line.
@@ -106,9 +141,11 @@ rte_crypto_cipher_operation_strings[] = {
 };
 
 /**
+ * @deprecated
  * The crypto auth algorithm strings identifiers.
  * It could be used in application command line.
  */
+__rte_deprecated
 const char *
 rte_crypto_auth_algorithm_strings[] = {
 	[RTE_CRYPTO_AUTH_AES_CBC_MAC]	= "aes-cbc-mac",
@@ -149,9 +186,55 @@ rte_crypto_auth_algorithm_strings[] = {
 };
 
 /**
+ * The crypto auth algorithm strings identifiers.
+ * Not to be used in application directly.
+ * Application can use rte_cryptodev_get_auth_algo_string().
+ */
+static const char *
+crypto_auth_algorithm_strings[] = {
+	[RTE_CRYPTO_AUTH_AES_CBC_MAC]	= "aes-cbc-mac",
+	[RTE_CRYPTO_AUTH_AES_CMAC]	= "aes-cmac",
+	[RTE_CRYPTO_AUTH_AES_GMAC]	= "aes-gmac",
+	[RTE_CRYPTO_AUTH_AES_XCBC_MAC]	= "aes-xcbc-mac",
+
+	[RTE_CRYPTO_AUTH_MD5]		= "md5",
+	[RTE_CRYPTO_AUTH_MD5_HMAC]	= "md5-hmac",
+
+	[RTE_CRYPTO_AUTH_NULL]		= "null",
+
+	[RTE_CRYPTO_AUTH_SHA1]		= "sha1",
+	[RTE_CRYPTO_AUTH_SHA1_HMAC]	= "sha1-hmac",
+
+	[RTE_CRYPTO_AUTH_SHA224]	= "sha2-224",
+	[RTE_CRYPTO_AUTH_SHA224_HMAC]	= "sha2-224-hmac",
+	[RTE_CRYPTO_AUTH_SHA256]	= "sha2-256",
+	[RTE_CRYPTO_AUTH_SHA256_HMAC]	= "sha2-256-hmac",
+	[RTE_CRYPTO_AUTH_SHA384]	= "sha2-384",
+	[RTE_CRYPTO_AUTH_SHA384_HMAC]	= "sha2-384-hmac",
+	[RTE_CRYPTO_AUTH_SHA512]	= "sha2-512",
+	[RTE_CRYPTO_AUTH_SHA512_HMAC]	= "sha2-512-hmac",
+
+	[RTE_CRYPTO_AUTH_SHA3_224]	= "sha3-224",
+	[RTE_CRYPTO_AUTH_SHA3_224_HMAC] = "sha3-224-hmac",
+	[RTE_CRYPTO_AUTH_SHA3_256]	= "sha3-256",
+	[RTE_CRYPTO_AUTH_SHA3_256_HMAC] = "sha3-256-hmac",
+	[RTE_CRYPTO_AUTH_SHA3_384]	= "sha3-384",
+	[RTE_CRYPTO_AUTH_SHA3_384_HMAC] = "sha3-384-hmac",
+	[RTE_CRYPTO_AUTH_SHA3_512]	= "sha3-512",
+	[RTE_CRYPTO_AUTH_SHA3_512_HMAC]	= "sha3-512-hmac",
+
+	[RTE_CRYPTO_AUTH_KASUMI_F9]	= "kasumi-f9",
+	[RTE_CRYPTO_AUTH_SNOW3G_UIA2]	= "snow3g-uia2",
+	[RTE_CRYPTO_AUTH_ZUC_EIA3]	= "zuc-eia3",
+	[RTE_CRYPTO_AUTH_SM3]		= "sm3"
+};
+
+/**
+ * @deprecated
  * The crypto AEAD algorithm strings identifiers.
  * It could be used in application command line.
  */
+__rte_deprecated
 const char *
 rte_crypto_aead_algorithm_strings[] = {
 	[RTE_CRYPTO_AEAD_AES_CCM]	= "aes-ccm",
@@ -159,6 +242,19 @@ rte_crypto_aead_algorithm_strings[] = {
 	[RTE_CRYPTO_AEAD_CHACHA20_POLY1305] = "chacha20-poly1305"
 };
 
+/**
+ * The crypto AEAD algorithm strings identifiers.
+ * Not to be used in application directly.
+ * Application can use rte_cryptodev_get_aead_algo_string().
+ */
+static const char *
+crypto_aead_algorithm_strings[] = {
+	[RTE_CRYPTO_AEAD_AES_CCM]	= "aes-ccm",
+	[RTE_CRYPTO_AEAD_AES_GCM]	= "aes-gcm",
+	[RTE_CRYPTO_AEAD_CHACHA20_POLY1305] = "chacha20-poly1305"
+};
+
+
 /**
  * The crypto AEAD operation strings identifiers.
  * It could be used in application command line.
@@ -170,8 +266,10 @@ rte_crypto_aead_operation_strings[] = {
 };
 
 /**
+ * @deprecated
  * Asymmetric crypto transform operation strings identifiers.
  */
+__rte_deprecated
 const char *rte_crypto_asym_xform_strings[] = {
 	[RTE_CRYPTO_ASYM_XFORM_NONE]	= "none",
 	[RTE_CRYPTO_ASYM_XFORM_RSA]	= "rsa",
@@ -183,6 +281,22 @@ const char *rte_crypto_asym_xform_strings[] = {
 	[RTE_CRYPTO_ASYM_XFORM_ECPM]	= "ecpm",
 };
 
+/**
+ * Asymmetric crypto transform operation strings identifiers.
+ * Not to be used in application directly.
+ * Application can use rte_cryptodev_asym_get_xform_string().
+ */
+static const char *crypto_asym_xform_strings[] = {
+	[RTE_CRYPTO_ASYM_XFORM_NONE]	= "none",
+	[RTE_CRYPTO_ASYM_XFORM_RSA]	= "rsa",
+	[RTE_CRYPTO_ASYM_XFORM_MODEX]	= "modexp",
+	[RTE_CRYPTO_ASYM_XFORM_MODINV]	= "modinv",
+	[RTE_CRYPTO_ASYM_XFORM_DH]	= "dh",
+	[RTE_CRYPTO_ASYM_XFORM_DSA]	= "dsa",
+	[RTE_CRYPTO_ASYM_XFORM_ECDSA]	= "ecdsa",
+	[RTE_CRYPTO_ASYM_XFORM_ECPM]	= "ecpm",
+};
+
 /**
  * Asymmetric crypto operation strings identifiers.
  */
@@ -227,8 +341,8 @@ rte_cryptodev_get_cipher_algo_enum(enum rte_crypto_cipher_algorithm *algo_enum,
 	unsigned int i;
 	int ret = -1;	/* Invalid string */
 
-	for (i = 1; i < RTE_DIM(rte_crypto_cipher_algorithm_strings); i++) {
-		if (strcmp(algo_string, rte_crypto_cipher_algorithm_strings[i]) == 0) {
+	for (i = 1; i < RTE_DIM(crypto_cipher_algorithm_strings); i++) {
+		if (strcmp(algo_string, crypto_cipher_algorithm_strings[i]) == 0) {
 			*algo_enum = (enum rte_crypto_cipher_algorithm) i;
 			ret = 0;
 			break;
@@ -247,8 +361,8 @@ rte_cryptodev_get_auth_algo_enum(enum rte_crypto_auth_algorithm *algo_enum,
 	unsigned int i;
 	int ret = -1;	/* Invalid string */
 
-	for (i = 1; i < RTE_DIM(rte_crypto_auth_algorithm_strings); i++) {
-		if (strcmp(algo_string, rte_crypto_auth_algorithm_strings[i]) == 0) {
+	for (i = 1; i < RTE_DIM(crypto_auth_algorithm_strings); i++) {
+		if (strcmp(algo_string, crypto_auth_algorithm_strings[i]) == 0) {
 			*algo_enum = (enum rte_crypto_auth_algorithm) i;
 			ret = 0;
 			break;
@@ -267,8 +381,8 @@ rte_cryptodev_get_aead_algo_enum(enum rte_crypto_aead_algorithm *algo_enum,
 	unsigned int i;
 	int ret = -1;	/* Invalid string */
 
-	for (i = 1; i < RTE_DIM(rte_crypto_aead_algorithm_strings); i++) {
-		if (strcmp(algo_string, rte_crypto_aead_algorithm_strings[i]) == 0) {
+	for (i = 1; i < RTE_DIM(crypto_aead_algorithm_strings); i++) {
+		if (strcmp(algo_string, crypto_aead_algorithm_strings[i]) == 0) {
 			*algo_enum = (enum rte_crypto_aead_algorithm) i;
 			ret = 0;
 			break;
@@ -287,9 +401,9 @@ rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,
 	unsigned int i;
 	int ret = -1;	/* Invalid string */
 
-	for (i = 1; i < RTE_DIM(rte_crypto_asym_xform_strings); i++) {
+	for (i = 1; i < RTE_DIM(crypto_asym_xform_strings); i++) {
 		if (strcmp(xform_string,
-			rte_crypto_asym_xform_strings[i]) == 0) {
+			crypto_asym_xform_strings[i]) == 0) {
 			*xform_enum = (enum rte_crypto_asym_xform_type) i;
 			ret = 0;
 			break;
@@ -301,6 +415,58 @@ rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,
 	return ret;
 }
 
+const char *
+rte_cryptodev_get_cipher_algo_string(enum rte_crypto_cipher_algorithm algo_enum)
+{
+	const char *alg_str = NULL;
+
+	if (algo_enum < RTE_DIM(crypto_cipher_algorithm_strings))
+		alg_str = crypto_cipher_algorithm_strings[algo_enum];
+
+	rte_cryptodev_trace_get_cipher_algo_string(algo_enum, alg_str);
+
+	return alg_str;
+}
+
+const char *
+rte_cryptodev_get_auth_algo_string(enum rte_crypto_auth_algorithm algo_enum)
+{
+	const char *alg_str = NULL;
+
+	if (algo_enum < RTE_DIM(crypto_auth_algorithm_strings))
+		alg_str = crypto_auth_algorithm_strings[algo_enum];
+
+	rte_cryptodev_trace_get_auth_algo_string(algo_enum, alg_str);
+
+	return alg_str;
+}
+
+const char *
+rte_cryptodev_get_aead_algo_string(enum rte_crypto_aead_algorithm algo_enum)
+{
+	const char *alg_str = NULL;
+
+	if (algo_enum < RTE_DIM(crypto_aead_algorithm_strings))
+		alg_str = crypto_aead_algorithm_strings[algo_enum];
+
+	rte_cryptodev_trace_get_aead_algo_string(algo_enum, alg_str);
+
+	return alg_str;
+}
+
+const char *
+rte_cryptodev_asym_get_xform_string(enum rte_crypto_asym_xform_type xform_enum)
+{
+	const char *xform_str = NULL;
+
+	if (xform_enum < RTE_DIM(crypto_asym_xform_strings))
+		xform_str = crypto_asym_xform_strings[xform_enum];
+
+	rte_cryptodev_trace_asym_get_xform_string(xform_enum, xform_str);
+
+	return xform_str;
+}
+
 /**
  * The crypto auth operation strings identifiers.
  * It could be used in application command line.
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 86d792e2e7..8f41a009e3 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -406,6 +406,58 @@ int
 rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,
 		const char *xform_string);
 
+/**
+ * Provide the cipher algorithm string, given an algorithm enum.
+ *
+ * @param	algo_enum	cipher algorithm enum
+ *
+ * @return
+ * - Return NULL if enum is not valid
+ * - Return algo_string corresponding to enum
+ */
+__rte_experimental
+const char *
+rte_cryptodev_get_cipher_algo_string(enum rte_crypto_cipher_algorithm algo_enum);
+
+/**
+ * Provide the authentication algorithm string, given an algorithm enum.
+ *
+ * @param	algo_enum	auth algorithm enum
+ *
+ * @return
+ * - Return NULL if enum is not valid
+ * - Return algo_string corresponding to enum
+ */
+__rte_experimental
+const char *
+rte_cryptodev_get_auth_algo_string(enum rte_crypto_auth_algorithm algo_enum);
+
+/**
+ * Provide the AEAD algorithm string, given an algorithm enum.
+ *
+ * @param	algo_enum	AEAD algorithm enum
+ *
+ * @return
+ * - Return NULL if enum is not valid
+ * - Return algo_string corresponding to enum
+ */
+__rte_experimental
+const char *
+rte_cryptodev_get_aead_algo_string(enum rte_crypto_aead_algorithm algo_enum);
+
+/**
+ * Provide the Asymmetric xform string, given an xform enum.
+ *
+ * @param	xform_enum	xform type enum
+ *
+ * @return
+ * - Return NULL, if enum is not valid.
+ * - Return xform string, for valid enum.
+ */
+__rte_experimental
+const char *
+rte_cryptodev_asym_get_xform_string(enum rte_crypto_asym_xform_type xform_enum);
+
 
 /** Macro used at end of crypto PMD list */
 #define RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() \
diff --git a/lib/cryptodev/rte_cryptodev_trace.h b/lib/cryptodev/rte_cryptodev_trace.h
index 6c214ce6ea..5e694379b1 100644
--- a/lib/cryptodev/rte_cryptodev_trace.h
+++ b/lib/cryptodev/rte_cryptodev_trace.h
@@ -189,6 +189,30 @@ RTE_TRACE_POINT(
 	rte_trace_point_emit_int(ret);
 )
 
+RTE_TRACE_POINT(
+	rte_cryptodev_trace_get_aead_algo_string,
+	RTE_TRACE_POINT_ARGS(enum rte_crypto_aead_algorithm algo_enum,
+		const char *algo_string),
+	rte_trace_point_emit_int(algo_enum);
+	rte_trace_point_emit_string(algo_string);
+)
+
+RTE_TRACE_POINT(
+	rte_cryptodev_trace_get_auth_algo_string,
+	RTE_TRACE_POINT_ARGS(enum rte_crypto_auth_algorithm algo_enum,
+		const char *algo_string),
+	rte_trace_point_emit_int(algo_enum);
+	rte_trace_point_emit_string(algo_string);
+)
+
+RTE_TRACE_POINT(
+	rte_cryptodev_trace_get_cipher_algo_string,
+	RTE_TRACE_POINT_ARGS(enum rte_crypto_cipher_algorithm algo_enum,
+		const char *algo_string),
+	rte_trace_point_emit_int(algo_enum);
+	rte_trace_point_emit_string(algo_string);
+)
+
 RTE_TRACE_POINT(
 	rte_cryptodev_trace_get_dev_id,
 	RTE_TRACE_POINT_ARGS(const char *name, int ret),
@@ -351,6 +375,14 @@ RTE_TRACE_POINT(
 	rte_trace_point_emit_int(ret);
 )
 
+RTE_TRACE_POINT(
+	rte_cryptodev_trace_asym_get_xform_string,
+	RTE_TRACE_POINT_ARGS(enum rte_crypto_asym_xform_type xform_enum,
+		const char *xform_string),
+	rte_trace_point_emit_int(xform_enum);
+	rte_trace_point_emit_string(xform_string);
+)
+
 RTE_TRACE_POINT(
 	rte_cryptodev_trace_asym_xform_capability_check_modlen,
 	RTE_TRACE_POINT_ARGS(const void *capability, uint16_t modlen, int ret),
diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
index 00c99fb45c..372d042931 100644
--- a/lib/cryptodev/version.map
+++ b/lib/cryptodev/version.map
@@ -150,11 +150,21 @@ EXPERIMENTAL {
 	__rte_cryptodev_trace_sym_session_get_user_data;
 	__rte_cryptodev_trace_sym_session_set_user_data;
 	__rte_cryptodev_trace_count;
+
+	# added 23.03
+	rte_cryptodev_asym_get_xform_string;
+	rte_cryptodev_get_aead_algo_string;
+	rte_cryptodev_get_auth_algo_string;
+	rte_cryptodev_get_cipher_algo_string;
 };
 
 INTERNAL {
 	global:
 
+	__rte_cryptodev_trace_asym_get_xform_string;
+	__rte_cryptodev_trace_get_aead_algo_string;
+	__rte_cryptodev_trace_get_auth_algo_string;
+	__rte_cryptodev_trace_get_cipher_algo_string;
 	cryptodev_fp_ops_reset;
 	cryptodev_fp_ops_set;
 	rte_cryptodev_allocate_driver;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] cryptodev: add algo enums to string conversion APIs
  2022-12-12 15:10 [PATCH] cryptodev: add algo enums to string conversion APIs Akhil Goyal
@ 2022-12-13  7:31 ` Ruifeng Wang
  2022-12-13  7:37 ` Anoob Joseph
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Ruifeng Wang @ 2022-12-13  7:31 UTC (permalink / raw)
  To: Akhil Goyal, dev
  Cc: ciara.power, fanzhang.oss, kai.ji, pablo.de.lara.guarch,
	hemant.agrawal, matan, g.singh, anoobj, radu.nicolau, vfialko,
	ktraynor, david.marchand, thomas, nd

> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Monday, December 12, 2022 11:10 PM
> To: dev@dpdk.org
> Cc: ciara.power@intel.com; fanzhang.oss@gmail.com; kai.ji@intel.com;
> pablo.de.lara.guarch@intel.com; hemant.agrawal@nxp.com; matan@nvidia.com; g.singh@nxp.com;
> Ruifeng Wang <Ruifeng.Wang@arm.com>; anoobj@marvell.com; radu.nicolau@intel.com;
> vfialko@marvell.com; ktraynor@redhat.com; david.marchand@redhat.com; thomas@monjalon.net;
> Akhil Goyal <gakhil@marvell.com>
> Subject: [PATCH] cryptodev: add algo enums to string conversion APIs
> 
> Symmetric/Asymmetric algorithm strings are accessed by application using arrays in
> cryptodev lib, which hampers new algorithms addition in the array due to ABI breakage.
> These arrays are now deprecated and will be removed in next ABI break release.
> New APIs are added for getting the algorithm strings based on enum values.
> 
> Signed-off-by: Akhil Goyal <gakhil@marvell.com>
> ---
>  app/test-crypto-perf/cperf_options_parsing.c |   6 +-
>  app/test/test_cryptodev_asym.c               |   2 +-
>  app/test/test_cryptodev_security_ipsec.c     |   8 +-
>  doc/guides/rel_notes/deprecation.rst         |   7 +
>  drivers/crypto/openssl/rte_openssl_pmd_ops.c |   2 +-
>  drivers/crypto/qat/qat_sym_session.c         |   7 +-
>  examples/l2fwd-crypto/main.c                 |  12 +-
>  lib/cryptodev/cryptodev_trace_points.c       |  12 ++
>  lib/cryptodev/rte_crypto_asym.h              |   1 +
>  lib/cryptodev/rte_crypto_sym.h               |   3 +
>  lib/cryptodev/rte_cryptodev.c                | 182 ++++++++++++++++++-
>  lib/cryptodev/rte_cryptodev.h                |  52 ++++++
>  lib/cryptodev/rte_cryptodev_trace.h          |  32 ++++
>  lib/cryptodev/version.map                    |  10 +
>  14 files changed, 309 insertions(+), 27 deletions(-)
> 
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] cryptodev: add algo enums to string conversion APIs
  2022-12-12 15:10 [PATCH] cryptodev: add algo enums to string conversion APIs Akhil Goyal
  2022-12-13  7:31 ` Ruifeng Wang
@ 2022-12-13  7:37 ` Anoob Joseph
  2022-12-13  8:22 ` Power, Ciara
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Anoob Joseph @ 2022-12-13  7:37 UTC (permalink / raw)
  To: Akhil Goyal, dev
  Cc: ciara.power, fanzhang.oss, kai.ji, pablo.de.lara.guarch,
	hemant.agrawal, matan, g.singh, ruifeng.wang, radu.nicolau,
	Volodymyr Fialko, ktraynor, david.marchand, thomas, Akhil Goyal

> 
> Symmetric/Asymmetric algorithm strings are accessed by application using
> arrays in cryptodev lib, which hampers new algorithms addition in the array
> due to ABI breakage.
> These arrays are now deprecated and will be removed in next ABI break
> release.
> New APIs are added for getting the algorithm strings based on enum values.
> 
> Signed-off-by: Akhil Goyal <gakhil@marvell.com>

Acked-by: Anoob Joseph <anoobj@marvell.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] cryptodev: add algo enums to string conversion APIs
  2022-12-12 15:10 [PATCH] cryptodev: add algo enums to string conversion APIs Akhil Goyal
  2022-12-13  7:31 ` Ruifeng Wang
  2022-12-13  7:37 ` Anoob Joseph
@ 2022-12-13  8:22 ` Power, Ciara
  2022-12-14  9:32 ` Zhang, Fan
  2023-01-04  6:18 ` [PATCH v2] " Akhil Goyal
  4 siblings, 0 replies; 7+ messages in thread
From: Power, Ciara @ 2022-12-13  8:22 UTC (permalink / raw)
  To: Akhil Goyal, dev
  Cc: fanzhang.oss, Ji, Kai, De Lara Guarch, Pablo, hemant.agrawal,
	matan, g.singh, ruifeng.wang, anoobj, Nicolau, Radu, vfialko,
	ktraynor, david.marchand, thomas

Hi Akhil,

> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Monday 12 December 2022 15:10
> To: dev@dpdk.org
> Cc: Power, Ciara <ciara.power@intel.com>; fanzhang.oss@gmail.com; Ji, Kai
> <kai.ji@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; hemant.agrawal@nxp.com;
> matan@nvidia.com; g.singh@nxp.com; ruifeng.wang@arm.com;
> anoobj@marvell.com; Nicolau, Radu <radu.nicolau@intel.com>;
> vfialko@marvell.com; ktraynor@redhat.com; david.marchand@redhat.com;
> thomas@monjalon.net; Akhil Goyal <gakhil@marvell.com>
> Subject: [PATCH] cryptodev: add algo enums to string conversion APIs
> 
> Symmetric/Asymmetric algorithm strings are accessed by application using
> arrays in cryptodev lib, which hampers new algorithms addition in the array
> due to ABI breakage.
> These arrays are now deprecated and will be removed in next ABI break
> release.
> New APIs are added for getting the algorithm strings based on enum values.
> 
> Signed-off-by: Akhil Goyal <gakhil@marvell.com>
> ---
<snip>

Acked-by: Ciara Power <ciara.power@intel.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] cryptodev: add algo enums to string conversion APIs
  2022-12-12 15:10 [PATCH] cryptodev: add algo enums to string conversion APIs Akhil Goyal
                   ` (2 preceding siblings ...)
  2022-12-13  8:22 ` Power, Ciara
@ 2022-12-14  9:32 ` Zhang, Fan
  2023-01-04  6:18 ` [PATCH v2] " Akhil Goyal
  4 siblings, 0 replies; 7+ messages in thread
From: Zhang, Fan @ 2022-12-14  9:32 UTC (permalink / raw)
  To: Akhil Goyal, dev
  Cc: ciara.power, kai.ji, pablo.de.lara.guarch, hemant.agrawal, matan,
	g.singh, ruifeng.wang, anoobj, radu.nicolau, vfialko, ktraynor,
	david.marchand, thomas

On 12/12/2022 3:10 PM, Akhil Goyal wrote:
> Symmetric/Asymmetric algorithm strings are accessed by application
> using arrays in cryptodev lib, which hampers new algorithms addition
> in the array due to ABI breakage.
> These arrays are now deprecated and will be removed in next ABI break
> release.
> New APIs are added for getting the algorithm strings based on enum values.
>
> Signed-off-by: Akhil Goyal <gakhil@marvell.com>
> ---
>   app/test-crypto-perf/cperf_options_parsing.c |   6 +-
>   app/test/test_cryptodev_asym.c               |   2 +-
>   app/test/test_cryptodev_security_ipsec.c     |   8 +-
>   doc/guides/rel_notes/deprecation.rst         |   7 +
>   drivers/crypto/openssl/rte_openssl_pmd_ops.c |   2 +-
>   drivers/crypto/qat/qat_sym_session.c         |   7 +-
>   examples/l2fwd-crypto/main.c                 |  12 +-
>   lib/cryptodev/cryptodev_trace_points.c       |  12 ++
>   lib/cryptodev/rte_crypto_asym.h              |   1 +
>   lib/cryptodev/rte_crypto_sym.h               |   3 +
>   lib/cryptodev/rte_cryptodev.c                | 182 ++++++++++++++++++-
>   lib/cryptodev/rte_cryptodev.h                |  52 ++++++
>   lib/cryptodev/rte_cryptodev_trace.h          |  32 ++++
>   lib/cryptodev/version.map                    |  10 +
>   14 files changed, 309 insertions(+), 27 deletions(-)
Acked-by: Fan Zhang <fanzhang.oss@gmail.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] cryptodev: add algo enums to string conversion APIs
  2022-12-12 15:10 [PATCH] cryptodev: add algo enums to string conversion APIs Akhil Goyal
                   ` (3 preceding siblings ...)
  2022-12-14  9:32 ` Zhang, Fan
@ 2023-01-04  6:18 ` Akhil Goyal
  2023-01-05 10:56   ` Akhil Goyal
  4 siblings, 1 reply; 7+ messages in thread
From: Akhil Goyal @ 2023-01-04  6:18 UTC (permalink / raw)
  To: dev
  Cc: ciara.power, fanzhang.oss, kai.ji, pablo.de.lara.guarch,
	hemant.agrawal, matan, g.singh, ruifeng.wang, anoobj,
	radu.nicolau, vfialko, ktraynor, david.marchand, thomas,
	Akhil Goyal

Symmetric/Asymmetric algorithm strings are accessed by application
using arrays in cryptodev lib, which hampers new algorithms addition
in the array due to ABI breakage.
These arrays are now deprecated and will be removed in next ABI break
release.
New APIs are added for getting the algorithm strings based on enum values.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Ciara Power <ciara.power@intel.com>
Acked-by: Fan Zhang <fanzhang.oss@gmail.com>
---
Changes in v2: fixed Windows compilation

 app/test-crypto-perf/cperf_options_parsing.c |   6 +-
 app/test/test_cryptodev_asym.c               |   2 +-
 app/test/test_cryptodev_security_ipsec.c     |   8 +-
 doc/guides/rel_notes/deprecation.rst         |   7 +
 drivers/crypto/openssl/rte_openssl_pmd_ops.c |   2 +-
 drivers/crypto/qat/qat_sym_session.c         |   7 +-
 examples/l2fwd-crypto/main.c                 |  12 +-
 lib/cryptodev/cryptodev_trace_points.c       |  12 ++
 lib/cryptodev/rte_crypto_asym.h              |   1 +
 lib/cryptodev/rte_crypto_sym.h               |   3 +
 lib/cryptodev/rte_cryptodev.c                | 183 ++++++++++++++++++-
 lib/cryptodev/rte_cryptodev.h                |  52 ++++++
 lib/cryptodev/rte_cryptodev_trace.h          |  32 ++++
 lib/cryptodev/version.map                    |  10 +
 14 files changed, 310 insertions(+), 27 deletions(-)

diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index bc5e312c81..f8ddb6ac56 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -1373,7 +1373,7 @@ cperf_options_dump(struct cperf_options *opts)
 			opts->op_type == CPERF_CIPHER_THEN_AUTH ||
 			opts->op_type == CPERF_AUTH_THEN_CIPHER) {
 		printf("# auth algorithm: %s\n",
-			rte_crypto_auth_algorithm_strings[opts->auth_algo]);
+			rte_cryptodev_get_auth_algo_string(opts->auth_algo));
 		printf("# auth operation: %s\n",
 			rte_crypto_auth_operation_strings[opts->auth_op]);
 		printf("# auth key size: %u\n", opts->auth_key_sz);
@@ -1386,7 +1386,7 @@ cperf_options_dump(struct cperf_options *opts)
 			opts->op_type == CPERF_CIPHER_THEN_AUTH ||
 			opts->op_type == CPERF_AUTH_THEN_CIPHER) {
 		printf("# cipher algorithm: %s\n",
-			rte_crypto_cipher_algorithm_strings[opts->cipher_algo]);
+			rte_cryptodev_get_cipher_algo_string(opts->cipher_algo));
 		printf("# cipher operation: %s\n",
 			rte_crypto_cipher_operation_strings[opts->cipher_op]);
 		printf("# cipher key size: %u\n", opts->cipher_key_sz);
@@ -1396,7 +1396,7 @@ cperf_options_dump(struct cperf_options *opts)
 
 	if (opts->op_type == CPERF_AEAD) {
 		printf("# aead algorithm: %s\n",
-			rte_crypto_aead_algorithm_strings[opts->aead_algo]);
+			rte_cryptodev_get_aead_algo_string(opts->aead_algo));
 		printf("# aead operation: %s\n",
 			rte_crypto_aead_operation_strings[opts->aead_op]);
 		printf("# aead key size: %u\n", opts->aead_key_sz);
diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c
index c58c7f488b..5b16dcab56 100644
--- a/app/test/test_cryptodev_asym.c
+++ b/app/test/test_cryptodev_asym.c
@@ -974,7 +974,7 @@ static inline void print_asym_capa(
 	int i = 0;
 
 	printf("\nxform type: %s\n===================\n",
-			rte_crypto_asym_xform_strings[capa->xform_type]);
+			rte_cryptodev_asym_get_xform_string(capa->xform_type));
 	printf("operation supported -");
 
 	for (i = 0; i < RTE_CRYPTO_ASYM_OP_LIST_END; i++) {
diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c
index 833be94c09..417ff10a1b 100644
--- a/app/test/test_cryptodev_security_ipsec.c
+++ b/app/test/test_cryptodev_security_ipsec.c
@@ -625,20 +625,20 @@ test_ipsec_display_alg(const struct crypto_param *param1,
 {
 	if (param1->type == RTE_CRYPTO_SYM_XFORM_AEAD) {
 		printf("\t%s [%d]",
-		       rte_crypto_aead_algorithm_strings[param1->alg.aead],
+		       rte_cryptodev_get_aead_algo_string(param1->alg.aead),
 		       param1->key_length * 8);
 	} else if (param1->type == RTE_CRYPTO_SYM_XFORM_AUTH) {
 		printf("\t%s",
-		       rte_crypto_auth_algorithm_strings[param1->alg.auth]);
+		       rte_cryptodev_get_auth_algo_string(param1->alg.auth));
 		if (param1->alg.auth != RTE_CRYPTO_AUTH_NULL)
 			printf(" [%dB ICV]", param1->digest_length);
 	} else {
 		printf("\t%s",
-		       rte_crypto_cipher_algorithm_strings[param1->alg.cipher]);
+		       rte_cryptodev_get_cipher_algo_string(param1->alg.cipher));
 		if (param1->alg.cipher != RTE_CRYPTO_CIPHER_NULL)
 			printf(" [%d]", param1->key_length * 8);
 		printf(" %s",
-		       rte_crypto_auth_algorithm_strings[param2->alg.auth]);
+		       rte_cryptodev_get_auth_algo_string(param2->alg.auth));
 		if (param2->alg.auth != RTE_CRYPTO_AUTH_NULL)
 			printf(" [%dB ICV]", param2->digest_length);
 	}
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index b9b02dcef0..e18ac344ef 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -114,6 +114,13 @@ Deprecation Notices
   which got error interrupt to the application,
   so that application can reset that particular queue pair.
 
+* cryptodev: The arrays of algorithm strings ``rte_crypto_cipher_algorithm_strings``,
+  ``rte_crypto_auth_algorithm_strings``, ``rte_crypto_aead_algorithm_strings`` and
+  ``rte_crypto_asym_xform_strings`` are deprecated and will be removed in DPDK 23.11.
+  Application can use the new APIs ``rte_cryptodev_get_cipher_algo_string``,
+  ``rte_cryptodev_get_auth_algo_string``, ``rte_cryptodev_get_aead_algo_string`` and
+  ``rte_cryptodev_asym_get_xform_string`` respectively.
+
 * flow_classify: The flow_classify library and example have no maintainer.
   The library is experimental and, as such, it could be removed from DPDK.
   Its removal has been postponed to let potential users report interest
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
index defed4429e..29ad1b9505 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -823,7 +823,7 @@ static int openssl_set_asym_session_parameters(
 	if ((xform->xform_type != RTE_CRYPTO_ASYM_XFORM_DH) &&
 		(xform->next != NULL)) {
 		OPENSSL_LOG(ERR, "chained xfrms are not supported on %s",
-			rte_crypto_asym_xform_strings[xform->xform_type]);
+			rte_cryptodev_asym_get_xform_string(xform->xform_type));
 		return ret;
 	}
 
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 0ebc66f89e..714002dce3 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -436,8 +436,8 @@ qat_sym_session_configure_cipher(struct rte_cryptodev *dev,
 		if (!qat_is_cipher_alg_supported(
 			cipher_xform->algo, internals)) {
 			QAT_LOG(ERR, "%s not supported on this device",
-				rte_crypto_cipher_algorithm_strings
-					[cipher_xform->algo]);
+				rte_cryptodev_get_cipher_algo_string(
+					cipher_xform->algo));
 			ret = -ENOTSUP;
 			goto error_out;
 		}
@@ -772,8 +772,7 @@ qat_sym_session_configure_auth(struct rte_cryptodev *dev,
 	case RTE_CRYPTO_AUTH_ZUC_EIA3:
 		if (!qat_is_auth_alg_supported(auth_xform->algo, internals)) {
 			QAT_LOG(ERR, "%s not supported on this device",
-				rte_crypto_auth_algorithm_strings
-				[auth_xform->algo]);
+				rte_cryptodev_get_auth_algo_string(auth_xform->algo));
 			return -ENOTSUP;
 		}
 		session->qat_hash_alg = ICP_QAT_HW_AUTH_ALGO_ZUC_3G_128_EIA3;
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index b13e5c526e..efe7eea2a7 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -1536,7 +1536,7 @@ display_cipher_info(struct l2fwd_crypto_options *options)
 {
 	printf("\n---- Cipher information ---\n");
 	printf("Algorithm: %s\n",
-		rte_crypto_cipher_algorithm_strings[options->cipher_xform.cipher.algo]);
+		rte_cryptodev_get_cipher_algo_string(options->cipher_xform.cipher.algo));
 	rte_hexdump(stdout, "Cipher key:",
 			options->cipher_xform.cipher.key.data,
 			options->cipher_xform.cipher.key.length);
@@ -1548,7 +1548,7 @@ display_auth_info(struct l2fwd_crypto_options *options)
 {
 	printf("\n---- Authentication information ---\n");
 	printf("Algorithm: %s\n",
-		rte_crypto_auth_algorithm_strings[options->auth_xform.auth.algo]);
+		rte_cryptodev_get_auth_algo_string(options->auth_xform.auth.algo));
 	rte_hexdump(stdout, "Auth key:",
 			options->auth_xform.auth.key.data,
 			options->auth_xform.auth.key.length);
@@ -1560,7 +1560,7 @@ display_aead_info(struct l2fwd_crypto_options *options)
 {
 	printf("\n---- AEAD information ---\n");
 	printf("Algorithm: %s\n",
-		rte_crypto_aead_algorithm_strings[options->aead_xform.aead.algo]);
+		rte_cryptodev_get_aead_algo_string(options->aead_xform.aead.algo));
 	rte_hexdump(stdout, "AEAD key:",
 			options->aead_xform.aead.key.data,
 			options->aead_xform.aead.key.length);
@@ -1864,7 +1864,7 @@ check_device_support_cipher_algo(const struct l2fwd_crypto_options *options,
 	if (cap->op == RTE_CRYPTO_OP_TYPE_UNDEFINED) {
 		printf("Algorithm %s not supported by cryptodev %u"
 			" or device not of preferred type (%s)\n",
-			rte_crypto_cipher_algorithm_strings[opt_cipher_algo],
+			rte_cryptodev_get_cipher_algo_string(opt_cipher_algo),
 			cdev_id,
 			options->string_type);
 		return NULL;
@@ -1898,7 +1898,7 @@ check_device_support_auth_algo(const struct l2fwd_crypto_options *options,
 	if (cap->op == RTE_CRYPTO_OP_TYPE_UNDEFINED) {
 		printf("Algorithm %s not supported by cryptodev %u"
 			" or device not of preferred type (%s)\n",
-			rte_crypto_auth_algorithm_strings[opt_auth_algo],
+			rte_cryptodev_get_auth_algo_string(opt_auth_algo),
 			cdev_id,
 			options->string_type);
 		return NULL;
@@ -1932,7 +1932,7 @@ check_device_support_aead_algo(const struct l2fwd_crypto_options *options,
 	if (cap->op == RTE_CRYPTO_OP_TYPE_UNDEFINED) {
 		printf("Algorithm %s not supported by cryptodev %u"
 			" or device not of preferred type (%s)\n",
-			rte_crypto_aead_algorithm_strings[opt_aead_algo],
+			rte_cryptodev_get_aead_algo_string(opt_aead_algo),
 			cdev_id,
 			options->string_type);
 		return NULL;
diff --git a/lib/cryptodev/cryptodev_trace_points.c b/lib/cryptodev/cryptodev_trace_points.c
index 63a81511a9..4980bcc9be 100644
--- a/lib/cryptodev/cryptodev_trace_points.c
+++ b/lib/cryptodev/cryptodev_trace_points.c
@@ -72,6 +72,15 @@ RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_auth_algo_enum,
 RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_cipher_algo_enum,
 	lib.cryptodev.get.cipher.algo.enum)
 
+RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_aead_algo_string,
+	lib.cryptodev.get.aead.algo.string)
+
+RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_auth_algo_string,
+	lib.cryptodev.get.auth.algo.string)
+
+RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_cipher_algo_string,
+	lib.cryptodev.get.cipher.algo.string)
+
 RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_get_dev_id,
 	lib.cryptodev.get.dev.id)
 
@@ -126,6 +135,9 @@ RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_get_private_session_size,
 RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_get_xform_enum,
 	lib.cryptodev.asym.get.xform.enum)
 
+RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_get_xform_string,
+	lib.cryptodev.asym.get.xform.string)
+
 RTE_TRACE_POINT_REGISTER(rte_cryptodev_trace_asym_xform_capability_check_modlen,
 	lib.cryptodev.asym.xform.capability.check.modlen)
 
diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h
index 38c8b60779..989f38323f 100644
--- a/lib/cryptodev/rte_crypto_asym.h
+++ b/lib/cryptodev/rte_crypto_asym.h
@@ -30,6 +30,7 @@ extern "C" {
 struct rte_cryptodev_asym_session;
 
 /** asym xform type name strings */
+__rte_deprecated
 extern const char *
 rte_crypto_asym_xform_strings[];
 
diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index 33b4966e16..dc847da7b8 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -177,6 +177,7 @@ enum rte_crypto_cipher_algorithm {
 };
 
 /** Cipher algorithm name strings */
+__rte_deprecated
 extern const char *
 rte_crypto_cipher_algorithm_strings[];
 
@@ -378,6 +379,7 @@ enum rte_crypto_auth_algorithm {
 };
 
 /** Authentication algorithm name strings */
+__rte_deprecated
 extern const char *
 rte_crypto_auth_algorithm_strings[];
 
@@ -482,6 +484,7 @@ enum rte_crypto_aead_algorithm {
 };
 
 /** AEAD algorithm name strings */
+__rte_deprecated
 extern const char *
 rte_crypto_aead_algorithm_strings[];
 
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 2165a0688c..742a4c512e 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -64,9 +64,11 @@ struct rte_cryptodev_callback {
 };
 
 /**
+ * @deprecated
  * The crypto cipher algorithm strings identifiers.
  * It could be used in application command line.
  */
+__rte_deprecated
 const char *
 rte_crypto_cipher_algorithm_strings[] = {
 	[RTE_CRYPTO_CIPHER_3DES_CBC]	= "3des-cbc",
@@ -95,6 +97,39 @@ rte_crypto_cipher_algorithm_strings[] = {
 	[RTE_CRYPTO_CIPHER_SM4_CTR]	= "sm4-ctr"
 };
 
+/**
+ * The crypto cipher algorithm strings identifiers.
+ * Not to be used in application directly.
+ * Application can use rte_cryptodev_get_cipher_algo_string().
+ */
+static const char *
+crypto_cipher_algorithm_strings[] = {
+	[RTE_CRYPTO_CIPHER_3DES_CBC]	= "3des-cbc",
+	[RTE_CRYPTO_CIPHER_3DES_ECB]	= "3des-ecb",
+	[RTE_CRYPTO_CIPHER_3DES_CTR]	= "3des-ctr",
+
+	[RTE_CRYPTO_CIPHER_AES_CBC]	= "aes-cbc",
+	[RTE_CRYPTO_CIPHER_AES_CTR]	= "aes-ctr",
+	[RTE_CRYPTO_CIPHER_AES_DOCSISBPI]	= "aes-docsisbpi",
+	[RTE_CRYPTO_CIPHER_AES_ECB]	= "aes-ecb",
+	[RTE_CRYPTO_CIPHER_AES_F8]	= "aes-f8",
+	[RTE_CRYPTO_CIPHER_AES_XTS]	= "aes-xts",
+
+	[RTE_CRYPTO_CIPHER_ARC4]	= "arc4",
+
+	[RTE_CRYPTO_CIPHER_DES_CBC]     = "des-cbc",
+	[RTE_CRYPTO_CIPHER_DES_DOCSISBPI]	= "des-docsisbpi",
+
+	[RTE_CRYPTO_CIPHER_NULL]	= "null",
+
+	[RTE_CRYPTO_CIPHER_KASUMI_F8]	= "kasumi-f8",
+	[RTE_CRYPTO_CIPHER_SNOW3G_UEA2]	= "snow3g-uea2",
+	[RTE_CRYPTO_CIPHER_ZUC_EEA3]	= "zuc-eea3",
+	[RTE_CRYPTO_CIPHER_SM4_ECB]	= "sm4-ecb",
+	[RTE_CRYPTO_CIPHER_SM4_CBC]	= "sm4-cbc",
+	[RTE_CRYPTO_CIPHER_SM4_CTR]	= "sm4-ctr"
+};
+
 /**
  * The crypto cipher operation strings identifiers.
  * It could be used in application command line.
@@ -106,9 +141,11 @@ rte_crypto_cipher_operation_strings[] = {
 };
 
 /**
+ * @deprecated
  * The crypto auth algorithm strings identifiers.
  * It could be used in application command line.
  */
+__rte_deprecated
 const char *
 rte_crypto_auth_algorithm_strings[] = {
 	[RTE_CRYPTO_AUTH_AES_CBC_MAC]	= "aes-cbc-mac",
@@ -149,9 +186,55 @@ rte_crypto_auth_algorithm_strings[] = {
 };
 
 /**
+ * The crypto auth algorithm strings identifiers.
+ * Not to be used in application directly.
+ * Application can use rte_cryptodev_get_auth_algo_string().
+ */
+static const char *
+crypto_auth_algorithm_strings[] = {
+	[RTE_CRYPTO_AUTH_AES_CBC_MAC]	= "aes-cbc-mac",
+	[RTE_CRYPTO_AUTH_AES_CMAC]	= "aes-cmac",
+	[RTE_CRYPTO_AUTH_AES_GMAC]	= "aes-gmac",
+	[RTE_CRYPTO_AUTH_AES_XCBC_MAC]	= "aes-xcbc-mac",
+
+	[RTE_CRYPTO_AUTH_MD5]		= "md5",
+	[RTE_CRYPTO_AUTH_MD5_HMAC]	= "md5-hmac",
+
+	[RTE_CRYPTO_AUTH_NULL]		= "null",
+
+	[RTE_CRYPTO_AUTH_SHA1]		= "sha1",
+	[RTE_CRYPTO_AUTH_SHA1_HMAC]	= "sha1-hmac",
+
+	[RTE_CRYPTO_AUTH_SHA224]	= "sha2-224",
+	[RTE_CRYPTO_AUTH_SHA224_HMAC]	= "sha2-224-hmac",
+	[RTE_CRYPTO_AUTH_SHA256]	= "sha2-256",
+	[RTE_CRYPTO_AUTH_SHA256_HMAC]	= "sha2-256-hmac",
+	[RTE_CRYPTO_AUTH_SHA384]	= "sha2-384",
+	[RTE_CRYPTO_AUTH_SHA384_HMAC]	= "sha2-384-hmac",
+	[RTE_CRYPTO_AUTH_SHA512]	= "sha2-512",
+	[RTE_CRYPTO_AUTH_SHA512_HMAC]	= "sha2-512-hmac",
+
+	[RTE_CRYPTO_AUTH_SHA3_224]	= "sha3-224",
+	[RTE_CRYPTO_AUTH_SHA3_224_HMAC] = "sha3-224-hmac",
+	[RTE_CRYPTO_AUTH_SHA3_256]	= "sha3-256",
+	[RTE_CRYPTO_AUTH_SHA3_256_HMAC] = "sha3-256-hmac",
+	[RTE_CRYPTO_AUTH_SHA3_384]	= "sha3-384",
+	[RTE_CRYPTO_AUTH_SHA3_384_HMAC] = "sha3-384-hmac",
+	[RTE_CRYPTO_AUTH_SHA3_512]	= "sha3-512",
+	[RTE_CRYPTO_AUTH_SHA3_512_HMAC]	= "sha3-512-hmac",
+
+	[RTE_CRYPTO_AUTH_KASUMI_F9]	= "kasumi-f9",
+	[RTE_CRYPTO_AUTH_SNOW3G_UIA2]	= "snow3g-uia2",
+	[RTE_CRYPTO_AUTH_ZUC_EIA3]	= "zuc-eia3",
+	[RTE_CRYPTO_AUTH_SM3]		= "sm3"
+};
+
+/**
+ * @deprecated
  * The crypto AEAD algorithm strings identifiers.
  * It could be used in application command line.
  */
+__rte_deprecated
 const char *
 rte_crypto_aead_algorithm_strings[] = {
 	[RTE_CRYPTO_AEAD_AES_CCM]	= "aes-ccm",
@@ -159,6 +242,19 @@ rte_crypto_aead_algorithm_strings[] = {
 	[RTE_CRYPTO_AEAD_CHACHA20_POLY1305] = "chacha20-poly1305"
 };
 
+/**
+ * The crypto AEAD algorithm strings identifiers.
+ * Not to be used in application directly.
+ * Application can use rte_cryptodev_get_aead_algo_string().
+ */
+static const char *
+crypto_aead_algorithm_strings[] = {
+	[RTE_CRYPTO_AEAD_AES_CCM]	= "aes-ccm",
+	[RTE_CRYPTO_AEAD_AES_GCM]	= "aes-gcm",
+	[RTE_CRYPTO_AEAD_CHACHA20_POLY1305] = "chacha20-poly1305"
+};
+
+
 /**
  * The crypto AEAD operation strings identifiers.
  * It could be used in application command line.
@@ -170,8 +266,10 @@ rte_crypto_aead_operation_strings[] = {
 };
 
 /**
+ * @deprecated
  * Asymmetric crypto transform operation strings identifiers.
  */
+__rte_deprecated
 const char *rte_crypto_asym_xform_strings[] = {
 	[RTE_CRYPTO_ASYM_XFORM_NONE]	= "none",
 	[RTE_CRYPTO_ASYM_XFORM_RSA]	= "rsa",
@@ -183,6 +281,23 @@ const char *rte_crypto_asym_xform_strings[] = {
 	[RTE_CRYPTO_ASYM_XFORM_ECPM]	= "ecpm",
 };
 
+/**
+ * Asymmetric crypto transform operation strings identifiers.
+ * Not to be used in application directly.
+ * Application can use rte_cryptodev_asym_get_xform_string().
+ */
+static const char *
+crypto_asym_xform_strings[] = {
+	[RTE_CRYPTO_ASYM_XFORM_NONE]	= "none",
+	[RTE_CRYPTO_ASYM_XFORM_RSA]	= "rsa",
+	[RTE_CRYPTO_ASYM_XFORM_MODEX]	= "modexp",
+	[RTE_CRYPTO_ASYM_XFORM_MODINV]	= "modinv",
+	[RTE_CRYPTO_ASYM_XFORM_DH]	= "dh",
+	[RTE_CRYPTO_ASYM_XFORM_DSA]	= "dsa",
+	[RTE_CRYPTO_ASYM_XFORM_ECDSA]	= "ecdsa",
+	[RTE_CRYPTO_ASYM_XFORM_ECPM]	= "ecpm",
+};
+
 /**
  * Asymmetric crypto operation strings identifiers.
  */
@@ -227,8 +342,8 @@ rte_cryptodev_get_cipher_algo_enum(enum rte_crypto_cipher_algorithm *algo_enum,
 	unsigned int i;
 	int ret = -1;	/* Invalid string */
 
-	for (i = 1; i < RTE_DIM(rte_crypto_cipher_algorithm_strings); i++) {
-		if (strcmp(algo_string, rte_crypto_cipher_algorithm_strings[i]) == 0) {
+	for (i = 1; i < RTE_DIM(crypto_cipher_algorithm_strings); i++) {
+		if (strcmp(algo_string, crypto_cipher_algorithm_strings[i]) == 0) {
 			*algo_enum = (enum rte_crypto_cipher_algorithm) i;
 			ret = 0;
 			break;
@@ -247,8 +362,8 @@ rte_cryptodev_get_auth_algo_enum(enum rte_crypto_auth_algorithm *algo_enum,
 	unsigned int i;
 	int ret = -1;	/* Invalid string */
 
-	for (i = 1; i < RTE_DIM(rte_crypto_auth_algorithm_strings); i++) {
-		if (strcmp(algo_string, rte_crypto_auth_algorithm_strings[i]) == 0) {
+	for (i = 1; i < RTE_DIM(crypto_auth_algorithm_strings); i++) {
+		if (strcmp(algo_string, crypto_auth_algorithm_strings[i]) == 0) {
 			*algo_enum = (enum rte_crypto_auth_algorithm) i;
 			ret = 0;
 			break;
@@ -267,8 +382,8 @@ rte_cryptodev_get_aead_algo_enum(enum rte_crypto_aead_algorithm *algo_enum,
 	unsigned int i;
 	int ret = -1;	/* Invalid string */
 
-	for (i = 1; i < RTE_DIM(rte_crypto_aead_algorithm_strings); i++) {
-		if (strcmp(algo_string, rte_crypto_aead_algorithm_strings[i]) == 0) {
+	for (i = 1; i < RTE_DIM(crypto_aead_algorithm_strings); i++) {
+		if (strcmp(algo_string, crypto_aead_algorithm_strings[i]) == 0) {
 			*algo_enum = (enum rte_crypto_aead_algorithm) i;
 			ret = 0;
 			break;
@@ -287,9 +402,9 @@ rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,
 	unsigned int i;
 	int ret = -1;	/* Invalid string */
 
-	for (i = 1; i < RTE_DIM(rte_crypto_asym_xform_strings); i++) {
+	for (i = 1; i < RTE_DIM(crypto_asym_xform_strings); i++) {
 		if (strcmp(xform_string,
-			rte_crypto_asym_xform_strings[i]) == 0) {
+			crypto_asym_xform_strings[i]) == 0) {
 			*xform_enum = (enum rte_crypto_asym_xform_type) i;
 			ret = 0;
 			break;
@@ -301,6 +416,58 @@ rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,
 	return ret;
 }
 
+const char *
+rte_cryptodev_get_cipher_algo_string(enum rte_crypto_cipher_algorithm algo_enum)
+{
+	const char *alg_str = NULL;
+
+	if ((unsigned int)algo_enum < RTE_DIM(crypto_cipher_algorithm_strings))
+		alg_str = crypto_cipher_algorithm_strings[algo_enum];
+
+	rte_cryptodev_trace_get_cipher_algo_string(algo_enum, alg_str);
+
+	return alg_str;
+}
+
+const char *
+rte_cryptodev_get_auth_algo_string(enum rte_crypto_auth_algorithm algo_enum)
+{
+	const char *alg_str = NULL;
+
+	if ((unsigned int)algo_enum < RTE_DIM(crypto_auth_algorithm_strings))
+		alg_str = crypto_auth_algorithm_strings[algo_enum];
+
+	rte_cryptodev_trace_get_auth_algo_string(algo_enum, alg_str);
+
+	return alg_str;
+}
+
+const char *
+rte_cryptodev_get_aead_algo_string(enum rte_crypto_aead_algorithm algo_enum)
+{
+	const char *alg_str = NULL;
+
+	if ((unsigned int)algo_enum < RTE_DIM(crypto_aead_algorithm_strings))
+		alg_str = crypto_aead_algorithm_strings[algo_enum];
+
+	rte_cryptodev_trace_get_aead_algo_string(algo_enum, alg_str);
+
+	return alg_str;
+}
+
+const char *
+rte_cryptodev_asym_get_xform_string(enum rte_crypto_asym_xform_type xform_enum)
+{
+	const char *xform_str = NULL;
+
+	if ((unsigned int)xform_enum < RTE_DIM(crypto_asym_xform_strings))
+		xform_str = crypto_asym_xform_strings[xform_enum];
+
+	rte_cryptodev_trace_asym_get_xform_string(xform_enum, xform_str);
+
+	return xform_str;
+}
+
 /**
  * The crypto auth operation strings identifiers.
  * It could be used in application command line.
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 86d792e2e7..8f41a009e3 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -406,6 +406,58 @@ int
 rte_cryptodev_asym_get_xform_enum(enum rte_crypto_asym_xform_type *xform_enum,
 		const char *xform_string);
 
+/**
+ * Provide the cipher algorithm string, given an algorithm enum.
+ *
+ * @param	algo_enum	cipher algorithm enum
+ *
+ * @return
+ * - Return NULL if enum is not valid
+ * - Return algo_string corresponding to enum
+ */
+__rte_experimental
+const char *
+rte_cryptodev_get_cipher_algo_string(enum rte_crypto_cipher_algorithm algo_enum);
+
+/**
+ * Provide the authentication algorithm string, given an algorithm enum.
+ *
+ * @param	algo_enum	auth algorithm enum
+ *
+ * @return
+ * - Return NULL if enum is not valid
+ * - Return algo_string corresponding to enum
+ */
+__rte_experimental
+const char *
+rte_cryptodev_get_auth_algo_string(enum rte_crypto_auth_algorithm algo_enum);
+
+/**
+ * Provide the AEAD algorithm string, given an algorithm enum.
+ *
+ * @param	algo_enum	AEAD algorithm enum
+ *
+ * @return
+ * - Return NULL if enum is not valid
+ * - Return algo_string corresponding to enum
+ */
+__rte_experimental
+const char *
+rte_cryptodev_get_aead_algo_string(enum rte_crypto_aead_algorithm algo_enum);
+
+/**
+ * Provide the Asymmetric xform string, given an xform enum.
+ *
+ * @param	xform_enum	xform type enum
+ *
+ * @return
+ * - Return NULL, if enum is not valid.
+ * - Return xform string, for valid enum.
+ */
+__rte_experimental
+const char *
+rte_cryptodev_asym_get_xform_string(enum rte_crypto_asym_xform_type xform_enum);
+
 
 /** Macro used at end of crypto PMD list */
 #define RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() \
diff --git a/lib/cryptodev/rte_cryptodev_trace.h b/lib/cryptodev/rte_cryptodev_trace.h
index 6c214ce6ea..5e694379b1 100644
--- a/lib/cryptodev/rte_cryptodev_trace.h
+++ b/lib/cryptodev/rte_cryptodev_trace.h
@@ -189,6 +189,30 @@ RTE_TRACE_POINT(
 	rte_trace_point_emit_int(ret);
 )
 
+RTE_TRACE_POINT(
+	rte_cryptodev_trace_get_aead_algo_string,
+	RTE_TRACE_POINT_ARGS(enum rte_crypto_aead_algorithm algo_enum,
+		const char *algo_string),
+	rte_trace_point_emit_int(algo_enum);
+	rte_trace_point_emit_string(algo_string);
+)
+
+RTE_TRACE_POINT(
+	rte_cryptodev_trace_get_auth_algo_string,
+	RTE_TRACE_POINT_ARGS(enum rte_crypto_auth_algorithm algo_enum,
+		const char *algo_string),
+	rte_trace_point_emit_int(algo_enum);
+	rte_trace_point_emit_string(algo_string);
+)
+
+RTE_TRACE_POINT(
+	rte_cryptodev_trace_get_cipher_algo_string,
+	RTE_TRACE_POINT_ARGS(enum rte_crypto_cipher_algorithm algo_enum,
+		const char *algo_string),
+	rte_trace_point_emit_int(algo_enum);
+	rte_trace_point_emit_string(algo_string);
+)
+
 RTE_TRACE_POINT(
 	rte_cryptodev_trace_get_dev_id,
 	RTE_TRACE_POINT_ARGS(const char *name, int ret),
@@ -351,6 +375,14 @@ RTE_TRACE_POINT(
 	rte_trace_point_emit_int(ret);
 )
 
+RTE_TRACE_POINT(
+	rte_cryptodev_trace_asym_get_xform_string,
+	RTE_TRACE_POINT_ARGS(enum rte_crypto_asym_xform_type xform_enum,
+		const char *xform_string),
+	rte_trace_point_emit_int(xform_enum);
+	rte_trace_point_emit_string(xform_string);
+)
+
 RTE_TRACE_POINT(
 	rte_cryptodev_trace_asym_xform_capability_check_modlen,
 	RTE_TRACE_POINT_ARGS(const void *capability, uint16_t modlen, int ret),
diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
index 00c99fb45c..372d042931 100644
--- a/lib/cryptodev/version.map
+++ b/lib/cryptodev/version.map
@@ -150,11 +150,21 @@ EXPERIMENTAL {
 	__rte_cryptodev_trace_sym_session_get_user_data;
 	__rte_cryptodev_trace_sym_session_set_user_data;
 	__rte_cryptodev_trace_count;
+
+	# added 23.03
+	rte_cryptodev_asym_get_xform_string;
+	rte_cryptodev_get_aead_algo_string;
+	rte_cryptodev_get_auth_algo_string;
+	rte_cryptodev_get_cipher_algo_string;
 };
 
 INTERNAL {
 	global:
 
+	__rte_cryptodev_trace_asym_get_xform_string;
+	__rte_cryptodev_trace_get_aead_algo_string;
+	__rte_cryptodev_trace_get_auth_algo_string;
+	__rte_cryptodev_trace_get_cipher_algo_string;
 	cryptodev_fp_ops_reset;
 	cryptodev_fp_ops_set;
 	rte_cryptodev_allocate_driver;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH v2] cryptodev: add algo enums to string conversion APIs
  2023-01-04  6:18 ` [PATCH v2] " Akhil Goyal
@ 2023-01-05 10:56   ` Akhil Goyal
  0 siblings, 0 replies; 7+ messages in thread
From: Akhil Goyal @ 2023-01-05 10:56 UTC (permalink / raw)
  To: Akhil Goyal, dev
  Cc: ciara.power, fanzhang.oss, kai.ji, pablo.de.lara.guarch,
	hemant.agrawal, matan, g.singh, ruifeng.wang, Anoob Joseph,
	radu.nicolau, Volodymyr Fialko, ktraynor, david.marchand, thomas

> Subject: [PATCH v2] cryptodev: add algo enums to string conversion APIs
> 
> Symmetric/Asymmetric algorithm strings are accessed by application
> using arrays in cryptodev lib, which hampers new algorithms addition
> in the array due to ABI breakage.
> These arrays are now deprecated and will be removed in next ABI break
> release.
> New APIs are added for getting the algorithm strings based on enum values.
> 
> Signed-off-by: Akhil Goyal <gakhil@marvell.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> Acked-by: Anoob Joseph <anoobj@marvell.com>
> Acked-by: Ciara Power <ciara.power@intel.com>
> Acked-by: Fan Zhang <fanzhang.oss@gmail.com>
> ---
Applied to dpdk-next-crypto


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-01-05 10:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 15:10 [PATCH] cryptodev: add algo enums to string conversion APIs Akhil Goyal
2022-12-13  7:31 ` Ruifeng Wang
2022-12-13  7:37 ` Anoob Joseph
2022-12-13  8:22 ` Power, Ciara
2022-12-14  9:32 ` Zhang, Fan
2023-01-04  6:18 ` [PATCH v2] " Akhil Goyal
2023-01-05 10:56   ` Akhil Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).