[02/14] test/crypto: move algorithm list to common

Message ID 20231207130216.140-3-anoobj@marvell.com (mailing list archive)
State Accepted
Delegated to: akhil goyal
Headers
Series Add TLS record test suite |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Anoob Joseph Dec. 7, 2023, 1:02 p.m. UTC
  From: Vidya Sagar Velumuri <vvelumuri@marvell.com>

The algorithm list and associated structs are used for IPsec combined
mode tests. The same list can be employed for other security protocol
testing as well. Move the same to test_security_proto.h for the same.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
 app/test/test_cryptodev_security_ipsec.h | 126 +----------------------
 app/test/test_security_proto.h           | 124 ++++++++++++++++++++++
 2 files changed, 126 insertions(+), 124 deletions(-)
  

Patch

diff --git a/app/test/test_cryptodev_security_ipsec.h b/app/test/test_cryptodev_security_ipsec.h
index dc1b4c4a80..77cb5fa7f9 100644
--- a/app/test/test_cryptodev_security_ipsec.h
+++ b/app/test/test_cryptodev_security_ipsec.h
@@ -8,6 +8,8 @@ 
 #include <rte_cryptodev.h>
 #include <rte_security.h>
 
+#include "test_security_proto.h"
+
 #define IPSEC_TEST_PACKETS_MAX 32
 #define IPSEC_TEXT_MAX_LEN 16384u
 
@@ -115,130 +117,6 @@  struct ipsec_test_flags {
 	bool rx_inject;
 };
 
-struct crypto_param {
-	enum rte_crypto_sym_xform_type type;
-	union {
-		enum rte_crypto_cipher_algorithm cipher;
-		enum rte_crypto_auth_algorithm auth;
-		enum rte_crypto_aead_algorithm aead;
-	} alg;
-	uint16_t key_length;
-	uint16_t iv_length;
-	uint16_t digest_length;
-};
-
-static const struct crypto_param aead_list[] = {
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_AEAD,
-		.alg.aead =  RTE_CRYPTO_AEAD_AES_GCM,
-		.key_length = 16,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_AEAD,
-		.alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
-		.key_length = 24,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_AEAD,
-		.alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
-		.key_length = 32,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_AEAD,
-		.alg.aead = RTE_CRYPTO_AEAD_AES_CCM,
-		.key_length = 32
-	},
-};
-
-static const struct crypto_param cipher_list[] = {
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-		.alg.cipher =  RTE_CRYPTO_CIPHER_NULL,
-		.key_length = 0,
-		.iv_length = 0,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-		.alg.cipher =  RTE_CRYPTO_CIPHER_DES_CBC,
-		.key_length = 8,
-		.iv_length = 8,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-		.alg.cipher =  RTE_CRYPTO_CIPHER_3DES_CBC,
-		.key_length = 24,
-		.iv_length = 8,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-		.alg.cipher =  RTE_CRYPTO_CIPHER_AES_CBC,
-		.key_length = 16,
-		.iv_length = 16,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-		.alg.cipher =  RTE_CRYPTO_CIPHER_AES_CTR,
-		.key_length = 16,
-		.iv_length = 16,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-		.alg.cipher =  RTE_CRYPTO_CIPHER_AES_CTR,
-		.key_length = 24,
-		.iv_length = 16,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-		.alg.cipher =  RTE_CRYPTO_CIPHER_AES_CTR,
-		.key_length = 32,
-		.iv_length = 16,
-	},
-};
-
-static const struct crypto_param auth_list[] = {
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
-		.alg.auth =  RTE_CRYPTO_AUTH_NULL,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
-		.alg.auth =  RTE_CRYPTO_AUTH_MD5_HMAC,
-		.key_length = 16,
-		.digest_length = 12,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
-		.alg.auth =  RTE_CRYPTO_AUTH_SHA256_HMAC,
-		.key_length = 32,
-		.digest_length = 16,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
-		.alg.auth =  RTE_CRYPTO_AUTH_SHA384_HMAC,
-		.key_length = 48,
-		.digest_length = 24,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
-		.alg.auth =  RTE_CRYPTO_AUTH_SHA512_HMAC,
-		.key_length = 64,
-		.digest_length = 32,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
-		.alg.auth =  RTE_CRYPTO_AUTH_AES_XCBC_MAC,
-		.key_length = 16,
-		.digest_length = 12,
-	},
-	{
-		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
-		.alg.auth =  RTE_CRYPTO_AUTH_AES_GMAC,
-		.key_length = 16,
-		.digest_length = 16,
-		.iv_length = 12,
-	},
-};
-
 struct crypto_param_comb {
 	const struct crypto_param *param1;
 	const struct crypto_param *param2;
diff --git a/app/test/test_security_proto.h b/app/test/test_security_proto.h
index b91181384b..e8d6193530 100644
--- a/app/test/test_security_proto.h
+++ b/app/test/test_security_proto.h
@@ -8,6 +8,130 @@ 
 #include <rte_cryptodev.h>
 #include <rte_security.h>
 
+struct crypto_param {
+	enum rte_crypto_sym_xform_type type;
+	union {
+		enum rte_crypto_cipher_algorithm cipher;
+		enum rte_crypto_auth_algorithm auth;
+		enum rte_crypto_aead_algorithm aead;
+	} alg;
+	uint16_t key_length;
+	uint16_t iv_length;
+	uint16_t digest_length;
+};
+
+static const struct crypto_param aead_list[] = {
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AEAD,
+		.alg.aead =  RTE_CRYPTO_AEAD_AES_GCM,
+		.key_length = 16,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AEAD,
+		.alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
+		.key_length = 24,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AEAD,
+		.alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
+		.key_length = 32,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AEAD,
+		.alg.aead = RTE_CRYPTO_AEAD_AES_CCM,
+		.key_length = 32
+	},
+};
+
+static const struct crypto_param cipher_list[] = {
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+		.alg.cipher =  RTE_CRYPTO_CIPHER_NULL,
+		.key_length = 0,
+		.iv_length = 0,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+		.alg.cipher =  RTE_CRYPTO_CIPHER_DES_CBC,
+		.key_length = 8,
+		.iv_length = 8,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+		.alg.cipher =  RTE_CRYPTO_CIPHER_3DES_CBC,
+		.key_length = 24,
+		.iv_length = 8,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+		.alg.cipher =  RTE_CRYPTO_CIPHER_AES_CBC,
+		.key_length = 16,
+		.iv_length = 16,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+		.alg.cipher =  RTE_CRYPTO_CIPHER_AES_CTR,
+		.key_length = 16,
+		.iv_length = 16,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+		.alg.cipher =  RTE_CRYPTO_CIPHER_AES_CTR,
+		.key_length = 24,
+		.iv_length = 16,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+		.alg.cipher =  RTE_CRYPTO_CIPHER_AES_CTR,
+		.key_length = 32,
+		.iv_length = 16,
+	},
+};
+
+static const struct crypto_param auth_list[] = {
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
+		.alg.auth =  RTE_CRYPTO_AUTH_NULL,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
+		.alg.auth =  RTE_CRYPTO_AUTH_MD5_HMAC,
+		.key_length = 16,
+		.digest_length = 12,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
+		.alg.auth =  RTE_CRYPTO_AUTH_SHA256_HMAC,
+		.key_length = 32,
+		.digest_length = 16,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
+		.alg.auth =  RTE_CRYPTO_AUTH_SHA384_HMAC,
+		.key_length = 48,
+		.digest_length = 24,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
+		.alg.auth =  RTE_CRYPTO_AUTH_SHA512_HMAC,
+		.key_length = 64,
+		.digest_length = 32,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
+		.alg.auth =  RTE_CRYPTO_AUTH_AES_XCBC_MAC,
+		.key_length = 16,
+		.digest_length = 12,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
+		.alg.auth =  RTE_CRYPTO_AUTH_AES_GMAC,
+		.key_length = 16,
+		.digest_length = 16,
+		.iv_length = 12,
+	},
+};
+
 int test_sec_crypto_caps_aead_verify(const struct rte_security_capability *sec_cap,
 		struct rte_crypto_sym_xform *aead);