From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 8C71F2BBE; Mon, 17 Apr 2017 14:23:47 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP; 17 Apr 2017 05:23:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,215,1488873600"; d="scan'208";a="1157049235" Received: from silpixa00381631.ir.intel.com (HELO silpixa00381631.ger.corp.intel.com) ([10.237.222.122]) by fmsmga002.fm.intel.com with ESMTP; 17 Apr 2017 05:23:45 -0700 From: Pablo de Lara To: dev@dpdk.org Cc: stable@dpdk.org, Pablo de Lara Date: Mon, 17 Apr 2017 13:23:37 +0100 Message-Id: <1492431817-50565-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] examples/l2fwd-crypto: fix AEAD tests when AAD is zero 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, 17 Apr 2017 12:23:48 -0000 For AEAD algorithms, additional authenticated data (AAD) can be passed, but it is optional, so its size can be zero. However, it is required to set this length to zero in the crypto operation to avoid undefined behaviour. Fixes: 617a7949c98a ("examples/l2fwd-crypto: parse AAD parameter") Signed-off-by: Pablo de Lara --- examples/l2fwd-crypto/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 15fab10..2eb14c1 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -470,6 +470,10 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, op->sym->auth.aad.data = cparams->aad.data; op->sym->auth.aad.phys_addr = cparams->aad.phys_addr; op->sym->auth.aad.length = cparams->aad.length; + } else { + op->sym->auth.aad.data = NULL; + op->sym->auth.aad.phys_addr = 0; + op->sym->auth.aad.length = 0; } } @@ -670,7 +674,8 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options) generate_random_key(port_cparams[i].aad.data, port_cparams[i].aad.length); - } + } else + port_cparams[i].aad.length = 0; if (options->auth_xform.auth.op == RTE_CRYPTO_AUTH_OP_VERIFY) port_cparams[i].hash_verify = 1; -- 2.7.4