From patchwork Thu Jun 11 13:44:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Archana Muniganti X-Patchwork-Id: 71274 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 80077A00C5; Thu, 11 Jun 2020 15:45:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 81677E07; Thu, 11 Jun 2020 15:45:07 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 57AD4DE0; Thu, 11 Jun 2020 15:45:05 +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 05BDZmsV003630; Thu, 11 Jun 2020 06:45:04 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=oAtxHRDDDfO6XUgAhACnhbv2SezuWMCUNaRIdFV4NPQ=; b=SDDDqNbPyfkQFME9J+CdoMe1X+tWn22ubxsqLPJ+eeftTRf2TcWeBfYJHTiwjNvn1F92 +iiK8jAkuIBFg0Ive+OkIto87VFXcTjCpf0X9hAQuL4Ma9mnkqv0Py4A2y+T+FtMqo6b 3h+SoBpTmpghH7EkhtLCb95kUpamkRiGZvIb/eLfDUhe6RQtgOGEeDKD6D3yXN0FfgNN BeABI7kluZvzW+e5ggJkVgPbIBNZeKnDn8pxPEs3kDA4V08jcRCOUCJCfglNzGVMSIiz D3oFcRQdMMXm1dWSinge5Z2kGjS6374+UfaKb/b/6ldbsszynYrJKmoZGp52iMA89Ssp Gg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 31gannjp08-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 11 Jun 2020 06:45:04 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 11 Jun 2020 06:45:04 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 11 Jun 2020 06:45:04 -0700 Received: from hyd1409.caveonetworks.com.com (unknown [10.29.45.15]) by maili.marvell.com (Postfix) with ESMTP id C267C3F7040; Thu, 11 Jun 2020 06:45:00 -0700 (PDT) From: Archana Muniganti To: , , CC: Archana Muniganti , , , , , , Date: Thu, 11 Jun 2020 19:14:15 +0530 Message-ID: <1591883057-11008-1-git-send-email-marchana@marvell.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-11_14:2020-06-11, 2020-06-11 signatures=0 Subject: [dpdk-dev] [PATCH 1/3] examples/fips_validation: fix TDES interim callback 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" Fix missing callback registration and the incorrect callback definition for interim NK_STR. The callback should compare input key against the interim. Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing") Signed-off-by: Archana Muniganti --- examples/fips_validation/fips_validation_tdes.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/examples/fips_validation/fips_validation_tdes.c b/examples/fips_validation/fips_validation_tdes.c index 84dd288..a1ddd57 100644 --- a/examples/fips_validation/fips_validation_tdes.c +++ b/examples/fips_validation/fips_validation_tdes.c @@ -59,9 +59,7 @@ struct { parse_tdes_uint8_hex_str(const char *key, char *src, struct fips_val *val); static int -parse_tdes_interim(const char *key, - __rte_unused char *text, - struct fips_val *val); +parse_tdes_interim(const char *key, char *text, struct fips_val *val); struct fips_test_callback tdes_tests_vectors[] = { {KEYS_STR, parse_tdes_uint8_hex_str, &vec.cipher_auth.key}, @@ -77,6 +75,7 @@ struct fips_test_callback tdes_tests_vectors[] = { struct fips_test_callback tdes_tests_interim_vectors[] = { {ENC_STR, parse_tdes_interim, NULL}, {DEC_STR, parse_tdes_interim, NULL}, + {NK_STR, parse_tdes_interim, NULL}, {NULL, NULL, NULL} /**< end pointer */ }; @@ -94,21 +93,23 @@ struct fips_test_callback tdes_writeback_callbacks[] = { }; static int -parse_tdes_interim(const char *key, - __rte_unused char *text, +parse_tdes_interim(const char *key, char *text, __rte_unused struct fips_val *val) { if (strstr(key, ENC_STR)) info.op = FIPS_TEST_ENC_AUTH_GEN; else if (strstr(key, DEC_STR)) info.op = FIPS_TEST_DEC_AUTH_VERIF; - else if (strstr(NK_STR, "NumKeys = 1")) - info.interim_info.tdes_data.nb_keys = 1; - else if (strstr(NK_STR, "NumKeys = 2")) - info.interim_info.tdes_data.nb_keys = 2; - else if (strstr(NK_STR, "NumKeys = 3")) - info.interim_info.tdes_data.nb_keys = 3; - else + else if (strstr(key, NK_STR)) { + if (strcmp(text, "NumKeys = 1") == 0) + info.interim_info.tdes_data.nb_keys = 1; + else if (strcmp(text, "NumKeys = 2") == 0) + info.interim_info.tdes_data.nb_keys = 2; + else if (strcmp(text, "NumKeys = 3") == 0) + info.interim_info.tdes_data.nb_keys = 3; + else + return -EINVAL; + } else return -EINVAL; return 0; From patchwork Thu Jun 11 13:44:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Archana Muniganti X-Patchwork-Id: 71275 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0F61AA00C5; Thu, 11 Jun 2020 15:45:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EAA29100C; Thu, 11 Jun 2020 15:45:16 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id C342ADE0; Thu, 11 Jun 2020 15:45:15 +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 05BDa2gH004433; Thu, 11 Jun 2020 06:45:15 -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-type; s=pfpt0818; bh=GvOPEMe6PchzseKnisfAFbtvilUNYjpu703BHsaOYuI=; b=BN2bPCA2avwwKP5fcZSqL4MVJIEEf1NItwpoItPa1EsbWJiMF6LvL/VJhyGxdaAFOeGP K+L7M9VCH5FG2GJwiAxgJfJ72uKpTjcYSkGc6/nU2Aymf6a/bsvYq3nsUwG4SveDVbOF XinLAHHlQNFwu41diEUjMTgV0k1Jf5xo+UN5MNBsAFrz9bST8e3dIj89pl3g7TqhxYvL a0v8+XOoOZlgfo7tTi772MWUeurRRrnjrQ2Nt1Bx3/grp9Pgi7TynVhTrVlCiA/hwVAT U8qM3LyacjPVHRJ4ILKqRz28FXjmHu5xGtW6ML4EQp21k2wk7t1eJLIqLFuPSn3ijRsE aA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 31gannjp17-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 11 Jun 2020 06:45:15 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 11 Jun 2020 06:45:12 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 11 Jun 2020 06:45:13 -0700 Received: from hyd1409.caveonetworks.com.com (unknown [10.29.45.15]) by maili.marvell.com (Postfix) with ESMTP id 3212A3F703F; Thu, 11 Jun 2020 06:45:09 -0700 (PDT) From: Archana Muniganti To: , , CC: Ayuj Verma , , , , , , Archana Muniganti Date: Thu, 11 Jun 2020 19:14:16 +0530 Message-ID: <1591883057-11008-2-git-send-email-marchana@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1591883057-11008-1-git-send-email-marchana@marvell.com> References: <1591883057-11008-1-git-send-email-marchana@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-11_14:2020-06-11, 2020-06-11 signatures=0 Subject: [dpdk-dev] [PATCH 2/3] examples/fips_validation: fix parsing of TDES vectors 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: Ayuj Verma Processing of test vector for COUNT = 0 is getting skipped, as some of the NIST TDES files doesn't have an empty line after [ENCRYPT]/[DECRYPT] and thus treated as an interim block. Parse function now identifies such blocks, separates out interim and test vector data, and then parses each with their respective callbacks. Fixes: 3d0fad56b74a ("examples/fips_validation: add crypto FIPS application") Signed-off-by: Archana Muniganti Signed-off-by: Ayuj Verma --- examples/fips_validation/fips_validation.c | 21 +++++++++++++++------ examples/fips_validation/fips_validation.h | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index a34e34d..3aaec20 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -340,11 +340,13 @@ fips_test_parse_one_case(void) { uint32_t i, j = 0; - uint32_t is_interim = 0; + uint32_t is_interim; + uint32_t interim_cnt = 0; int ret; if (info.interim_callbacks) { for (i = 0; i < info.nb_vec_lines; i++) { + is_interim = 0; for (j = 0; info.interim_callbacks[j].key != NULL; j++) if (strstr(info.vec[i], info.interim_callbacks[j].key)) { @@ -357,17 +359,24 @@ if (ret < 0) return ret; } + + if (is_interim) + interim_cnt += 1; } } - if (is_interim) { - for (i = 0; i < info.nb_vec_lines; i++) + info.vec_start_off = interim_cnt; + + if (interim_cnt) { + for (i = 0; i < interim_cnt; i++) fprintf(info.fp_wr, "%s\n", info.vec[i]); fprintf(info.fp_wr, "\n"); - return 1; + + if (info.nb_vec_lines == interim_cnt) + return 1; } - for (i = 0; i < info.nb_vec_lines; i++) { + for (i = info.vec_start_off; i < info.nb_vec_lines; i++) { for (j = 0; info.callbacks[j].key != NULL; j++) if (strstr(info.vec[i], info.callbacks[j].key)) { ret = info.callbacks[j].cb( @@ -387,7 +396,7 @@ { uint32_t i; - for (i = 0; i < info.nb_vec_lines; i++) + for (i = info.vec_start_off; i < info.nb_vec_lines; i++) fprintf(info.fp_wr, "%s\n", info.vec[i]); } diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h index 5aee955..75fa555 100644 --- a/examples/fips_validation/fips_validation.h +++ b/examples/fips_validation/fips_validation.h @@ -161,6 +161,7 @@ struct fips_test_interim_info { enum fips_test_algorithms algo; char *one_line_text; char *vec[MAX_LINE_PER_VECTOR]; + uint32_t vec_start_off; uint32_t nb_vec_lines; char device_name[MAX_STRING_SIZE]; char file_name[MAX_STRING_SIZE]; From patchwork Thu Jun 11 13:44:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Archana Muniganti X-Patchwork-Id: 71276 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9A7E7A00C5; Thu, 11 Jun 2020 15:45:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 422ED1D9E; Thu, 11 Jun 2020 15:45:22 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id B7FDBA3; Thu, 11 Jun 2020 15:45:20 +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 05BDjJfs014545; Thu, 11 Jun 2020 06:45:19 -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-type; s=pfpt0818; bh=SaNp0Yqvu21Fat8gRIhBY8cUk/6YHBs7NnwcfPAdJxI=; b=R+FYkuv5qCsGKpXtWNaZx1A4mzv811oDTrmS1I5/NF/fd6X2Mh6d6dJARPvz8bFmQfYz 0ghC+rDzwJUKrtl0YhmWfCMiXqf45bjq2ZFbRCiughW5AbTnssZCmGja/orbjUfNQ9ke Ancn3eFy3GZY2N7Ru4l0QkSMWI1/gDUyJpSOGBgdtQbHGoF+pI4C0ui6ysFt+KAEFGe3 YCoSmMvv1djPyVs2Xi0wSOOsurryLS37sLTMRxDlUXsSQ5egbmT7rnK1X5yf9ih1qIWe SvFLHzN6qHqfDn3PVTghTSoyy9ld3Knu9wivdHGqRYTDbOsuKtHe+NfBke9NC6nB5+gH Lg== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 31j77dsxd8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 11 Jun 2020 06:45:19 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 11 Jun 2020 06:45:18 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 11 Jun 2020 06:45:19 -0700 Received: from hyd1409.caveonetworks.com.com (unknown [10.29.45.15]) by maili.marvell.com (Postfix) with ESMTP id BF86D3F7040; Thu, 11 Jun 2020 06:45:15 -0700 (PDT) From: Archana Muniganti To: , , CC: Archana Muniganti , , , , , , Date: Thu, 11 Jun 2020 19:14:17 +0530 Message-ID: <1591883057-11008-3-git-send-email-marchana@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1591883057-11008-1-git-send-email-marchana@marvell.com> References: <1591883057-11008-1-git-send-email-marchana@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-11_14:2020-06-11, 2020-06-11 signatures=0 Subject: [dpdk-dev] [PATCH 3/3] examples/fips_validation: fix overwrite of COUNT for TDES vectors 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" Application updates first line of each test vector with COUNT = i(where i = 1,2,3..) assuming first line contains COUNT string. But few of the TDES input test vectors don't contain COUNT string and thus COUNT is getting overwritten on other data. Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing") Signed-off-by: Archana Muniganti Signed-off-by: Kanaka Durga Kotamarthy --- examples/fips_validation/fips_validation.c | 8 ++++++++ examples/fips_validation/main.c | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c index 3aaec20..9bdf257 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -640,6 +640,14 @@ cb = &info.writeback_callbacks[0]; + if (!(strstr(info.vec[0], cb->key))) { + fprintf(info.fp_wr, "%s%u\n", cb->key, count); + i = 0; + } else { + snprintf(info.vec[0], strlen(info.vec[0]) + 4, "%s%u", cb->key, + count); + i = 1; + } snprintf(info.vec[0], strlen(info.vec[0]) + 4, "%s%u", cb->key, count); for (i = 1; i < info.nb_vec_lines; i++) { diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index f9b2056..efd32a8 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1070,7 +1070,10 @@ struct fips_test_ops { int test_mode = info.interim_info.tdes_data.test_mode; for (i = 0; i < TDES_EXTERN_ITER; i++) { - if (i != 0) + if (i == 0) { + if (!(strstr(info.vec[0], "COUNT"))) + fprintf(info.fp_wr, "%s%u\n", "COUNT = ", 0); + } else update_info_vec(i); fips_test_write_one_case();