From patchwork Thu Sep 19 12:12:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 59447 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 1CC291EF67; Thu, 19 Sep 2019 13:54:10 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id DC6111EF56; Thu, 19 Sep 2019 13:54:06 +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 x8JBpUPS003353; Thu, 19 Sep 2019 04:54: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=ycUluWlwKS24CGptV4H8quED7fhIh7qPsTlpJjv59Ko=; b=YXo8TP/V+bS71o5cpkzDl/JOOccspRJZpC6N0G5IhiQFWKVPQDoChfzXt+eib0CsQ+oR klDWrpf+z/xqueQnIsUuz5Biz6pDAtBmHANZ17C3FbLRMYMh2VjD00e3dB69e6nKOT7W g7yTZdmUGrx4zj6jhEwqxoiLvv6EZgVykJ3nPgY+HnTfughQlDAaT2R5Z2GLKixY5RPo c6AYHMAee6tcQf+AwLXc4nAdOdGlf22/U6Lxnp0Ar/aOiUZwM8A9SbMLu06TgzIf9Cx3 qAX3q2bscQgQYwQmYki8Sk7ZryxMM/Pt4NpBDDRKwz2w6cYPrrpPOdWyppCDgOFqFKk5 Aw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2v3vcdtr3s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 19 Sep 2019 04:54:05 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 19 Sep 2019 04:54:04 -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; Thu, 19 Sep 2019 04:54:04 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id A58683F7043; Thu, 19 Sep 2019 04:54:02 -0700 (PDT) From: To: CC: , , , , Date: Thu, 19 Sep 2019 15:12:25 +0300 Message-ID: <20190919121232.4864-2-michaelsh@marvell.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919121232.4864-1-michaelsh@marvell.com> References: <20190919121232.4864-1-michaelsh@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-19_04:2019-09-18,2019-09-19 signatures=0 Subject: [dpdk-dev] [PATCH 1/8] examples/fips_validation: separation between HMAC-SHA and SHA 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: SHA initialization will not be called in case of HAMC-SHA 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 Thu Sep 19 12:12:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 59448 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 D5DB91EF78; Thu, 19 Sep 2019 13:54:12 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 4D6381EF5B; Thu, 19 Sep 2019 13:54:09 +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 x8JBogAn002704; Thu, 19 Sep 2019 04:54: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=73avQY0gAeC+wk3ZsDg+zFtqM20iEuha3R51ImdEUUY=; b=wyqhdbdx0jdeoEL1IkK9DdYM84y0yGrreiLkGxxlsbepenwIqZx5FCNS+4f4VNaA5dsb RIPee3eSiYqVdabmZBPt8QlGz5LjCKWZ5WEt1kkyAUPqy7CG5jv2sPshV76GJKrGkiyz K91T/OMhZjAHmXy94062xZFDS7MYysijvszpa8iAlyapZem0b8ne/FyfFBkvhlPQWF/w qc9LZCohmORrASt99vxeM9FGwDcfTqD4WIonz5/lwGrwGUrjnepg/m8H/V/ifQxwtDAw ukNJicLWdAgM2KyprITk/BsfyXABI+8WL6yxAPmN/f+QUmk2JdHDm3RfK/J78uNJkhyl xA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2v3vcdtr3w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 19 Sep 2019 04:54:08 -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; Thu, 19 Sep 2019 04:54:06 -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; Thu, 19 Sep 2019 04:54:06 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id DD34C3F703F; Thu, 19 Sep 2019 04:54:04 -0700 (PDT) From: To: CC: , , , , Date: Thu, 19 Sep 2019 15:12:26 +0300 Message-ID: <20190919121232.4864-3-michaelsh@marvell.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919121232.4864-1-michaelsh@marvell.com> References: <20190919121232.4864-1-michaelsh@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-19_04:2019-09-18,2019-09-19 signatures=0 Subject: [dpdk-dev] [PATCH 2/8] examples/fips_validation: fix structs used for AES-GCM 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_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 Thu Sep 19 12:12:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 59449 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 58E341EF85; Thu, 19 Sep 2019 13:54:16 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 6CDC41EF6E; Thu, 19 Sep 2019 13:54:11 +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 x8JBokdk028485; Thu, 19 Sep 2019 04:54:10 -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=1K9tYhooGyBnDbitsliKXiuJuCsvOcwDGRhI9OjIezc=; b=IhwnFR69DBdDcZjeTIF0bPigIuObKigbVQ3+8H6lSfwJ7+aReoH0zk1+Cyo+Ltk4N4A1 +AiArpnUm9uQ0PwvLH8GH0dOnewAJ7+Hbs/daphW9FCR/RFLD6h74Dph4f02e+O5Dtm5 CD5mL1kJw1Z5PIY88+fpqZP6wmGAdq0LQrT60V0gn9R7ojwSm3a+1vYLGsOdflJnyVPQ +XCUfXnFdQc4TwiJdjByzQEU0sAxg8fuCWpb0mcC+6HaF46nKTlIItMkOR32tJWDWanY svkif0mxiCjwlwITwmqYMcniiKoKo4VstZQlZW6iC/fC9+EE4q4LZ9WZaNDVvMcBsD53 /w== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2v3vcfjn4k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 19 Sep 2019 04:54:10 -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; Thu, 19 Sep 2019 04:54:08 -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; Thu, 19 Sep 2019 04:54:08 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 1F0703F7040; Thu, 19 Sep 2019 04:54:06 -0700 (PDT) From: To: CC: , , , , Date: Thu, 19 Sep 2019 15:12:27 +0300 Message-ID: <20190919121232.4864-4-michaelsh@marvell.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919121232.4864-1-michaelsh@marvell.com> References: <20190919121232.4864-1-michaelsh@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-19_04:2019-09-19,2019-09-19 signatures=0 Subject: [dpdk-dev] [PATCH 3/8] examples/fips_validation: initialize IV for AES-GCM 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 813534068..193f36ed7 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 Thu Sep 19 12:12:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 59450 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 8F3F01EF89; Thu, 19 Sep 2019 13:54:19 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 4F8E11EF7B; Thu, 19 Sep 2019 13:54: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 x8JBpKaL003306; Thu, 19 Sep 2019 04:54: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=z5t0v50La6Dr1TQn3WTAUncK942FiAb8tZs0uB3eFAQ=; b=WPtlEiRWog9pPG4YmOmevYzQcigkRCvSYbKJmnSIr7WeClxtXsQcs2gLccYUlV8ntE2n GACoq0KuYh+HS/YqEmVKvsEVhm2OlesX+xFjpRNybtq/yHuKvwbN2/Ay8gcuMESN5gFe jHWlYIWVdHU8XYjLl5tx0qhMCWj4vfPPTja6NxQjaCzRriSZVNEteIe9d2vLWFAbyrWy zyt9SQoColvnn1bKsgMHjxjlQZ9V26ROmRQYZPg2tLpu5EL+9KOlV4O6Xq2DoA8c5PMi 6mdUkPKk657T6hHAuiNyXm8ZHTQpbxUWnrSEcZHPJD+VRicJeFAcaDPkAsyozM6XliDp Qw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2v3vcdtr46-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 19 Sep 2019 04:54:12 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 19 Sep 2019 04:54: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; Thu, 19 Sep 2019 04:54:11 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 563373F703F; Thu, 19 Sep 2019 04:54:09 -0700 (PDT) From: To: CC: , , , , Date: Thu, 19 Sep 2019 15:12:28 +0300 Message-ID: <20190919121232.4864-5-michaelsh@marvell.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919121232.4864-1-michaelsh@marvell.com> References: <20190919121232.4864-1-michaelsh@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-19_04:2019-09-18,2019-09-19 signatures=0 Subject: [dpdk-dev] [PATCH 4/8] examples/fips_validation: move digest after cipher 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 driver 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 193f36ed7..6313ebf66 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 Thu Sep 19 12:12:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 59451 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 473F91EF91; Thu, 19 Sep 2019 13:54:24 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 4171F1EF82; Thu, 19 Sep 2019 13:54: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 x8JBohWk028434; Thu, 19 Sep 2019 04:54:14 -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=WcovZjOsxTRKekwJkzxSp6n+r0RfXitJbk0YA+tMG4hIQGwO7nqLfRfR9qrzNvBioi6G soc/z8+UBdXOxYUivUR2M1ICmhvTBe9h4AQt3XwMpuC2/R9S5KlQC/KMHmXLowwldkuD m1R0F75fZs1ArPvr1EI1FNys0+f7dnhmkG2R4K+CxEYpfJYnSa7F3rAI7QekH81PyVWW JZX+CbJFx0yf+CUoywOa5xE3VP+daFHMtMueDzEliVue3apxXSopVWbkIDIJxed728rr E96sxAAmF2kdEqE6xhjOHYJe4iz+wxQEafP4B5GO8tH3Fga9adoQGfGxK/RuTYJUKPmC vA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2v3vcfjn4w-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 19 Sep 2019 04:54:14 -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; Thu, 19 Sep 2019 04:54:13 -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; Thu, 19 Sep 2019 04:54:13 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 8E1153F7041; Thu, 19 Sep 2019 04:54:11 -0700 (PDT) From: To: CC: , , , , Date: Thu, 19 Sep 2019 15:12:29 +0300 Message-ID: <20190919121232.4864-6-michaelsh@marvell.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919121232.4864-1-michaelsh@marvell.com> References: <20190919121232.4864-1-michaelsh@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-19_04:2019-09-19,2019-09-19 signatures=0 Subject: [dpdk-dev] [PATCH 5/8] examples/fips_validation: fix AES-GCM decryption vector 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 Thu Sep 19 12:12:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 59452 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 727E51EF9A; Thu, 19 Sep 2019 13:54:27 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 266AF1EF5F; Thu, 19 Sep 2019 13:54:18 +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 x8JBohmP028440; Thu, 19 Sep 2019 04:54:17 -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=75MXO6014ZprzrBoYSTGffwYOE+Pdcf7PmJm6PgPoSI=; b=NICFHPq60A0JCxpThmrpGW6nn6GbAvpX6kjKnZdSef/RAqJ+lp36jyayiNQvv+plZC7n SQwpSHJnt7hLn5QeXwDkqy4k07kET031/7b5D6+3tZFjC2EbThX41EbO1lD3Yfka22Ho rPvAGuqwc7wYsuIrOt/pPAERjX4rQ/Onwzb5R/02v6cvGSsVs7QRZlQESVNJkXbpSb65 4Y0ju6bgdHpb+0xJ3Jt5Xd18+7qtQYopMUNaJyGk7IGkUjc0/7wKoTFBdg9G7+6T6ERy SnL1KKfXm4zyTuiTht32yPfgUCVkfhjnOfwEyJ7eH+kn4ewf2gdAUYxbLR6BPBvcBNY9 0g== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2v3vcfjn55-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 19 Sep 2019 04:54:17 -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; Thu, 19 Sep 2019 04:54:15 -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; Thu, 19 Sep 2019 04:54:15 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id F365B3F7040; Thu, 19 Sep 2019 04:54:13 -0700 (PDT) From: To: CC: , , , , Date: Thu, 19 Sep 2019 15:12:30 +0300 Message-ID: <20190919121232.4864-7-michaelsh@marvell.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919121232.4864-1-michaelsh@marvell.com> References: <20190919121232.4864-1-michaelsh@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-19_04:2019-09-19,2019-09-19 signatures=0 Subject: [dpdk-dev] [PATCH 6/8] examples/fips_validation: fix overwrite of KEY line in TDES 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 for TCBCMonte2, TCBCMonte3 and TECBMonte2: application overwrites key1 line in output file so comparision with sample files failed 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 80fd482a1..9aa423b0f 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 Thu Sep 19 12:12:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 59453 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 73F7A1EFAE; Thu, 19 Sep 2019 13:54:30 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id D35F01EF5D; Thu, 19 Sep 2019 13:54:20 +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 x8JBokJN028488; Thu, 19 Sep 2019 04:54:20 -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=4XcpB1Xvk2cY+XMG0xV/0v0CRY/0LenZ64mB4LolnWI=; b=CGngaNQ+44zre/ZZYT7HSGW0EQ+2EZ4gGIEeFx+b4vZD+LqSPAXnMJ67ePU3Tta2GfsT ovdHx0eq/hEPNiVgeeoAWhbu80Mkii6zBH+I41vRWy65NJcemHfB3wVOiMwtOrEwHfX0 fDvPZowB0Ft+vU9+yko9y49Fe7cNSjzm+gj+cE6DzU2t8tNe0GTwnHC0oL0RwOnfvmQK 6uighOxR5RM32NR39tlCqknUcho/pe2PAfMkVcuwnoopNE5lWwOtdSYAXggDVYJCS31T UrASrxWsjK1QBq78rDo9MY2KlzJmoKYNBxipfWF+4opZuHr276HbM/hV6m9Lr7mQAzuO 3w== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2v3vcfjn59-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 19 Sep 2019 04:54:20 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 19 Sep 2019 04:54:18 -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; Thu, 19 Sep 2019 04:54:18 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id 3732C3F703F; Thu, 19 Sep 2019 04:54:16 -0700 (PDT) From: To: CC: , , , , Date: Thu, 19 Sep 2019 15:12:31 +0300 Message-ID: <20190919121232.4864-8-michaelsh@marvell.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919121232.4864-1-michaelsh@marvell.com> References: <20190919121232.4864-1-michaelsh@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-19_04:2019-09-19,2019-09-19 signatures=0 Subject: [dpdk-dev] [PATCH 7/8] examples/fips_validation: improve algo parsing logic 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 The fix allows to find algorithm by folder name if the algorithm was not found from the test file header. 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 9aa423b0f..4dde482e5 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 Thu Sep 19 12:12:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Shamis X-Patchwork-Id: 59454 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 964831EFBF; Thu, 19 Sep 2019 13:54:33 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 40B411EF77; Thu, 19 Sep 2019 13:54:23 +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 x8JBohWn028434; Thu, 19 Sep 2019 04:54:22 -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=3+RauN2gJaPKi11TgOH5fMKg5Q8d70oICM1gRjGSgNI=; b=l2xQeg9xVIZjMvvKOJ46hvW6X2b5TXvlRoxK1DTIXrUAorWY3sR5p8EOK844o6PLF0WN C/3vIUf/nw+IUNLZIBlEgaedA3qScdF2ZyEgKIJG451u2895w6/JIn8PVRChG72yXcjd 65ZSSOx8UOf5K0aZeeqfYYK4XiZTB+V9r6AnJ6TV350vFO5+ddtghYwZLv2n7RIYjjHp CZWigPL1O+c9jZIWeC1nijIBCHPEM5l3+lSsnWeWjae7qRLpc+ZgqREWcGUPs46AjMJb /QC8FQhXAEJpM3jhdk3zJUPQbZIPHU4m5pYLQqgqD+a9kRzeW7pCejJLgpsT+Hz6kzkG GQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2v3vcfjn5e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 19 Sep 2019 04:54:22 -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; Thu, 19 Sep 2019 04:54:20 -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; Thu, 19 Sep 2019 04:54:20 -0700 Received: from vvenus375.il.marvell.com (unknown [10.5.120.75]) by maili.marvell.com (Postfix) with ESMTP id A4CD73F7041; Thu, 19 Sep 2019 04:54:18 -0700 (PDT) From: To: CC: , , , , Date: Thu, 19 Sep 2019 15:12:32 +0300 Message-ID: <20190919121232.4864-9-michaelsh@marvell.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919121232.4864-1-michaelsh@marvell.com> References: <20190919121232.4864-1-michaelsh@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-19_04:2019-09-19,2019-09-19 signatures=0 Subject: [dpdk-dev] [PATCH 8/8] examples/fips_validation: fix plain text overwrite 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 4dde482e5..3ab7f8508 100644 --- a/examples/fips_validation/fips_validation.c +++ b/examples/fips_validation/fips_validation.c @@ -400,10 +400,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++) {