From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergio Gonzalez Monroy Subject: Re: [PATCH 08/11] examples/ipsec-secgw: iv should be be64 Date: Mon, 16 Oct 2017 10:42:23 +0100 Message-ID: References: <1507987683-12315-1-git-send-email-aviadye@dev.mellanox.co.il> <1507987683-12315-8-git-send-email-aviadye@dev.mellanox.co.il> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: borisp@mellanox.com, akhil.goyal@nxp.com, hemant.agrawal@nxp.com, radu.nicolau@intel.com, declan.doherty@intel.com, liranl@mellanox.com, nelio.laranjeiro@6wind.com, thomas@monjalon.net To: aviadye@dev.mellanox.co.il, dev@dpdk.org, pablo.de.lara.guarch@intel.com, aviadye@mellanox.com Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D96871B5DE for ; Mon, 16 Oct 2017 11:42:28 +0200 (CEST) In-Reply-To: <1507987683-12315-8-git-send-email-aviadye@dev.mellanox.co.il> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 14/10/2017 14:28, aviadye@dev.mellanox.co.il wrote: > From: Aviad Yehezkel > > To be compatibile with Linux kernel I am not sure what you are trying to achieve with this change. The requirement is that the IV is unique, IMO changing the endianess is irrelevant here. Can you provide case/example where current code does not work? Thanks, Sergio > Signed-off-by: Aviad Yehezkel > --- > 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 aa2233d..81ebf55 100644 > --- a/examples/ipsec-secgw/esp.c > +++ b/examples/ipsec-secgw/esp.c > @@ -336,7 +336,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; > @@ -349,7 +349,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); > @@ -371,7 +371,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; > @@ -390,7 +390,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) {