summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Bodek <zbigniew.bodek@caviumnetworks.com>2017-01-12 15:52:37 +0100
committerPablo de Lara <pablo.de.lara.guarch@intel.com>2017-01-18 21:48:56 +0100
commitb5350285ce6ef3c66730f5d69f442bddb40f416b (patch)
tree44b9101d7c457d21a03112206a24bcb49efc5870
parentc9c9c4ed8746372f964042182b5a72bdee5ae5a5 (diff)
downloaddpdk-b5350285ce6ef3c66730f5d69f442bddb40f416b.zip
dpdk-b5350285ce6ef3c66730f5d69f442bddb40f416b.tar.gz
dpdk-b5350285ce6ef3c66730f5d69f442bddb40f416b.tar.xz
examples/ipsec-secgw: support SHA256 HMAC
Add minor adjustments to support SHA256 HMAC: - extend maximum key length to match SHA256 HMAC - add SHA256 HMAC parameters and configuration string - add SHA256 HMAC to inbound and outbound cases Signed-off-by: Zbigniew Bodek <zbigniew.bodek@caviumnetworks.com> Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
-rw-r--r--examples/ipsec-secgw/esp.c2
-rw-r--r--examples/ipsec-secgw/ipsec.h2
-rw-r--r--examples/ipsec-secgw/sa.c6
3 files changed, 9 insertions, 1 deletions
diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c
index 9715ea9..e77afa0 100644
--- a/examples/ipsec-secgw/esp.c
+++ b/examples/ipsec-secgw/esp.c
@@ -122,6 +122,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,
switch (sa->auth_algo) {
case RTE_CRYPTO_AUTH_NULL:
case RTE_CRYPTO_AUTH_SHA1_HMAC:
+ case RTE_CRYPTO_AUTH_SHA256_HMAC:
sym_cop->auth.data.offset = ip_hdr_len;
sym_cop->auth.data.length = sizeof(struct esp_hdr) +
sa->iv_len + payload_len;
@@ -354,6 +355,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
switch (sa->auth_algo) {
case RTE_CRYPTO_AUTH_NULL:
case RTE_CRYPTO_AUTH_SHA1_HMAC:
+ case RTE_CRYPTO_AUTH_SHA256_HMAC:
sym_cop->auth.data.offset = ip_hdr_len;
sym_cop->auth.data.length = sizeof(struct esp_hdr) +
sa->iv_len + pad_payload_len;
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index dbc8c2c..fe42661 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -90,7 +90,7 @@ struct ip_addr {
} ip;
};
-#define MAX_KEY_SIZE 20
+#define MAX_KEY_SIZE 32
struct ipsec_sa {
uint32_t spi;
diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 8c4406c..39624c4 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -114,6 +114,12 @@ const struct supported_auth_algo auth_algos[] = {
.key_len = 20
},
{
+ .keyword = "sha256-hmac",
+ .algo = RTE_CRYPTO_AUTH_SHA256_HMAC,
+ .digest_len = 12,
+ .key_len = 32
+ },
+ {
.keyword = "aes-128-gcm",
.algo = RTE_CRYPTO_AUTH_AES_GCM,
.digest_len = 16,