From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id C68361B7DD for ; Tue, 24 Oct 2017 14:49:02 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from aviadye@dev.mellanox.co.il) with ESMTPS (AES256-SHA encrypted); 24 Oct 2017 14:49:01 +0200 Received: from l-vmw-rdcore-205.mtl.labs.mlnx (l-vmw-rdcore-205.mtl.labs.mlnx [10.7.66.205]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v9OCn1a9006292; Tue, 24 Oct 2017 15:49:01 +0300 From: aviadye@dev.mellanox.co.il To: dev@dpdk.org, sergio.gonzalez.monroy@intel.com, pablo.de.lara.guarch@intel.com, aviadye@mellanox.com Cc: borisp@mellanox.com, akhil.goyal@nxp.com, hemant.agrawal@nxp.com, radu.nicolau@intel.com, declan.doherty@intel.com, aviadye@dev.mellanox.co.il, liranl@mellanox.com, nelio.laranjeiro@6wind.com, thomas@monjalon.net Date: Tue, 24 Oct 2017 15:49:00 +0300 Message-Id: <1508849340-23758-4-git-send-email-aviadye@dev.mellanox.co.il> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508849340-23758-1-git-send-email-aviadye@dev.mellanox.co.il> References: <1507987683-12315-1-git-send-email-aviadye@dev.mellanox.co.il> <1508849340-23758-1-git-send-email-aviadye@dev.mellanox.co.il> Subject: [dpdk-dev] [PATCH v3 4/4] examples/ipsec-secgw: iv should be be64 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 12:49:03 -0000 From: Aviad Yehezkel According to rfc4106 the IV should be unique and can be implemented as counter. The changed was created because putting an analyzer on wire and comparing packets generated by this application and Linux kernel. Linux kernel sets IV as BE, so it is worth to do the same for future debug / comparison. Signed-off-by: Aviad Yehezkel -- v3: * Fix commit message. v2: * Fix commit message. --- examples/ipsec-secgw/esp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c index 063e63f..a63fb95 100644 --- a/examples/ipsec-secgw/esp.c +++ b/examples/ipsec-secgw/esp.c @@ -331,7 +331,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, if (sa->aead_algo == RTE_CRYPTO_AEAD_AES_GCM) { uint8_t *aad; - *iv = sa->seq; + *iv = rte_cpu_to_be_64(sa->seq); sym_cop->aead.data.offset = ip_hdr_len + sizeof(struct esp_hdr) + sa->iv_len; sym_cop->aead.data.length = pad_payload_len; @@ -344,7 +344,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, struct cnt_blk *icb = get_cnt_blk(m); icb->salt = sa->salt; - icb->iv = sa->seq; + icb->iv = rte_cpu_to_be_64(sa->seq); icb->cnt = rte_cpu_to_be_32(1); aad = get_aad(m); @@ -367,7 +367,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, sym_cop->cipher.data.length = pad_payload_len + sa->iv_len; break; case RTE_CRYPTO_CIPHER_AES_CTR: - *iv = sa->seq; + *iv = rte_cpu_to_be_64(sa->seq); sym_cop->cipher.data.offset = ip_hdr_len + sizeof(struct esp_hdr) + sa->iv_len; sym_cop->cipher.data.length = pad_payload_len; @@ -386,7 +386,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, struct cnt_blk *icb = get_cnt_blk(m); icb->salt = sa->salt; - icb->iv = sa->seq; + icb->iv = rte_cpu_to_be_64(sa->seq); icb->cnt = rte_cpu_to_be_32(1); switch (sa->auth_algo) { -- 2.7.4