DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] l2fwd-crypto: add SNOW3G algorithms
@ 2016-03-22 13:17 Pablo de Lara
  2016-03-22 15:09 ` Trahe, Fiona
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pablo de Lara @ 2016-03-22 13:17 UTC (permalink / raw)
  To: dev; +Cc: declan.doherty, Pablo de Lara

Since SNOW3G UEA2/UIA2 are supported now by both HW and SW,
l2fwd-crypto may use them, extending the list of algorithms
parsed from command line.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 examples/l2fwd-crypto/main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 59f8c92..05cdd26 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -835,6 +835,9 @@ parse_cipher_algo(enum rte_crypto_cipher_algorithm *algo, char *optarg)
 	} else if (strcmp("AES_GCM", optarg) == 0) {
 		*algo = RTE_CRYPTO_CIPHER_AES_GCM;
 		return 0;
+	} else if (strcmp("SNOW3G_UEA2", optarg) == 0) {
+		*algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+		return 0;
 	}
 
 	printf("Cipher algorithm  not supported!\n");
@@ -901,6 +904,9 @@ parse_auth_algo(enum rte_crypto_auth_algorithm *algo, char *optarg)
 	} else if (strcmp("SHA512_HMAC", optarg) == 0) {
 		*algo = RTE_CRYPTO_AUTH_SHA512_HMAC;
 		return 0;
+	} else if (strcmp("SNOW3G_UIA2", optarg) == 0) {
+		*algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
+		return 0;
 	}
 
 	printf("Authentication algorithm specified not supported!\n");
-- 
2.5.0

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

* Re: [dpdk-dev] [PATCH] l2fwd-crypto: add SNOW3G algorithms
  2016-03-22 13:17 [dpdk-dev] [PATCH] l2fwd-crypto: add SNOW3G algorithms Pablo de Lara
@ 2016-03-22 15:09 ` Trahe, Fiona
  2016-03-22 17:41 ` De Lara Guarch, Pablo
  2016-03-22 21:23 ` [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto Pablo de Lara
  2 siblings, 0 replies; 8+ messages in thread
From: Trahe, Fiona @ 2016-03-22 15:09 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, dev; +Cc: Doherty, Declan, De Lara Guarch, Pablo



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara
> Sent: Tuesday, March 22, 2016 1:17 PM
> To: dev@dpdk.org
> Cc: Doherty, Declan; De Lara Guarch, Pablo
> Subject: [dpdk-dev] [PATCH] l2fwd-crypto: add SNOW3G algorithms
> 
> Since SNOW3G UEA2/UIA2 are supported now by both HW and SW, l2fwd-
> crypto may use them, extending the list of algorithms parsed from command
> line.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Acked-by: Fiona Trahe <fiona.trahe@intel.com>

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

* Re: [dpdk-dev] [PATCH] l2fwd-crypto: add SNOW3G algorithms
  2016-03-22 13:17 [dpdk-dev] [PATCH] l2fwd-crypto: add SNOW3G algorithms Pablo de Lara
  2016-03-22 15:09 ` Trahe, Fiona
@ 2016-03-22 17:41 ` De Lara Guarch, Pablo
  2016-03-22 21:23 ` [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto Pablo de Lara
  2 siblings, 0 replies; 8+ messages in thread
From: De Lara Guarch, Pablo @ 2016-03-22 17:41 UTC (permalink / raw)
  To: dev; +Cc: Doherty, Declan



> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Tuesday, March 22, 2016 1:17 PM
> To: dev@dpdk.org
> Cc: Doherty, Declan; De Lara Guarch, Pablo
> Subject: [PATCH] l2fwd-crypto: add SNOW3G algorithms
> 
> Since SNOW3G UEA2/UIA2 are supported now by both HW and SW,
> l2fwd-crypto may use them, extending the list of algorithms
> parsed from command line.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Nack, need to change the data length/offset to bits.

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

* [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto
  2016-03-22 13:17 [dpdk-dev] [PATCH] l2fwd-crypto: add SNOW3G algorithms Pablo de Lara
  2016-03-22 15:09 ` Trahe, Fiona
  2016-03-22 17:41 ` De Lara Guarch, Pablo
@ 2016-03-22 21:23 ` Pablo de Lara
  2016-03-22 21:23   ` [dpdk-dev] [PATCH v2 1/3] l2fwd-crypto: add SNOW3G algorithms Pablo de Lara
                     ` (3 more replies)
  2 siblings, 4 replies; 8+ messages in thread
From: Pablo de Lara @ 2016-03-22 21:23 UTC (permalink / raw)
  To: dev; +Cc: declan.doherty, Pablo de Lara

New cipher/authentication algorithms are supported in cryptodev,
so L2fwd-crypto needs to have the list of supported algorithms updated.

Changes in v2:
- Added other two algorithms
- Modified offset and length in bits for SNOW3G algorithms

Pablo de Lara (3):
  l2fwd-crypto: add SNOW3G algorithms
  l2fwd-crypto: add AES GCM in auth algo list
  l2fwd-crypto: add NULL in cipher/auth algo list

 examples/l2fwd-crypto/main.c | 59 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 49 insertions(+), 10 deletions(-)

-- 
2.5.0

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

* [dpdk-dev] [PATCH v2 1/3] l2fwd-crypto: add SNOW3G algorithms
  2016-03-22 21:23 ` [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto Pablo de Lara
@ 2016-03-22 21:23   ` Pablo de Lara
  2016-03-22 21:24   ` [dpdk-dev] [PATCH v2 2/3] l2fwd-crypto: add AES GCM in auth algo list Pablo de Lara
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Pablo de Lara @ 2016-03-22 21:23 UTC (permalink / raw)
  To: dev; +Cc: declan.doherty, Pablo de Lara

Since SNOW3G UEA2/UIA2 are supported now by both HW and SW,
l2fwd-crypto may use them, extending the list of algorithms
parsed from command line.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 examples/l2fwd-crypto/main.c | 48 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 39 insertions(+), 9 deletions(-)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 762d22a..2fd0778 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -178,6 +178,9 @@ struct l2fwd_crypto_params {
 	uint8_t do_cipher;
 	uint8_t do_hash;
 	uint8_t hash_verify;
+
+	enum rte_crypto_cipher_algorithm cipher_algo;
+	enum rte_crypto_auth_algorithm auth_algo;
 };
 
 /** lcore configuration */
@@ -426,8 +429,14 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
 				rte_pktmbuf_pkt_len(m) - cparams->digest_length);
 		op->sym->auth.digest.length = cparams->digest_length;
 
-		op->sym->auth.data.offset = ipdata_offset;
-		op->sym->auth.data.length = data_len;
+		/* For SNOW3G algorithms, offset/length must be in bits */
+		if (cparams->auth_algo == RTE_CRYPTO_AUTH_SNOW3G_UIA2) {
+			op->sym->auth.data.offset = ipdata_offset << 3;
+			op->sym->auth.data.length = data_len << 3;
+		} else {
+			op->sym->auth.data.offset = ipdata_offset;
+			op->sym->auth.data.length = data_len;
+		}
 
 		if (cparams->aad.length) {
 			op->sym->auth.aad.data = cparams->aad.data;
@@ -441,13 +450,25 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
 		op->sym->cipher.iv.phys_addr = cparams->iv.phys_addr;
 		op->sym->cipher.iv.length = cparams->iv.length;
 
-		op->sym->cipher.data.offset = ipdata_offset;
-		if (cparams->do_hash && cparams->hash_verify)
-			/* Do not cipher the hash tag */
-			op->sym->cipher.data.length = data_len -
-				cparams->digest_length;
-		else
-			op->sym->cipher.data.length = data_len;
+		/* For SNOW3G algorithms, offset/length must be in bits */
+		if (cparams->cipher_algo == RTE_CRYPTO_CIPHER_SNOW3G_UEA2) {
+			op->sym->cipher.data.offset = ipdata_offset << 3;
+			if (cparams->do_hash && cparams->hash_verify)
+				/* Do not cipher the hash tag */
+				op->sym->cipher.data.length = (data_len -
+					cparams->digest_length) << 3;
+			else
+				op->sym->cipher.data.length = data_len << 3;
+
+		} else {
+			op->sym->cipher.data.offset = ipdata_offset;
+			if (cparams->do_hash && cparams->hash_verify)
+				/* Do not cipher the hash tag */
+				op->sym->cipher.data.length = data_len -
+					cparams->digest_length;
+			else
+				op->sym->cipher.data.length = data_len;
+		}
 	}
 
 	op->sym->m_src = m;
@@ -630,6 +651,8 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)
 				port_cparams[i].hash_verify = 1;
 			else
 				port_cparams[i].hash_verify = 0;
+
+			port_cparams[i].auth_algo = options->auth_xform.auth.algo;
 		}
 
 		if (port_cparams[i].do_cipher) {
@@ -640,6 +663,7 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options)
 				generate_random_key(port_cparams[i].iv.data,
 						sizeof(port_cparams[i].iv.length));
 
+			port_cparams[i].cipher_algo = options->cipher_xform.cipher.algo;
 		}
 
 		port_cparams[i].session = initialize_crypto_session(options,
@@ -835,6 +859,9 @@ parse_cipher_algo(enum rte_crypto_cipher_algorithm *algo, char *optarg)
 	} else if (strcmp("AES_GCM", optarg) == 0) {
 		*algo = RTE_CRYPTO_CIPHER_AES_GCM;
 		return 0;
+	} else if (strcmp("SNOW3G_UEA2", optarg) == 0) {
+		*algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+		return 0;
 	}
 
 	printf("Cipher algorithm  not supported!\n");
@@ -901,6 +928,9 @@ parse_auth_algo(enum rte_crypto_auth_algorithm *algo, char *optarg)
 	} else if (strcmp("SHA512_HMAC", optarg) == 0) {
 		*algo = RTE_CRYPTO_AUTH_SHA512_HMAC;
 		return 0;
+	} else if (strcmp("SNOW3G_UIA2", optarg) == 0) {
+		*algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
+		return 0;
 	}
 
 	printf("Authentication algorithm specified not supported!\n");
-- 
2.5.0

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

* [dpdk-dev] [PATCH v2 2/3] l2fwd-crypto: add AES GCM in auth algo list
  2016-03-22 21:23 ` [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto Pablo de Lara
  2016-03-22 21:23   ` [dpdk-dev] [PATCH v2 1/3] l2fwd-crypto: add SNOW3G algorithms Pablo de Lara
@ 2016-03-22 21:24   ` Pablo de Lara
  2016-03-22 21:24   ` [dpdk-dev] [PATCH v2 3/3] l2fwd-crypto: add NULL in cipher/auth " Pablo de Lara
  2016-03-24 19:53   ` [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto Thomas Monjalon
  3 siblings, 0 replies; 8+ messages in thread
From: Pablo de Lara @ 2016-03-22 21:24 UTC (permalink / raw)
  To: dev; +Cc: declan.doherty, Pablo de Lara

AES GCM is an algorithm for both ciphering and authentication,
but the authentication algorithm was missing in the
list of supported algorithms that can be passed from command line.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 examples/l2fwd-crypto/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 2fd0778..f8713e4 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -910,7 +910,10 @@ parse_key(uint8_t *data, char *input_arg)
 static int
 parse_auth_algo(enum rte_crypto_auth_algorithm *algo, char *optarg)
 {
-	if (strcmp("MD5_HMAC", optarg) == 0) {
+	if (strcmp("AES_GCM", optarg) == 0) {
+		*algo = RTE_CRYPTO_AUTH_AES_GCM;
+		return 0;
+	} else if (strcmp("MD5_HMAC", optarg) == 0) {
 		*algo = RTE_CRYPTO_AUTH_MD5_HMAC;
 		return 0;
 	} else if (strcmp("SHA1_HMAC", optarg) == 0) {
-- 
2.5.0

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

* [dpdk-dev] [PATCH v2 3/3] l2fwd-crypto: add NULL in cipher/auth algo list
  2016-03-22 21:23 ` [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto Pablo de Lara
  2016-03-22 21:23   ` [dpdk-dev] [PATCH v2 1/3] l2fwd-crypto: add SNOW3G algorithms Pablo de Lara
  2016-03-22 21:24   ` [dpdk-dev] [PATCH v2 2/3] l2fwd-crypto: add AES GCM in auth algo list Pablo de Lara
@ 2016-03-22 21:24   ` Pablo de Lara
  2016-03-24 19:53   ` [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto Thomas Monjalon
  3 siblings, 0 replies; 8+ messages in thread
From: Pablo de Lara @ 2016-03-22 21:24 UTC (permalink / raw)
  To: dev; +Cc: declan.doherty, Pablo de Lara

NULL crypto operation is now supported, but l2fwd-crypto
was missing an update on the list of supported algorithms
that can be passed from command line.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 examples/l2fwd-crypto/main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index f8713e4..cb3bdbe 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -859,6 +859,9 @@ parse_cipher_algo(enum rte_crypto_cipher_algorithm *algo, char *optarg)
 	} else if (strcmp("AES_GCM", optarg) == 0) {
 		*algo = RTE_CRYPTO_CIPHER_AES_GCM;
 		return 0;
+	} else if (strcmp("NULL", optarg) == 0) {
+		*algo = RTE_CRYPTO_CIPHER_NULL;
+		return 0;
 	} else if (strcmp("SNOW3G_UEA2", optarg) == 0) {
 		*algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
 		return 0;
@@ -916,6 +919,9 @@ parse_auth_algo(enum rte_crypto_auth_algorithm *algo, char *optarg)
 	} else if (strcmp("MD5_HMAC", optarg) == 0) {
 		*algo = RTE_CRYPTO_AUTH_MD5_HMAC;
 		return 0;
+	} else if (strcmp("NULL", optarg) == 0) {
+		*algo = RTE_CRYPTO_AUTH_NULL;
+		return 0;
 	} else if (strcmp("SHA1_HMAC", optarg) == 0) {
 		*algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
 		return 0;
-- 
2.5.0

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

* Re: [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto
  2016-03-22 21:23 ` [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto Pablo de Lara
                     ` (2 preceding siblings ...)
  2016-03-22 21:24   ` [dpdk-dev] [PATCH v2 3/3] l2fwd-crypto: add NULL in cipher/auth " Pablo de Lara
@ 2016-03-24 19:53   ` Thomas Monjalon
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2016-03-24 19:53 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev, declan.doherty

2016-03-22 21:23, Pablo de Lara:
> New cipher/authentication algorithms are supported in cryptodev,
> so L2fwd-crypto needs to have the list of supported algorithms updated.
> 
> Changes in v2:
> - Added other two algorithms
> - Modified offset and length in bits for SNOW3G algorithms
> 
> Pablo de Lara (3):
>   l2fwd-crypto: add SNOW3G algorithms
>   l2fwd-crypto: add AES GCM in auth algo list
>   l2fwd-crypto: add NULL in cipher/auth algo list

Applied, thanks

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

end of thread, other threads:[~2016-03-24 19:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-22 13:17 [dpdk-dev] [PATCH] l2fwd-crypto: add SNOW3G algorithms Pablo de Lara
2016-03-22 15:09 ` Trahe, Fiona
2016-03-22 17:41 ` De Lara Guarch, Pablo
2016-03-22 21:23 ` [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto Pablo de Lara
2016-03-22 21:23   ` [dpdk-dev] [PATCH v2 1/3] l2fwd-crypto: add SNOW3G algorithms Pablo de Lara
2016-03-22 21:24   ` [dpdk-dev] [PATCH v2 2/3] l2fwd-crypto: add AES GCM in auth algo list Pablo de Lara
2016-03-22 21:24   ` [dpdk-dev] [PATCH v2 3/3] l2fwd-crypto: add NULL in cipher/auth " Pablo de Lara
2016-03-24 19:53   ` [dpdk-dev] [PATCH v2 0/3] Extend list of supported algorithms in L2fwd-crypto Thomas Monjalon

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).