From patchwork Mon Aug 26 09:41:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57884 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 09A151BF76; Mon, 26 Aug 2019 11:23:44 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id AC0D11BF46 for ; Mon, 26 Aug 2019 11:23:42 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7Q9JZUG020150; Mon, 26 Aug 2019 02:23:42 -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=WFmbeVQUPonoiTXtWn8/0vwnHdAWIcg17x28TjS91Rw=; b=rh0TzlHJX1bWRcvyWQznJycyCdmoRMhrgMdts8jJGM5k4QoXAMalFd2qOjexDtQQ4YiX RP6yjmyWrZvwNCaOzoat8AJ8qv4liYrNXK7y517FHYYvioO/GN5dHJ+oYf5JJFOegpCA loA58F7jdFfgWk/C8dkw2FvcR1b4lXQyaJtARnTl+d5Cqh/Nkd0MvBseUhE8m6P1dVwp BZ1CgJIklxqIyWNHyl0LxAE/GFEotsBAZ/FBYiCWSJF09Jh3hQY2ngKA/cnt6nTayqB6 aGnHaEj8kV/ompQlzTCMnKwmsOVK2XvE+Cf+cHQa6BK2RTgooSf7mVoOql8biOuEejiu xg== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2uk4rke1h2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:23:42 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 02:23:40 -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:23:40 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 485943F7041; Mon, 26 Aug 2019 02:23:39 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:09 +0300 Message-ID: <20190826094120.22590-2-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 01/12] examples/fips: added support for SHA algorithm in FIPS tests 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 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 8d43b267e..80fd482a1 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -145,11 +145,13 @@ fips_test_parse_header(void) if (ret < 0) return 0; } else if (strstr(info.vec[i], "SHA-")) { - algo_parsed = 1; - info.algo = FIPS_TEST_ALGO_SHA; - ret = parse_test_sha_init(); - if (ret < 0) - return ret; + if (info.algo != FIPS_TEST_ALGO_HMAC) { + algo_parsed = 1; + info.algo = FIPS_TEST_ALGO_SHA; + ret = parse_test_sha_init(); + if (ret < 0) + return ret; + } } } From patchwork Mon Aug 26 09:41:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57885 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 BD5461BF83; Mon, 26 Aug 2019 11:23:49 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 82FC61BF7A for ; Mon, 26 Aug 2019 11:23:48 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7Q9KIMv021040; Mon, 26 Aug 2019 02:23:47 -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=xfVtmLzDugqQxkROZA8iQw+eThs2wOQ9B8/3mTvWTpc=; b=g1J6F79khODj2WgKFWjQPp9v7gpeq6yFBy4ykQVxWGEQa3lQQvMA58AkEKaULk0M1Yhx WdnVJayDb953fkJZ0gcfQBZmk1UvR8vVR2qzHYDnsaoE2n1bF8vgecjfw+uZ16t7osej UXGkDCM1QjzIyQTKbDFhjqst3QsSDmpHt04229zHESKX+mbRZYAjk2RU/YTgJqGOt/XK VNQSXrx1xe2FEQwXUUpPm8jQ13VZSuf8ECI9BghXDyk6O4JC/5dDTrMYpKnU43/Jeq30 aAjyzGHy6/hLPHGdYaEc/Q1UEIDHrelfwpEMQTD7pVJjq0krfIuRPYSG8VUas1YHcgeN 8g== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2uk4rke1h8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:23:47 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 02:23:45 -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; Mon, 26 Aug 2019 02:23:45 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 69BFC3F703F; Mon, 26 Aug 2019 02:23:44 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:10 +0300 Message-ID: <20190826094120.22590-3-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 02/12] examples/fips: added support for TDES ECB mode in FIPS tests 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 80fd482a1..fe3bcc386 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -259,6 +259,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 15ee434e1..d7f4d58b0 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]" @@ -250,6 +251,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; } From patchwork Mon Aug 26 09:41:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57886 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 42A561BF92; Mon, 26 Aug 2019 11:23:57 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id AB9BA1BF82 for ; Mon, 26 Aug 2019 11:23:55 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7Q9JZva020149; Mon, 26 Aug 2019 02:23:55 -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=rbERtIoCXVuSUbU8pwmPZXozXhVl8fztFcmngtguwow=; b=gNcTSMzv63R7B/LzWEukhKoiYrc+LrNlsckPIZaVE0XjD0eI44yslwBagSxgGxo4pvSb PKylBS+MWe/t4d539RokqQMR423gV4x2QaC0m9PxWLQZhAnSvISKAH1kaJvJLRlqGjxU uYydatGpFRJf87jS5NudnHGQWUFgkzH3Vzi+hm9Hped/BTj8EPsqvRb9e1XHfu/UtwDp 9VSRSe3JXOvbn0aKTuE2jhO8S+oVIYSCOSv0fkMVciShduYYLYHW6gwoJcqbxSpaAIpO qLOcSlW7YYdlPt3sPgtXZTYKT+JypOSM3+Yc5/l4yjoz+f7CoTesBzcm7HeRQL5MK5L7 TA== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2uk4rke1hk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:23:55 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 02:23:53 -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:23:53 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 3E2953F703F; Mon, 26 Aug 2019 02:23:52 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:11 +0300 Message-ID: <20190826094120.22590-4-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 03/12] examples/fips: added support AES ECB mode in FIPS tests 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 --- .../fips_validation/fips_validation_aes.c | 1 + examples/fips_validation/main.c | 96 +++++++++++++++++-- 2 files changed, 91 insertions(+), 6 deletions(-) diff --git a/examples/fips_validation/fips_validation_aes.c b/examples/fips_validation/fips_validation_aes.c index 8cbc158eb..010a82627 100644 --- a/examples/fips_validation/fips_validation_aes.c +++ b/examples/fips_validation/fips_validation_aes.c @@ -44,6 +44,7 @@ struct aes_test_algo { enum rte_crypto_cipher_algorithm algo; } const algo_con[] = { {"CBC", RTE_CRYPTO_CIPHER_AES_CBC}, + {"ECB", RTE_CRYPTO_CIPHER_AES_ECB}, }; static int diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index 7a379bc99..c83763b13 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -649,16 +649,24 @@ prepare_aes_xform(struct rte_crypto_sym_xform *xform) xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER; - cipher_xform->algo = RTE_CRYPTO_CIPHER_AES_CBC; + if (info.interim_info.aes_data.cipher_algo == RTE_CRYPTO_CIPHER_AES_CBC) + cipher_xform->algo = RTE_CRYPTO_CIPHER_AES_CBC; + else + cipher_xform->algo = RTE_CRYPTO_CIPHER_AES_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_AES_CBC; + if (cipher_xform->algo == RTE_CRYPTO_CIPHER_AES_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); @@ -1059,7 +1067,6 @@ fips_mct_tdes_test(void) fprintf(info.fp_wr, "Bypass\n"); return 0; } - return ret; } @@ -1160,6 +1167,80 @@ fips_mct_tdes_test(void) return 0; } +static int +fips_mct_aes_ecb_test(void) +{ +#define AES_BLOCK_SIZE 16 +#define AES_EXTERN_ITER 100 +#define AES_INTERN_ITER 1000 + struct fips_val val, val_key; + uint8_t prev_out[AES_BLOCK_SIZE] = {0}; + uint32_t i, j, k; + int ret; + + for (i = 0; i < AES_EXTERN_ITER; i++) { + if (i != 0) + update_info_vec(i); + + fips_test_write_one_case(); + + for (j = 0; j < AES_INTERN_ITER; j++) { + ret = fips_run_test(); + if (ret < 0) { + if (ret == -EPERM) { + fprintf(info.fp_wr, "Bypass\n"); + return 0; + } + + return ret; + } + + get_writeback_data(&val); + + if (info.op == FIPS_TEST_ENC_AUTH_GEN) + memcpy(vec.pt.val, val.val, AES_BLOCK_SIZE); + else + memcpy(vec.ct.val, val.val, AES_BLOCK_SIZE); + + if (j == AES_INTERN_ITER - 1) + continue; + + memcpy(prev_out, val.val, AES_BLOCK_SIZE); + } + + info.parse_writeback(&val); + fprintf(info.fp_wr, "\n"); + + if (i == AES_EXTERN_ITER - 1) + continue; + + /** update key */ + memcpy(&val_key, &vec.cipher_auth.key, sizeof(val_key)); + for (k = 0; k < vec.cipher_auth.key.len; k++) { + switch (vec.cipher_auth.key.len) { + case 16: + val_key.val[k] ^= val.val[k]; + break; + case 24: + if (k < 8) + val_key.val[k] ^= prev_out[k + 8]; + else + val_key.val[k] ^= val.val[k - 8]; + break; + case 32: + if (k < 16) + val_key.val[k] ^= prev_out[k]; + else + val_key.val[k] ^= val.val[k - 16]; + break; + default: + return -1; + } + } + } + + return 0; +} static int fips_mct_aes_test(void) { @@ -1172,6 +1253,9 @@ fips_mct_aes_test(void) uint32_t i, j, k; int ret; + if (info.interim_info.aes_data.cipher_algo == RTE_CRYPTO_CIPHER_AES_ECB) + return fips_mct_aes_ecb_test(); + for (i = 0; i < AES_EXTERN_ITER; i++) { if (i != 0) update_info_vec(i); From patchwork Mon Aug 26 09:41:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57887 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 CFEF81BFAC; Mon, 26 Aug 2019 11:24:00 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id E65FD1BFA8 for ; Mon, 26 Aug 2019 11:23:59 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7Q9KIMx021040; Mon, 26 Aug 2019 02:23:59 -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=sl5WsccOCivwUL9PHl8bBqa05erQs71vRLD8waYbpfc=; b=ty+w0jhmzuUy/C2ohHG55rG5fqLO/hQrK1OkpiJFGPOYDnc67WsXRhsMoiTdgrv0GWaq r/f5cbSOPae128/KgT6l+x7Q2r0Aj5oFKuYICGcRMCSkNXeVd9A758esMNoqptklYTFN xq39vYoJngyfDyK5W0ga0bmdQugzBjQOruma0QzDjO4qv7keS1KFz7Rb753Cvh63vQvi G2Y1qAmUqp1+gQdXF6LQ9XoCmHHKrhpnVJbmXvKenww4Ib3+o+EEZxfgCPZzvo2W4hga 0uvjO6LPDZHNw3WtB9cT27vjXF8LUvHjN50IpedDSpwYszhQpjMAB12jZEXhCzsJONeA 6w== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2uk4rke1hp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:23:59 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 02:23:57 -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:23:57 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 92B9D3F7054; Mon, 26 Aug 2019 02:23:55 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:12 +0300 Message-ID: <20190826094120.22590-5-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 04/12] examples/fips: fix bad return code in fips_test_parse_header() 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 Returning correct error value by fips_test_parse_header() allows graceful exit of fips application. Signed-off-by: Michael Shamis --- examples/fips_validation/fips_validation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index fe3bcc386..91e6d48e7 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -125,13 +125,13 @@ fips_test_parse_header(void) info.algo = FIPS_TEST_ALGO_AES_CMAC; ret = parse_test_cmac_init(); if (ret < 0) - return 0; + return ret; } else if (strstr(info.vec[i], "CCM")) { algo_parsed = 1; info.algo = FIPS_TEST_ALGO_AES_CCM; ret = parse_test_ccm_init(); if (ret < 0) - return 0; + return ret; } else if (strstr(info.vec[i], "HMAC")) { algo_parsed = 1; info.algo = FIPS_TEST_ALGO_HMAC; @@ -143,7 +143,7 @@ fips_test_parse_header(void) info.algo = FIPS_TEST_ALGO_TDES; ret = parse_test_tdes_init(); if (ret < 0) - return 0; + return ret; } else if (strstr(info.vec[i], "SHA-")) { if (info.algo != FIPS_TEST_ALGO_HMAC) { algo_parsed = 1; From patchwork Mon Aug 26 09:41:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57888 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 0AACC1BFB9; Mon, 26 Aug 2019 11:24:03 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 19B1D1BFB4 for ; Mon, 26 Aug 2019 11:24:00 +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 x7Q9K2rb029835; Mon, 26 Aug 2019 02:24:00 -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=DUREQqiVEH+KBTINuX2elvOjsadinY7O4IDQYz/bnWA=; b=CAZRbClWqvLFJNBVvhr7GOQ4onmADDPMHQXu80aJCsTF84KH6ORKBgLGWsnAo19hkZhm vckSDy/WA3po9bFIl5SHrTnrSm++At+TxdrIHGf8CXH37c0z/2o0+M88ljx8gS3zqrG7 i4uY6qdF78B5Kcmz+EDHtb70DaYN9t9NX1tslrqTLGujTURL1x3Fp03fZdc3AozolkWX kDJFXzzz7DuImWXqpx36TcFA3hEeVgMMmYUcnfqpoOaDKbdKGxT0Tfw6CCHcZVjKcr65 M4z+MDtaCNlzLj9K4khSRMvqYEQSbVqQS5H71o8Ov+1/AO9+CydFF9s4UB9aWM7gzhdh FQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2uk2kpxf32-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:24:00 -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:23:59 -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:23:59 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id C6D323F7041; Mon, 26 Aug 2019 02:23:57 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:13 +0300 Message-ID: <20190826094120.22590-6-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 05/12] examples/fips: AES-GCM vectors will use aead structure 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 Before the fix AES-GCM vectores were defined by cipher_auth structure but handled by aead structure and that leads to FIPS test failure. Signed-off-by: Michael Shamis --- examples/fips_validation/fips_validation_gcm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/fips_validation/fips_validation_gcm.c b/examples/fips_validation/fips_validation_gcm.c index 0509b101a..ea48ddf70 100644 --- a/examples/fips_validation/fips_validation_gcm.c +++ b/examples/fips_validation/fips_validation_gcm.c @@ -34,29 +34,29 @@ #define NEG_TEST_STR "FAIL" struct fips_test_callback gcm_dec_vectors[] = { - {KEY_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.key}, + {KEY_STR, parse_uint8_known_len_hex_str, &vec.aead.key}, {IV_STR, parse_uint8_known_len_hex_str, &vec.iv}, {CT_STR, parse_uint8_known_len_hex_str, &vec.ct}, - {AAD_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.aad}, + {AAD_STR, parse_uint8_known_len_hex_str, &vec.aead.aad}, {TAG_STR, parse_uint8_known_len_hex_str, - &vec.cipher_auth.digest}, + &vec.aead.digest}, {NULL, NULL, NULL} /**< end pointer */ }; struct fips_test_callback gcm_interim_vectors[] = { - {KEYLEN_STR, parser_read_uint32_bit_val, &vec.cipher_auth.key}, + {KEYLEN_STR, parser_read_uint32_bit_val, &vec.aead.key}, {IVLEN_STR, parser_read_uint32_bit_val, &vec.iv}, {PTLEN_STR, parser_read_uint32_bit_val, &vec.pt}, - {AADLEN_STR, parser_read_uint32_bit_val, &vec.cipher_auth.aad}, + {AADLEN_STR, parser_read_uint32_bit_val, &vec.aead.aad}, {TAGLEN_STR, parser_read_uint32_bit_val, - &vec.cipher_auth.digest}, + &vec.aead.digest}, {NULL, NULL, NULL} /**< end pointer */ }; struct fips_test_callback gcm_enc_vectors[] = { - {KEY_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.key}, + {KEY_STR, parse_uint8_known_len_hex_str, &vec.aead.key}, {IV_STR, parse_uint8_known_len_hex_str, &vec.iv}, {PT_STR, parse_uint8_known_len_hex_str, &vec.pt}, - {AAD_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.aad}, + {AAD_STR, parse_uint8_known_len_hex_str, &vec.aead.aad}, {NULL, NULL, NULL} /**< end pointer */ }; 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; From patchwork Mon Aug 26 09:41:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57890 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 5416B1BFC8; Mon, 26 Aug 2019 11:24:08 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id A17241BF9F for ; Mon, 26 Aug 2019 11:24:04 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7Q9JZUJ020150; Mon, 26 Aug 2019 02:24:04 -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=n3GTogPvba8EmqumNxDmgWCRpBBegoNheYMxUVVW1oo=; b=TZOC5HSu9r28Ir324fnYg21AqrQY2uf52Y+AbK+mlnsxxCJjhlEGMx+opPNg7z2NMkLO FTtzyQoBdeusfdsUwHdUTT+sd26eI2DKdA57/gu7i4YdKiflQt55Mlf8E0NfGRGUaVsZ LsMrQifnW4WP0No7B1gU5zQn8ttnxdBFOpiT2318PyOJMxgp2W9Lj9lgFFdNycF+GQ4/ vTutEn8RihHM4Wsms5onLW8yLadGsS0QSbE3YhfJmre/DG0CEFd0RNI2uqvt6BDGAuOw n0R4Bz1rKqLDrPzDVRukS9DTJVu8MAShBwdi5EBhFDpyo1iOx+j03NCk6Nrzi/76oUHB mA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2uk4rke1j0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:24:04 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 02:24:02 -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; Mon, 26 Aug 2019 02:24:02 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id F3D1E3F7041; Mon, 26 Aug 2019 02:24:00 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:15 +0300 Message-ID: <20190826094120.22590-8-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 07/12] examples/fips: keep digest after crypto text 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 Fix of GCM FIPS bug: ICV was not copied after the crypto text in decryption operation so SAM failed to check authentication in GCM mode. Signed-off-by: Michael Shamis --- examples/fips_validation/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index 895bfa7d8..1d621f60a 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -636,6 +636,10 @@ prepare_aead_op(void) } memcpy(ct, vec.ct.val, vec.ct.len); + + /* keep digest after crypto text */ + memcpy(ct + vec.ct.len, vec.aead.digest.val, + vec.aead.digest.len); sym->aead.data.length = vec.ct.len; sym->aead.digest.data = vec.aead.digest.val; sym->aead.digest.phys_addr = rte_malloc_virt2iova( From patchwork Mon Aug 26 09:41:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57891 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 4F26A1BFD9; Mon, 26 Aug 2019 11:24:10 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 284C61BFBD for ; Mon, 26 Aug 2019 11:24:05 +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 x7Q9K45N029840; Mon, 26 Aug 2019 02:24:05 -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=PiywGOFmIkp+QnnEMoofqkTC3x98SnxnDGKMcbg6IVU=; b=pkP0OgvXV/b0K1lTz03n7twVM8tY9r/tn9RvRQwyGsCoyJcg3UTj5v7MbHrVtDxUKhmN WQZSEgJ0T+saVCyrrpYwYJ5w4Yijd9UPg30lNiYRALLztamOXiwYHoTWGlFDpKBEDwsZ u0SwML9+7d7YgkVX+v36dhBlYjciOqI4gqnqQnaj4VNKyJ8kLPrE3+DJXYG95/Y+fddK 6a/BJ7A6fUnVs/qHcUYH+kgvTou6zscCm1HDXvowUlx2CCk88PubU5nLKBHjJKkyGLcH TLaIGvuPdsDpaBJQNpxG+p4PAXGanQk2WATTV6HXpg2fW6tmQQUvH7X7tiH8lqTfU0Sz 6g== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2uk2kpxf3b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:24:05 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 02:24:03 -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; Mon, 26 Aug 2019 02:24:04 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 97F6E3F7048; Mon, 26 Aug 2019 02:24:02 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:16 +0300 Message-ID: <20190826094120.22590-9-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 08/12] examples/fips: AES-GCM decryption vectors fix 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 AES-GCM CAVS vectors for decryption set PTlen (plain text length) but provide crypto text and application expected CTlen to be not null. Now we assign PTlen to CTlen in decryption scenario and it allows to application to handle AES-GCM decryption vectors. Signed-off-by: Michael Shamis --- .../fips_validation/fips_validation_gcm.c | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/examples/fips_validation/fips_validation_gcm.c b/examples/fips_validation/fips_validation_gcm.c index ea48ddf70..f68b4ea82 100644 --- a/examples/fips_validation/fips_validation_gcm.c +++ b/examples/fips_validation/fips_validation_gcm.c @@ -33,10 +33,15 @@ #define NEG_TEST_STR "FAIL" +static int +parse_uint8_known_len_hex_str_dec(const char *key, + char *src, + struct fips_val *val); + struct fips_test_callback gcm_dec_vectors[] = { {KEY_STR, parse_uint8_known_len_hex_str, &vec.aead.key}, {IV_STR, parse_uint8_known_len_hex_str, &vec.iv}, - {CT_STR, parse_uint8_known_len_hex_str, &vec.ct}, + {CT_STR, parse_uint8_known_len_hex_str_dec, &vec.ct}, {AAD_STR, parse_uint8_known_len_hex_str, &vec.aead.aad}, {TAG_STR, parse_uint8_known_len_hex_str, &vec.aead.digest}, @@ -123,3 +128,19 @@ parse_test_gcm_init(void) return 0; } + +static int +parse_uint8_known_len_hex_str_dec(const char *key, + char *src, + struct fips_val *val) +{ + /* AES-GCM CAVS vectors for decryption set PTlen (plain text length) + * but provide crypto text. + * In order to compensate the behavior we assign PTlen to CTlen + * (crypto text length) which is used for calculations + */ + if (info.op == FIPS_TEST_DEC_AUTH_VERIF) + vec.ct.len = vec.pt.len; + + return parse_uint8_known_len_hex_str(key, src, val); +} From patchwork Mon Aug 26 09:41:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57892 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 1BA4B1BFE4; Mon, 26 Aug 2019 11:24:12 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 8F97D1BFA6 for ; Mon, 26 Aug 2019 11:24:07 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7Q9JZUK020150; Mon, 26 Aug 2019 02:24:07 -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=JnRdutM2CsibnosnocFEllXhBwMKAErjZ3IJncADEEY=; b=CYCFeXhmPaaj4zuYX4aqe3UQj5ybgJW58cEOpoCvDSyhwAw4guoNVjjdxlnB2Kli1ou5 yGK3Um6uV3LZBjhKOvg44dNxQ+TBP5P6xnKq9NANoHXoNjnqcR5Mk+KmO8J5jYqR0aNP TQ3dyqpb9CxU4X8Mvah0zrOJV89qrkmeZwSgIbQkleKLogC7hU2qT5kYiWqzzc3aBcEz oeXP2wWC/TECUQ20kqO4n1ikHtyxr/TTSagK+1UHE99kHN+qA4dwbo5p2vWnbltWpL9j D95av4+gTO7TyCngVRS6AZwhwIaSa+BPnsyhfFdyqzYh+LqDvbwkkVPv4UTPsMSVKKQ6 mw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2uk4rke1j5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:24:06 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 02:24:05 -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:05 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 340DD3F7041; Mon, 26 Aug 2019 02:24:03 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:17 +0300 Message-ID: <20190826094120.22590-10-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 09/12] examples/fips: fix KEY and PT output prints for TDES mode 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 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 91e6d48e7..ba513672e 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -11,6 +11,10 @@ #include "fips_validation.h" +#define COUNT0_STR "COUNT = 0 " +#define KEY_STR "KEY" +#define NK_STR "NumKey" + #define skip_white_spaces(pos) \ ({ \ __typeof__(pos) _p = (pos); \ @@ -68,6 +72,22 @@ fips_test_fetch_one_block(void) if (size == 0) break; + /* if first line is KEY-line then insert COUNT-line */ + if (i == 0) { + if (strstr(info.one_line_text, KEY_STR)) { + info.vec[0] = calloc(1, sizeof(COUNT0_STR)); + strlcpy(info.vec[0], + COUNT0_STR, + sizeof(COUNT0_STR)); + i = 1; + info.nb_vec_lines = 1; + } + } + + /* don't copy NumKey-line */ + if (strstr(info.one_line_text, NK_STR)) + break; + info.vec[i] = calloc(1, size + 5); if (info.vec[i] == NULL) goto error_exit; From patchwork Mon Aug 26 09:41:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57893 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 85F5E1BFEC; Mon, 26 Aug 2019 11:24:14 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 338211BF9F for ; Mon, 26 Aug 2019 11:24:09 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7Q9KQWX021246; Mon, 26 Aug 2019 02:24:08 -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=C8kSelEpIm5yAVMteYqo5ws7gV00ZqplmdP1rvGOV1s=; b=ex0VPMol6z5hO7n0fLGvqL3w+gcjHBMdZvy9ISjubMoitKMmd/0Iyt2hD/Lc7R+Q7vs7 1OcwLUu8TOceIPdEKt2oiiaY1SJ4ivzlqh3ByXz1HeZs4RtWjI608DjGsg2sLp+QmTa7 trFsTucF7P+2gZ7WrZSgApX7GCzhdmH4mnGj9oiYCyKJlsCQml8JCcNaJZokt7+9JP90 KBryUy3Ug7vRLUHsJXMpJw/ne1K+1rxMXyEvvcKFmMGkHKnXtmC425D8Bz9QB5LflVL0 4Y8J4pyX9RpBfnznQDgAHw1ARNhps1PPA2XKaEwYn7XWMClSnxCmv5ZDIPZYm0cZXfGl MQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2uk4rke1j7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:24:08 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 02:24:07 -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:07 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id C82D53F703F; Mon, 26 Aug 2019 02:24:05 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:18 +0300 Message-ID: <20190826094120.22590-11-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 10/12] examples/fips: supported IV, PT and CT init for TDES ECB mode 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/main.c | 66 +++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index 1d621f60a..3eda0f554 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1064,6 +1064,7 @@ fips_mct_tdes_test(void) uint8_t prev_in[TDES_BLOCK_SIZE] = {0}; uint32_t i, j, k; int ret; + int test_mode = info.interim_info.tdes_data.test_mode; for (i = 0; i < TDES_EXTERN_ITER; i++) { if (i != 0) @@ -1090,25 +1091,50 @@ fips_mct_tdes_test(void) memcpy(prev_out, val.val, TDES_BLOCK_SIZE); if (info.op == FIPS_TEST_ENC_AUTH_GEN) { - memcpy(vec.pt.val, vec.iv.val, - TDES_BLOCK_SIZE); - memcpy(vec.iv.val, val.val, - TDES_BLOCK_SIZE); + if (test_mode == TDES_MODE_ECB) { + memcpy(vec.pt.val, val.val, + TDES_BLOCK_SIZE); + } else { + memcpy(vec.pt.val, vec.iv.val, + TDES_BLOCK_SIZE); + memcpy(vec.iv.val, val.val, + TDES_BLOCK_SIZE); + } + } else { - memcpy(vec.iv.val, vec.ct.val, - TDES_BLOCK_SIZE); - memcpy(vec.ct.val, val.val, - TDES_BLOCK_SIZE); + if (test_mode == TDES_MODE_ECB) { + memcpy(vec.ct.val, val.val, + TDES_BLOCK_SIZE); + } else { + memcpy(vec.iv.val, vec.ct.val, + TDES_BLOCK_SIZE); + memcpy(vec.ct.val, val.val, + TDES_BLOCK_SIZE); + } } continue; } if (info.op == FIPS_TEST_ENC_AUTH_GEN) { - memcpy(vec.iv.val, val.val, TDES_BLOCK_SIZE); - memcpy(vec.pt.val, prev_out, TDES_BLOCK_SIZE); + if (test_mode == TDES_MODE_ECB) { + memcpy(vec.pt.val, val.val, + TDES_BLOCK_SIZE); + } else { + memcpy(vec.iv.val, val.val, + TDES_BLOCK_SIZE); + memcpy(vec.pt.val, prev_out, + TDES_BLOCK_SIZE); + } } else { - memcpy(vec.iv.val, vec.ct.val, TDES_BLOCK_SIZE); - memcpy(vec.ct.val, val.val, TDES_BLOCK_SIZE); + if (test_mode == TDES_MODE_ECB) { + memcpy(vec.ct.val, val.val, + TDES_BLOCK_SIZE); + } else { + memcpy(vec.iv.val, vec.ct.val, + TDES_BLOCK_SIZE); + memcpy(vec.ct.val, val.val, + TDES_BLOCK_SIZE); + } } if (j == TDES_INTERN_ITER - 1) @@ -1167,11 +1193,19 @@ fips_mct_tdes_test(void) val_key.val[k] : (val_key.val[k] ^ 0x1); if (info.op == FIPS_TEST_ENC_AUTH_GEN) { - memcpy(vec.iv.val, val.val, TDES_BLOCK_SIZE); - memcpy(vec.pt.val, prev_out, TDES_BLOCK_SIZE); + if (test_mode == TDES_MODE_ECB) { + memcpy(vec.pt.val, val.val, TDES_BLOCK_SIZE); + } else { + memcpy(vec.iv.val, val.val, TDES_BLOCK_SIZE); + memcpy(vec.pt.val, prev_out, TDES_BLOCK_SIZE); + } } else { - memcpy(vec.iv.val, prev_out, TDES_BLOCK_SIZE); - memcpy(vec.ct.val, val.val, TDES_BLOCK_SIZE); + if (test_mode == TDES_MODE_ECB) { + memcpy(vec.ct.val, val.val, TDES_BLOCK_SIZE); + } else { + memcpy(vec.iv.val, prev_out, TDES_BLOCK_SIZE); + memcpy(vec.ct.val, val.val, TDES_BLOCK_SIZE); + } } } From patchwork Mon Aug 26 09:41:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57894 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 BCB221BFF0; Mon, 26 Aug 2019 11:24:16 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 651621BFE0 for ; Mon, 26 Aug 2019 11:24:10 +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 x7Q9K5SA029843; Mon, 26 Aug 2019 02:24:09 -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=mkFNWEue75TLuivIAufSvzsGNyO5nGH8kJqmmN7d1LU=; b=l4evIMvzgupEt8vmUoz5YKTYNrV03ebRu0azp/xNpfRORLJBWeQZrtT+KM25goJ6ZHVS UJVGmK33mmO7jCsHIqMcIioWh6fsSyR2t7Mn8rUy9D1+QKNNMpzzfkc7uihZlUMkaaE5 0RoUPXsjGL/itD0PnaysmEwrF/p1ooNgyHWitjr2DZ+VMTdl/AVPm1g4Us16twGHCDDc 5ri1G3gacvRLnoi/BvZWD6y6doL1zEJdctF74aGuVyrRVFOB0gw3NL9/lyiaVFedJQhs eAm2Q2vktefQzpOzp5jcppfQwm+XovoTdeOhOeMuUx9K4GGU25zrXQfeW1f7Jq4nDAtD Og== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2uk2kpxf3m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:24:09 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 02:24:08 -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; Mon, 26 Aug 2019 02:24:08 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 66B1C3F7040; Mon, 26 Aug 2019 02:24:07 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:19 +0300 Message-ID: <20190826094120.22590-12-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 11/12] examples/fips: algorithm definition by folder if it's not in file 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 In order to find algorithm used the folder name if it is not defined within the file. Signed-off-by: Michael Shamis --- examples/fips_validation/fips_validation.c | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index ba513672e..fcc0c985d 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -248,6 +248,48 @@ fips_test_parse_header(void) fprintf(info.fp_wr, "%s\n", info.vec[i]); } + /* use folder name if algorithm is not found yet*/ + if (info.algo == FIPS_TEST_ALGO_MAX) { + if (strstr(info.file_name, "AESVS")) { + info.algo = FIPS_TEST_ALGO_AES; + ret = parse_test_aes_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "GCM")) { + info.algo = FIPS_TEST_ALGO_AES_GCM; + ret = parse_test_gcm_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "CMAC")) { + info.algo = FIPS_TEST_ALGO_AES_CMAC; + ret = parse_test_cmac_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "CCM")) { + info.algo = FIPS_TEST_ALGO_AES_CCM; + ret = parse_test_ccm_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "HMAC")) { + info.algo = FIPS_TEST_ALGO_HMAC; + ret = parse_test_hmac_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "TDES")) { + info.algo = FIPS_TEST_ALGO_TDES; + ret = parse_test_tdes_init(); + if (ret < 0) + return ret; + } else if (strstr(info.file_name, "SHA-")) { + if (info.algo != FIPS_TEST_ALGO_HMAC) { + info.algo = FIPS_TEST_ALGO_SHA; + ret = parse_test_sha_init(); + if (ret < 0) + return ret; + } + } + } + return 0; } From patchwork Mon Aug 26 09:41:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 57895 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 CA3381BFFE; Mon, 26 Aug 2019 11:24:18 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 4B19C1BFC6 for ; Mon, 26 Aug 2019 11:24:13 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x7Q9JYsM020142; Mon, 26 Aug 2019 02:24:12 -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=evswwtg7DacRVgg3KI4kvRz9n6M7gamD2I9ujWtf8gM=; b=WzEtZgzRVRBJ0RFnMGve86++eUIhQq41BOu4rFFyIT2fP8FYcgtS+C64H8yQrBzDtKto 6WhiRu5ob2fz9iIH8oQ2eGMLLrGB8FF9eLTDxWbEBuzZhTssJmtmILrTCDDYIE3R4Pwx CSjzkv1ipPDVpBnP6CitIq8DVXAUenFX9LYAmI0GOqUhShakm4BROF2AJUPGb2/Lt9pO ZyF0qyMTCJcN3GpV+ixdVr4qa538BYtv8QUN77rHmx9QftVwkAuPENkcmHvB5l2oi9LI knf4kytkucS4q1C8KlcvSdSiuBzStYN/Q3uAEM1Zfr/q5/X1CzJzgtvSmvScfDNoqyDN EQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2uk4rke1jm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2019 02:24:12 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 26 Aug 2019 02:24:11 -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:10 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 01D3B3F7041; Mon, 26 Aug 2019 02:24:08 -0700 (PDT) From: To: CC: , , Date: Mon, 26 Aug 2019 12:41:20 +0300 Message-ID: <20190826094120.22590-13-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 12/12] examples/fips: erroneous overwrite of PLAINTEXT after DECRYPT 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 fix erroneous overwrite of PLAINTEXT-line after [DECRYPT] tag Signed-off-by: Michael Shamis --- examples/fips_validation/fips_validation.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index fcc0c985d..4d0f240b8 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -401,10 +401,13 @@ fips_test_parse_one_case(void) } if (is_interim) { - for (i = 0; i < info.nb_vec_lines; i++) - fprintf(info.fp_wr, "%s\n", info.vec[i]); - fprintf(info.fp_wr, "\n"); - return 1; + if (!(strstr(info.vec[0], "DECRYPT") && + info.nb_vec_lines > 1)) { + for (i = 0; i < info.nb_vec_lines; i++) + fprintf(info.fp_wr, "%s\n", info.vec[i]); + fprintf(info.fp_wr, "\n"); + return 1; + } } for (i = 0; i < info.nb_vec_lines; i++) {