From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6E7E6A2EDB for ; Tue, 1 Oct 2019 12:14:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0DC185B3A; Tue, 1 Oct 2019 12:14:17 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 96AA44C8D for ; Tue, 1 Oct 2019 12:14:13 +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 x91A5Z9X010311; Tue, 1 Oct 2019 03:14:11 -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=C65KNs5TTDVenP53fSa4qf3WVWPepw7hOR65DTUiy8Q=; b=WSw/OlG+Be2Jjg7DMoSso0K45dd033O7bFntlUbNXl4d76ChNT61wW2VhNGva/fNFAQt oXGZqryDAACuArCGYFVIivGpEl8GngREVSf/2zI1mZAA9WurvRlHBfjtEwTsNv3kwZYf BmLjHIaKvGYBc8iDY1BhhNA8Pm3RH/0tenG2xUEOJTXo4dgAEysoj+rCWjQ+b1xXKnbB hH6FXoNpefRAaz4S3/ebaqGlFCAq4/88a2euf5q2ipgee00zCVeKqbiuSYMzg7eSdiBg ioayrYQP2Scr1BBRKLjfjS2S/D9yLzHuVrsAyoTCVQ0M0N9zJ6wgT3jniDw14/OPbOL3 LQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2vbur19ncu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 01 Oct 2019 03:14:11 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 1 Oct 2019 03:14:11 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 1 Oct 2019 03:14:11 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 5A0B33F7041; Tue, 1 Oct 2019 03:14:09 -0700 (PDT) From: To: CC: , , , Date: Tue, 1 Oct 2019 13:32:44 +0300 Message-ID: <20191001103246.29830-2-michaelsh@marvell.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191001103246.29830-1-michaelsh@marvell.com> References: <20190826094120.22590-1-michaelsh@marvell.com> <20191001103246.29830-1-michaelsh@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-01_05:2019-10-01,2019-10-01 signatures=0 Subject: [dpdk-dev] [PATCH v3 1/3] examples/fips_validation: add TDES ECB support 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 Signed-off-by: Michael Shamis --- examples/fips_validation/fips_validation.c | 1 + examples/fips_validation/fips_validation.h | 7 +++++ .../fips_validation/fips_validation_tdes.c | 7 +++++ examples/fips_validation/main.c | 27 ++++++++++++++++--- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 8d43b267e..07ffa62e9 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -257,6 +257,7 @@ fips_test_init(const char *req_file_path, const char *rsp_file_path, fips_test_clear(); + strcpy(info.file_name, req_file_path); info.algo = FIPS_TEST_ALGO_MAX; if (parse_file_type(req_file_path) < 0) { RTE_LOG(ERR, USER1, "File %s type not supported\n", diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h index b604db9ec..d487fb005 100644 --- a/examples/fips_validation/fips_validation.h +++ b/examples/fips_validation/fips_validation.h @@ -105,6 +105,11 @@ enum fips_tdes_test_types { TDES_MMT /* Multi block Message Test */ }; +enum fips_tdes_test_mode { + TDES_MODE_CBC = 0, + TDES_MODE_ECB +}; + enum fips_ccm_test_types { CCM_VADT = 1, /* Variable Associated Data Test */ CCM_VPT, /* Variable Payload Test */ @@ -130,6 +135,7 @@ struct hmac_interim_data { struct tdes_interim_data { enum fips_tdes_test_types test_type; + enum fips_tdes_test_mode test_mode; uint32_t nb_keys; }; @@ -156,6 +162,7 @@ struct fips_test_interim_info { char *vec[MAX_LINE_PER_VECTOR]; uint32_t nb_vec_lines; char device_name[MAX_STRING_SIZE]; + char file_name[MAX_STRING_SIZE]; union { struct aesavs_interim_data aes_data; diff --git a/examples/fips_validation/fips_validation_tdes.c b/examples/fips_validation/fips_validation_tdes.c index 2b262c9a0..5b6737643 100644 --- a/examples/fips_validation/fips_validation_tdes.c +++ b/examples/fips_validation/fips_validation_tdes.c @@ -12,6 +12,7 @@ #define NEW_LINE_STR "#" #define TEST_TYPE_KEY " for CBC" +#define TEST_TYPE_ECB_KEY " for ECB" #define TEST_CBCI_KEY " for CBCI" #define ENC_STR "[ENCRYPT]" @@ -252,6 +253,12 @@ parse_test_tdes_init(void) if (strstr(line, test_types[j].desc)) { info.interim_info.tdes_data.test_type = test_types[j].type; + if (strstr(line, TEST_TYPE_ECB_KEY)) + info.interim_info.tdes_data.test_mode = + TDES_MODE_ECB; + else + info.interim_info.tdes_data.test_mode = + TDES_MODE_CBC; break; } } diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index 813534068..7a379bc99 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -689,16 +689,24 @@ prepare_tdes_xform(struct rte_crypto_sym_xform *xform) xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER; - cipher_xform->algo = RTE_CRYPTO_CIPHER_3DES_CBC; + if (info.interim_info.tdes_data.test_mode == TDES_MODE_CBC) + cipher_xform->algo = RTE_CRYPTO_CIPHER_3DES_CBC; + else + cipher_xform->algo = RTE_CRYPTO_CIPHER_3DES_ECB; cipher_xform->op = (info.op == FIPS_TEST_ENC_AUTH_GEN) ? RTE_CRYPTO_CIPHER_OP_ENCRYPT : RTE_CRYPTO_CIPHER_OP_DECRYPT; cipher_xform->key.data = vec.cipher_auth.key.val; cipher_xform->key.length = vec.cipher_auth.key.len; - cipher_xform->iv.length = vec.iv.len; - cipher_xform->iv.offset = IV_OFF; - cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_3DES_CBC; + if (cipher_xform->algo == RTE_CRYPTO_CIPHER_3DES_CBC) { + cipher_xform->iv.length = vec.iv.len; + cipher_xform->iv.offset = IV_OFF; + } else { + cipher_xform->iv.length = 0; + cipher_xform->iv.offset = 0; + } + cap_idx.algo.cipher = cipher_xform->algo; cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; cap = rte_cryptodev_sym_capability_get(env.dev_id, &cap_idx); @@ -1387,6 +1395,17 @@ init_test_ops(void) test_ops.test = fips_generic_test; break; default: + if (strstr(info.file_name, "TECB") || + strstr(info.file_name, "TCBC")) { + info.algo = FIPS_TEST_ALGO_TDES; + test_ops.prepare_op = prepare_cipher_op; + test_ops.prepare_xform = prepare_tdes_xform; + if (info.interim_info.tdes_data.test_type == TDES_MCT) + test_ops.test = fips_mct_tdes_test; + else + test_ops.test = fips_generic_test; + break; + } return -1; } -- 2.23.0