From patchwork Mon Aug 26 09:41:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57889 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 23B1D1BFB7; Mon, 26 Aug 2019 11:24:06 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 947C71BF9F for ; Mon, 26 Aug 2019 11:24:02 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7Q9K6vE029862; Mon, 26 Aug 2019 02:24:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=nT4u+8fgA9g1EuDuh8SwJPebdWiaH3OwZ33f4HZJap0=; b=p/Z3nR5N6mpHtXtA0Wbcov4vwh5xBrl2Nh3H08LnRK9byEZWu5qnraJRIyNTKFZiX90J NJFBB5ZGZCxmv+rm8rCLrAU7a6je7uyw7grSm3hwJvUxWZQBK7v6yug3ikouW7aRYoWC 3hGMoWruQqGoLqHwHAFE5So4qE5VGmJh60ff85sKxxq0svZ7zmNRdbMBWh7jWGHkMKDQ nz6lgEQFqmxJ+YtX1QA295GDdlVImLCHgzOGdmFtQwbBlqBhq2PVxUoA0Kfi6KrF1ao3 4fqUeGAyVkRbEVpUXN+BCrmp8eHcngdFItAQ0rOpR3SrM8PxNhcJLYwKjwvxpgNssO4w sw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2uk2kpxf35-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:24:01 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 02:24:00 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 26 Aug 2019 02:24:00 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 64F4B3F7045; Mon, 26 Aug 2019 02:23:59 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:14 +0300 Message-ID: <20190826094120.22590-7-michaelsh@marvell.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190826094120.22590-1-michaelsh@marvell.com> References: <20190826094120.22590-1-michaelsh@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-08-26_06:2019-08-23,2019-08-26 signatures=0 Subject: [dpdk-dev] [PATCH 06/12] examples/fips: set initial IV in AES-GCM if configured only salt value 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Michael Shamis Configurated AES-GCM IV may include only salt value which length is 12B. In this case driver should set second part of IV to initial value = 0x1. Signed-off-by: Michael Shamis --- examples/fips_validation/main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index c83763b13..895bfa7d8 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -25,6 +25,7 @@ #define CRYPTODEV_BK_DIR_KEY "broken-test-dir" #define CRYPTODEV_ENC_KEYWORD "enc" #define CRYPTODEV_DEC_KEYWORD "dec" +#define IV_SALT_LEN 12 struct fips_test_vector vec; struct fips_test_interim_info info; @@ -580,10 +581,16 @@ prepare_aead_op(void) __rte_crypto_op_reset(env.op, RTE_CRYPTO_OP_TYPE_SYMMETRIC); rte_pktmbuf_reset(env.mbuf); - if (info.algo == FIPS_TEST_ALGO_AES_CCM) + if (info.algo == FIPS_TEST_ALGO_AES_CCM) { memcpy(iv + 1, vec.iv.val, vec.iv.len); - else + } else { memcpy(iv, vec.iv.val, vec.iv.len); + /* Set initial IV if specified only salt IV value */ + if (vec.iv.len == IV_SALT_LEN) { + memset(&iv[vec.iv.len], 0, 4); + iv[vec.iv.len + 3] = 1; + } + } sym->m_src = env.mbuf; sym->aead.data.offset = 0;