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 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 Content-Type: text/plain 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]; -- 1.8.3.1