From patchwork Sun Jul 1 07:02:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 140691 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2689423ljj; Sun, 1 Jul 2018 00:03:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIrNSxqBAPrbA70+OmM+yP37owYiklx6b16Et2dPIcVWSrGStIlNEO/L8SI1IzshxHzA3tS X-Received: by 2002:a17:902:8601:: with SMTP id f1-v6mr21259773plo.196.1530428630249; Sun, 01 Jul 2018 00:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530428630; cv=none; d=google.com; s=arc-20160816; b=pBMflNTIoZ8P8CkWgnbBkPnvZQhpnocJ2gztmOb1ufBLSeHUDGMFsbU6wAeh6xZH8W RH+iNck16Y3wfJ//ySG7NsEdBXYxCdxTZQeyyaINSGF7bfhLb66ph1fK5vtFvDJy9pQj 7w+JO/mrFbtGqOdWPUp62lbqVF/77DqE7EQRNtJy5ah+Zd5CE7lgdzwbhtxTUR1JEsbo piAcEl5oqLhFT/DpZZ7kKRpDSmH2wkCj/2LbshC1DpD5gGii17/q6JQC+PSRZi6+fLeT E4TXsZXFxKvQI61UXw5zWRki6dXPX2hg/hSJJt2Csz5ZR3fIu5KUGp3AGIgM9x9Dt0gZ f5sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=3mCkkKilz3I18/23SY7kQZ8PEWIUbvmkGGzxlUN3O58=; b=t8OMwLI2KI2IwVEdewi3Q99oUj/hSnLD6WpQUan50hPf63Dsblm5cGBzDc4JBinBm6 XOU4QCROrnyF4Jvc+J3s7iqzLqRY1YWatR+KNz70SqihDWeU2/MTgJveNL/UoLCRyc4D 9e0G9+RvRY19pp9Ya+zQ+620Q61EtyMnbPlKbBTsJMf9efk/X+XoIJylRflqNcjwZ4HT 7IjV2tv/HVFF6uB13cVZJV806BJnwAdmZCE3FbVUsdwaLHYnwHobdBplgZ3XiJxzsm7J uYMWK7p45UKD7j96panVlkElxN2Vj2CPu7UDiFr9Z3jHCYsGenfzRSwfa6uSy+aOtED0 I2sg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1-v6si13281635plb.8.2018.07.01.00.03.49; Sun, 01 Jul 2018 00:03:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752174AbeGAHDk (ORCPT + 31 others); Sun, 1 Jul 2018 03:03:40 -0400 Received: from foss.arm.com ([217.140.101.70]:47344 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752027AbeGAHDh (ORCPT ); Sun, 1 Jul 2018 03:03:37 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 90C8B18A; Sun, 1 Jul 2018 00:03:36 -0700 (PDT) Received: from sugar.benyossef.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B33FF3F318; Sun, 1 Jul 2018 00:03:34 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , Hadar Gat , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/6] crypto: testmgr: add hash finup tests Date: Sun, 1 Jul 2018 08:02:35 +0100 Message-Id: <1530428560-4440-3-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530428560-4440-1-git-send-email-gilad@benyossef.com> References: <1530428560-4440-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The testmgr hash tests were testing init, digest, update and final methods but not the finup method. Add a test for this one too. While doing this, make sure we only run the partial tests once with the digest tests and skip them with the final and finup tests since they are the same. Signed-off-by: Gilad Ben-Yossef --- crypto/testmgr.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 11e4535..ca475f6 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -259,9 +259,15 @@ static int ahash_partial_update(struct ahash_request **preq, return ret; } +enum hash_test { + HASH_TEST_DIGEST, + HASH_TEST_FINAL, + HASH_TEST_FINUP +}; + static int __test_hash(struct crypto_ahash *tfm, const struct hash_testvec *template, unsigned int tcount, - bool use_digest, const int align_offset) + enum hash_test test_type, const int align_offset) { const char *algo = crypto_tfm_alg_driver_name(crypto_ahash_tfm(tfm)); size_t digest_size = crypto_ahash_digestsize(tfm); @@ -332,14 +338,17 @@ static int __test_hash(struct crypto_ahash *tfm, } ahash_request_set_crypt(req, sg, result, template[i].psize); - if (use_digest) { + switch (test_type) { + case HASH_TEST_DIGEST: ret = crypto_wait_req(crypto_ahash_digest(req), &wait); if (ret) { pr_err("alg: hash: digest failed on test %d " "for %s: ret=%d\n", j, algo, -ret); goto out; } - } else { + break; + + case HASH_TEST_FINAL: memset(result, 1, digest_size); ret = crypto_wait_req(crypto_ahash_init(req), &wait); if (ret) { @@ -371,6 +380,29 @@ static int __test_hash(struct crypto_ahash *tfm, "for %s: ret=%d\n", j, algo, -ret); goto out; } + break; + + case HASH_TEST_FINUP: + memset(result, 1, digest_size); + ret = crypto_wait_req(crypto_ahash_init(req), &wait); + if (ret) { + pr_err("alg: hash: init failed on test %d " + "for %s: ret=%d\n", j, algo, -ret); + goto out; + } + ret = ahash_guard_result(result, 1, digest_size); + if (ret) { + pr_err("alg: hash: init failed on test %d " + "for %s: used req->result\n", j, algo); + goto out; + } + ret = crypto_wait_req(crypto_ahash_finup(req), &wait); + if (ret) { + pr_err("alg: hash: final failed on test %d " + "for %s: ret=%d\n", j, algo, -ret); + goto out; + } + break; } if (memcmp(result, template[i].digest, @@ -383,6 +415,9 @@ static int __test_hash(struct crypto_ahash *tfm, } } + if (test_type) + goto out; + j = 0; for (i = 0; i < tcount; i++) { /* alignment tests are only done with continuous buffers */ @@ -540,24 +575,24 @@ static int __test_hash(struct crypto_ahash *tfm, static int test_hash(struct crypto_ahash *tfm, const struct hash_testvec *template, - unsigned int tcount, bool use_digest) + unsigned int tcount, enum hash_test test_type) { unsigned int alignmask; int ret; - ret = __test_hash(tfm, template, tcount, use_digest, 0); + ret = __test_hash(tfm, template, tcount, test_type, 0); if (ret) return ret; /* test unaligned buffers, check with one byte offset */ - ret = __test_hash(tfm, template, tcount, use_digest, 1); + ret = __test_hash(tfm, template, tcount, test_type, 1); if (ret) return ret; alignmask = crypto_tfm_alg_alignmask(&tfm->base); if (alignmask) { /* Check if alignment mask for tfm is correctly set. */ - ret = __test_hash(tfm, template, tcount, use_digest, + ret = __test_hash(tfm, template, tcount, test_type, alignmask + 1); if (ret) return ret; @@ -1803,9 +1838,11 @@ static int __alg_test_hash(const struct hash_testvec *template, return PTR_ERR(tfm); } - err = test_hash(tfm, template, tcount, true); + err = test_hash(tfm, template, tcount, HASH_TEST_DIGEST); + if (!err) + err = test_hash(tfm, template, tcount, HASH_TEST_FINAL); if (!err) - err = test_hash(tfm, template, tcount, false); + err = test_hash(tfm, template, tcount, HASH_TEST_FINUP); crypto_free_ahash(tfm); return err; } From patchwork Sun Jul 1 07:02:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 140695 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2689870ljj; Sun, 1 Jul 2018 00:04:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ/AUkMfUd6GLXZ9/Tpjfi54EpG5hFZRPXq0ZCsuQW65XLsV4Jb61YUdeznLVFrLuhXL4+E X-Received: by 2002:a65:4841:: with SMTP id i1-v6mr17533831pgs.75.1530428661968; Sun, 01 Jul 2018 00:04:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530428661; cv=none; d=google.com; s=arc-20160816; b=HCHEYXG3ap2ByR14EcCs9F70s3c8QVmHsBTJ3tbLTt3yIxCyBC0dEvXUx8mxfEL9RM ln4Vqp9hsYIvnU9Z6NKIeBiOKOxczzHDj7o7GIh8eniEmA1VaYqFX5b8sS+dv/euvPY1 8magcXbh6rukousa0fP9cRiNTIte0tyBMFFbAurOdJJkOXaG5N8Y0gEZu5YgN9sPeppk muIp3VSqvJ9+hww8H6CU5g9zoSep09gXq3r5tphiolXe5TgylP4e+nkdIaE1rHBawgcC kV8qlew85GyTY3CQ9FTeS4eMkYeCtfyU2HMbzK/NmXfHXN1sINpwIoqgLTeVbtzIhli5 0R3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=mMB9tYmajsQrG8OrnGfwJkGRsd8eF5pSqQ8Q7rDcckY=; b=srDh1W98/7a+IMMDyq4dMloyVHJ0tSWdw05ulmwstA+I34+NlQN1gu6Bheu6pb+ern 7IhPNzz9VZwR5BsB6QCGAOzyWHHljy4JWCNqzPR9VPI5ubxLFMtft99nQ/IevpE8ghY3 X28atc8T4o1bFknMp46PFuv51QX9wjrzK4xeJ92WePgLKFgVOLQkwCBB2spGG+HDfWnk JgVAf2wqk67dnEOVoYDOQwfiRN2vTtIlxuJnAFkAlHFeabarL17VSbHPhkTPZXL3TgZa ByN5RwHJOb1MdNoxkMo2Tfx2Uwdq/HEbKNnMScrwVOcGfhTNAfnkQR8Lwmbz0FEgI8Nx wyMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v71-v6si10856800pfj.354.2018.07.01.00.04.21; Sun, 01 Jul 2018 00:04:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752390AbeGAHEU (ORCPT + 31 others); Sun, 1 Jul 2018 03:04:20 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47360 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752027AbeGAHDn (ORCPT ); Sun, 1 Jul 2018 03:03:43 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 079CB1529; Sun, 1 Jul 2018 00:03:43 -0700 (PDT) Received: from sugar.benyossef.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2A8D93F318; Sun, 1 Jul 2018 00:03:40 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , Hadar Gat , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/6] crypto: ccree: remove dead legacy code Date: Sun, 1 Jul 2018 08:02:37 +0100 Message-Id: <1530428560-4440-5-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530428560-4440-1-git-send-email-gilad@benyossef.com> References: <1530428560-4440-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove legacy code no longer used by anything. Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/ccree/cc_cipher.c | 6 ------ 1 file changed, 6 deletions(-) -- 2.7.4 diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c index 958ced3..5d12372 100644 --- a/drivers/crypto/ccree/cc_cipher.c +++ b/drivers/crypto/ccree/cc_cipher.c @@ -730,12 +730,6 @@ static int cc_cipher_process(struct skcipher_request *req, cc_req.user_cb = (void *)cc_cipher_complete; cc_req.user_arg = (void *)req; -#ifdef ENABLE_CYCLE_COUNT - cc_req.op_type = (direction == DRV_CRYPTO_DIRECTION_DECRYPT) ? - STAT_OP_TYPE_DECODE : STAT_OP_TYPE_ENCODE; - -#endif - /* Setup request context */ req_ctx->gen_ctx.op_type = direction;