examples/ipsec-secgw: add AES-CTR
authorSergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Thu, 29 Sep 2016 15:44:10 +0000 (16:44 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Sat, 8 Oct 2016 15:54:38 +0000 (17:54 +0200)
RFC3686: Using AES Counter (CTR) Mode With IPsec ESP.`

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
doc/guides/rel_notes/release_16_11.rst
doc/guides/sample_app_ug/ipsec_secgw.rst
examples/ipsec-secgw/esp.c
examples/ipsec-secgw/sa.c

index 3779f13..905186a 100644 (file)
@@ -87,7 +87,7 @@ New Features
 
   * configuration file
   * AES CBC IV generation with cipher forward function
-  * AES GCM mode
+  * AES GCM/CTR mode
 
 
 Resolved Issues
index 503f674..885c77e 100644 (file)
@@ -79,7 +79,7 @@ Constraints
 
 *  No IPv6 options headers.
 *  No AH mode.
-*  Supported algorithms: AES-CBC, AES-GCM, HMAC-SHA1 and NULL.
+*  Supported algorithms: AES-CBC, AES-CTR, AES-GCM, HMAC-SHA1 and NULL.
 *  Each SA must be handle by a unique lcore (*1 RX queue per port*).
 *  No chained mbufs.
 
@@ -418,6 +418,7 @@ where each options means:
 
    * *null*: NULL algorithm
    * *aes-128-cbc*: AES-CBC 128-bit algorithm
+   * *aes-128-ctr*: AES-CTR 128-bit algorithm
    * *aes-128-gcm*: AES-GCM 128-bit algorithm
 
  * Syntax: *cipher_algo <your algorithm>*
index 7ee53da..ec5a2e6 100644 (file)
@@ -102,6 +102,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,
                                 ip_hdr_len + sizeof(struct esp_hdr));
                sym_cop->cipher.iv.length = sa->iv_len;
                break;
+       case RTE_CRYPTO_CIPHER_AES_CTR:
        case RTE_CRYPTO_CIPHER_AES_GCM:
                icb = get_cnt_blk(m);
                icb->salt = sa->salt;
@@ -320,6 +321,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
                        sizeof(struct esp_hdr);
                sym_cop->cipher.data.length = pad_payload_len + sa->iv_len;
                break;
+       case RTE_CRYPTO_CIPHER_AES_CTR:
        case RTE_CRYPTO_CIPHER_AES_GCM:
                *iv = sa->seq;
                sym_cop->cipher.data.offset = ip_hdr_len +
index d5ad5af..00c8cce 100644 (file)
@@ -88,6 +88,13 @@ const struct supported_cipher_algo cipher_algos[] = {
                .iv_len = 8,
                .block_size = 4,
                .key_len = 16
+       },
+       {
+               .keyword = "aes-128-ctr",
+               .algo = RTE_CRYPTO_CIPHER_AES_CTR,
+               .iv_len = 8,
+               .block_size = 16, /* XXX AESNI MB limition, should be 4 */
+               .key_len = 16
        }
 };