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;