From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id 693C71B620 for ; Mon, 16 Oct 2017 12:35:27 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id u138so1650142wmu.5 for ; Mon, 16 Oct 2017 03:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dev-mellanox-co-il.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=gziRgV4lJfVgCU8zeMI4HRSIYqmotuYgPEexDO238Ys=; b=VC+xICb/T78N8vZlqX2Ny9H5BheperCQiGbbwsSeJWsJq8VEWPxPBhRfRQ11sJSAP+ Ed9fim0qt+aFFPtHBn+oWYD+MBredYH0FKrl7zZglnwoj9nRYWmPgcaKqXciiktPjAIr 4wpo9ziADJaNvEgz92v5KbvWXSy8YDZjfBy/oUSvfS6VLY8Uxjolr8ILOo/jU+2lONGa dRNQp72VQjzT2692RGMZbth4qxi/51/IaSRn3yqGimROrOs2IuEN1rXvnwAunmKpiT0p HwkoWjmZGui/m1D1O58cc3E1IG4YBgwfwwAz2iWDuD98//mAgw9zoIGF2SNvnGpljU/g tMjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=gziRgV4lJfVgCU8zeMI4HRSIYqmotuYgPEexDO238Ys=; b=VoELhhFB4LO5fGCzQMiouOwHyenbGFJLIu17N7K57qk6nJ8fcKwPJRdL/nRIaxVnhd T7tubA3ffS97jnTGbBOaQxRIwTtU0ozQVdINGf6CUxV5lrexsGZctQ6X5vRpjpCETZUw ZN6UlIMAA+sfjDJI7ZPn+jCMwuX5TUMcvYx4HAHxLF4+TbzGwx+O8aIqACNTFmZjsrxx SggQTdOtVqiF4qFy7tzSloBt9XM1vLsBNbVj1VxtkrDYZd0MGH7QNsUrcd8jnXqh+SuI q1oEPyDSyvaVT01uhAdNCqBhFU/DDx7H5TteSYA+oDuKFr7XtEsDRB3tk4SVEbeFf+4+ pmzg== X-Gm-Message-State: AMCzsaUe/pAE0L734O6yWvEa6+45crGbxxtGJhshHhtMiNiUfvBENDoX c8CGOcxTqXcOAXhSrbuGL9Olug== X-Google-Smtp-Source: ABhQp+TNXXuac8clXF3ldFUy9tt85NQ8zhCxqrYlmjkK05D7eG2IauRiR36gbQBjd2LGrBq9f7fPGg== X-Received: by 10.28.90.87 with SMTP id o84mr457318wmb.132.1508150127074; Mon, 16 Oct 2017 03:35:27 -0700 (PDT) Received: from [10.0.38.219] ([193.47.165.251]) by smtp.gmail.com with ESMTPSA id h21sm3468932wrf.47.2017.10.16.03.35.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 03:35:26 -0700 (PDT) To: Sergio Gonzalez Monroy , dev@dpdk.org, 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, liranl@mellanox.com, nelio.laranjeiro@6wind.com, thomas@monjalon.net References: <1507987683-12315-1-git-send-email-aviadye@dev.mellanox.co.il> <1507987683-12315-8-git-send-email-aviadye@dev.mellanox.co.il> From: Aviad Yehezkel Message-ID: <6d264c51-8e5c-f6a0-b687-51f39d2e1381@dev.mellanox.co.il> Date: Mon, 16 Oct 2017 13:35:24 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH 08/11] 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: Mon, 16 Oct 2017 10:35:27 -0000 On 10/16/2017 12:42 PM, Sergio Gonzalez Monroy wrote: > 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 You are right, according to rfc4106 the IV should be unique and can be implemented as counter. The changed was created because I put analyzer on wire and compare packets generated by this application and Linux kernel. Linux kernel sets IV as BE, so I thought it is worth to do the same for future debug / comparison. Thanks, Aviad. > >> 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) { > >