Signed-off-by: Nicolas Morey-Chaisemartin <nmo...@kalray.eu> --- example/ipsec/odp_ipsec.c | 2 +- example/ipsec/odp_ipsec_misc.h | 8 ++++++-- example/ipsec/odp_ipsec_sa_db.c | 4 ++++ example/ipsec/odp_ipsec_stream.c | 3 ++- 4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index e76e6eb..d784c31 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1554,7 +1554,7 @@ static void usage(char *progname) " -r, --route SubNet:Intf:NextHopMAC\n" " -p, --policy SrcSubNet:DstSubNet:(in|out):(ah|esp|both)\n" " -e, --esp SrcIP:DstIP:(3des|null):SPI:Key192\n" - " -a, --ah SrcIP:DstIP:(md5|null):SPI:Key128\n" + " -a, --ah SrcIP:DstIP:(sha256|md5|null):SPI:Key(256|128)\n" "\n" " Where: NextHopMAC is raw hex/dot notation, i.e. 03.BA.44.9A.CE.02\n" " IP is decimal/dot notation, i.e. 192.168.1.1\n" diff --git a/example/ipsec/odp_ipsec_misc.h b/example/ipsec/odp_ipsec_misc.h index 85c5f6a..e583c01 100644 --- a/example/ipsec/odp_ipsec_misc.h +++ b/example/ipsec/odp_ipsec_misc.h @@ -28,8 +28,9 @@ extern "C" { #define MAX_STRING 32 /**< maximum string length */ #define MAX_IV_LEN 32 /**< Maximum IV length in bytes */ -#define KEY_BITS_3DES 192 /**< 3DES cipher key length in bits */ -#define KEY_BITS_MD5_96 128 /**< MD5_96 auth key length in bits */ +#define KEY_BITS_3DES 192 /**< 3DES cipher key length in bits */ +#define KEY_BITS_MD5_96 128 /**< MD5_96 auth key length in bits */ +#define KEY_BITS_SHA256_128 256 /**< SHA256_128 auth key length in bits */ /**< Number of bits represnted by a string of hexadecimal characters */ #define KEY_STR_BITS(str) (4 * strlen(str)) @@ -102,6 +103,9 @@ int parse_key_string(char *keystring, if ((alg->u.auth == ODP_AUTH_ALG_MD5_96) && (KEY_BITS_MD5_96 == key_bits_in)) key->length = key_bits_in / 8; + else if ((alg->u.auth == ODP_AUTH_ALG_SHA256_128) && + (KEY_BITS_SHA256_128 == key_bits_in)) + key->length = key_bits_in / 8; } for (idx = 0; idx < key->length; idx++) { diff --git a/example/ipsec/odp_ipsec_sa_db.c b/example/ipsec/odp_ipsec_sa_db.c index 7967614..928c4cb 100644 --- a/example/ipsec/odp_ipsec_sa_db.c +++ b/example/ipsec/odp_ipsec_sa_db.c @@ -111,6 +111,10 @@ int create_sa_db_entry(char *input, odp_bool_t cipher) entry->alg.u.auth = ODP_AUTH_ALG_MD5_96; entry->icv_len = 12; + } else if (!strcmp(token, "sha256")) { + entry->alg.u.auth = + ODP_AUTH_ALG_SHA256_128; + entry->icv_len = 16; } else { entry->alg.u.auth = ODP_AUTH_ALG_NULL; } diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index 8a1cc56..f750e18 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -227,7 +227,8 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, /* AH (if specified) */ if (entry && (entry == stream->input.entry) && (ODP_AUTH_ALG_NULL != entry->ah.alg)) { - if (ODP_AUTH_ALG_MD5_96 != entry->ah.alg) + if (entry->ah.alg != ODP_AUTH_ALG_MD5_96 && + entry->ah.alg != ODP_AUTH_ALG_SHA256_128) abort(); ah = (odph_ahhdr_t *)data; -- 2.6.2.406.gaaaec35 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp