From patchwork Sun Jul 1 07:02:34 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: 140690 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2689416ljj; Sun, 1 Jul 2018 00:03:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfb9pxAS+C8uWYBwU88VBZLRIzYzge/J+9n00EVtFk++MN48VfktKLlNB0R/9pYm2x9e9SZ X-Received: by 2002:a62:b29c:: with SMTP id z28-v6mr16029414pfl.8.1530428629739; Sun, 01 Jul 2018 00:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530428629; cv=none; d=google.com; s=arc-20160816; b=JPR94DIekKi54c1dPf4WH0QXLbuGU2PzLvmEqI9/EYEPCTiu2GFXl0a8cnSJ9gbO5w ZlRIxItl1LlbCa55/QmHf/wVqnLzxumiXhm8ZV+VdDDQazxT1vStkRrKvnrslWpy7zmU F0dUxp2okKEk/fGREOIN5VlpHgzHb4v/MRyVcGlxoYofMKw1cJ4a2pwVvXCF46pdOePF CcgrmUb3CE6gMD+hUHfc7RYlnYe9AxDMCdkUdEHGcJ4JNwgNq5ypTRYipcdS9me0fnuf YpPd6OPCjSJy4jw0OcRKlYhWc8C9xFc+d3n1itlDmu2cZc8G1VqM4wAbouC27OSRBQv3 sgUQ== 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=LQq9RLZabqMOnVJedXSCm004BV50Q0anAduj4CaFgoM=; b=hRelrySik54qMFSMIDEM7wxkPFwvSSYj6IWDCvz0dJzAfvXjvKLuggdfcAwreHUIGX RXGOQ5SRdnYolFI8vthEhotEdDaa7/MHk8OjN/1l4ECcoNZCNKVU0VoxhhUdINjW12uw FOAvec8/IpBl63Pp0EnKBeDT63SoLz9zl8RtOGxTu7gYnxgHdLEeVdMdE10mJO+KXBVb PYsD8ujRlYj+EAsWGTeBSAiBxt4XPROgS2Gt5lHsK9DxcAjf7lvS9E7Xgmr/CNsnoadf +Rz4qC9huVnfPl7VW6NO+ZV2SpuuekFvwLtvEdwJCdIo3apn511OI3RB6CvxsU/MMFLo jXSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752057AbeGAHDi (ORCPT + 1 other); Sun, 1 Jul 2018 03:03:38 -0400 Received: from foss.arm.com ([217.140.101.70]:47340 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751997AbeGAHDd (ORCPT ); Sun, 1 Jul 2018 03:03:33 -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 58B261529; Sun, 1 Jul 2018 00:03:33 -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 7629B3F318; Sun, 1 Jul 2018 00:03:31 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , Hadar Gat , stable@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/6] crypto: ccree: fix finup Date: Sun, 1 Jul 2018 08:02:34 +0100 Message-Id: <1530428560-4440-2-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-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Hadar Gat finup() operation was incorrect, padding was missing. Fix by setting the ccree HW to enable padding. Signed-off-by: Hadar Gat [ gilad@benyossef.com: refactored for better code sharing ] Signed-off-by: Gilad Ben-Yossef Cc: stable@vger.kernel.org --- drivers/crypto/ccree/cc_hash.c | 81 +++++++++--------------------------------- 1 file changed, 16 insertions(+), 65 deletions(-) -- 2.7.4 diff --git a/drivers/crypto/ccree/cc_hash.c b/drivers/crypto/ccree/cc_hash.c index 96ff777..e4ebde0 100644 --- a/drivers/crypto/ccree/cc_hash.c +++ b/drivers/crypto/ccree/cc_hash.c @@ -602,66 +602,7 @@ static int cc_hash_update(struct ahash_request *req) return rc; } -static int cc_hash_finup(struct ahash_request *req) -{ - struct ahash_req_ctx *state = ahash_request_ctx(req); - struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); - struct cc_hash_ctx *ctx = crypto_ahash_ctx(tfm); - u32 digestsize = crypto_ahash_digestsize(tfm); - struct scatterlist *src = req->src; - unsigned int nbytes = req->nbytes; - u8 *result = req->result; - struct device *dev = drvdata_to_dev(ctx->drvdata); - bool is_hmac = ctx->is_hmac; - struct cc_crypto_req cc_req = {}; - struct cc_hw_desc desc[CC_MAX_HASH_SEQ_LEN]; - unsigned int idx = 0; - int rc; - gfp_t flags = cc_gfp_flags(&req->base); - - dev_dbg(dev, "===== %s-finup (%d) ====\n", is_hmac ? "hmac" : "hash", - nbytes); - - if (cc_map_req(dev, state, ctx)) { - dev_err(dev, "map_ahash_source() failed\n"); - return -EINVAL; - } - - if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, 1, - flags)) { - dev_err(dev, "map_ahash_request_final() failed\n"); - cc_unmap_req(dev, state, ctx); - return -ENOMEM; - } - if (cc_map_result(dev, state, digestsize)) { - dev_err(dev, "map_ahash_digest() failed\n"); - cc_unmap_hash_request(dev, state, src, true); - cc_unmap_req(dev, state, ctx); - return -ENOMEM; - } - - /* Setup request structure */ - cc_req.user_cb = cc_hash_complete; - cc_req.user_arg = req; - - idx = cc_restore_hash(desc, ctx, state, idx); - - if (is_hmac) - idx = cc_fin_hmac(desc, req, idx); - - idx = cc_fin_result(desc, req, idx); - - rc = cc_send_request(ctx->drvdata, &cc_req, desc, idx, &req->base); - if (rc != -EINPROGRESS && rc != -EBUSY) { - dev_err(dev, "send_request() failed (rc=%d)\n", rc); - cc_unmap_hash_request(dev, state, src, true); - cc_unmap_result(dev, state, digestsize, result); - cc_unmap_req(dev, state, ctx); - } - return rc; -} - -static int cc_hash_final(struct ahash_request *req) +static int cc_do_finup(struct ahash_request *req, bool update) { struct ahash_req_ctx *state = ahash_request_ctx(req); struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); @@ -678,21 +619,20 @@ static int cc_hash_final(struct ahash_request *req) int rc; gfp_t flags = cc_gfp_flags(&req->base); - dev_dbg(dev, "===== %s-final (%d) ====\n", is_hmac ? "hmac" : "hash", - nbytes); + dev_dbg(dev, "===== %s-%s (%d) ====\n", is_hmac ? "hmac" : "hash", + update ? "finup" : "final", nbytes); if (cc_map_req(dev, state, ctx)) { dev_err(dev, "map_ahash_source() failed\n"); return -EINVAL; } - if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, 0, + if (cc_map_hash_request_final(ctx->drvdata, state, src, nbytes, update, flags)) { dev_err(dev, "map_ahash_request_final() failed\n"); cc_unmap_req(dev, state, ctx); return -ENOMEM; } - if (cc_map_result(dev, state, digestsize)) { dev_err(dev, "map_ahash_digest() failed\n"); cc_unmap_hash_request(dev, state, src, true); @@ -706,7 +646,7 @@ static int cc_hash_final(struct ahash_request *req) idx = cc_restore_hash(desc, ctx, state, idx); - /* "DO-PAD" must be enabled only when writing current length to HW */ + /* Pad the hash */ hw_desc_init(&desc[idx]); set_cipher_do(&desc[idx], DO_PAD); set_cipher_mode(&desc[idx], ctx->hw_mode); @@ -731,6 +671,17 @@ static int cc_hash_final(struct ahash_request *req) return rc; } +static int cc_hash_finup(struct ahash_request *req) +{ + return cc_do_finup(req, true); +} + + +static int cc_hash_final(struct ahash_request *req) +{ + return cc_do_finup(req, false); +} + static int cc_hash_init(struct ahash_request *req) { struct ahash_req_ctx *state = ahash_request_ctx(req); From patchwork Sun Jul 1 07:02:38 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: 140694 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2689800ljj; Sun, 1 Jul 2018 00:04:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIiJjbN9RJ7Gt2zKD0wDBhigxseCnYdGw93Yf4w1njfCBhFcYmeZgs4YjdbMlfBKfMk/sqH X-Received: by 2002:a63:920c:: with SMTP id o12-v6mr17859548pgd.233.1530428658399; Sun, 01 Jul 2018 00:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530428658; cv=none; d=google.com; s=arc-20160816; b=zKwKkyI5dOY36A5VHmkXgaYm9raBBT80iOPWQ2spBZVTnrLjWDtJr0k27gwvqJeDfS gbONDe7l3bnJxZ29uAO0dk5GKuUWslVtTxy1p1x/k147OJu84JkTDcO2shK9pTOHw2Zv g075AVYq5MUA+sMZVxH5mYy1NTG8kYI2TXXWxqmmiYgu+EJ5IIk3r8rtdn7/w+SNKLMT dMHVlfTl7qUPv6nwlNXi6QIepa8Aqnq7ESUywLX8qFvtnOXR7WfhZt/SV0znmabORb1y ngTilgdGurlGdb0p7yYyAB8xu2gLnMM1RiF5KrMqeOIKnE/HzxR7e3RH1izCmsk7Qo2y OPtg== 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=L8yKTXjD7nXisggrQALPvIPlS564DWgFY0T0pdLIgLY=; b=FSKB+HvUVhxagcgPuS4A1+Zx1kKM1PaIuETRislXYts7YztLclMtUWVoq6zHw79tQ1 EFQnjk1igyXXkss9sr8Dy0FunxrlnURkCt9E7yF6aN5D3nJxIjQRbcI33ZyIYUZPZA+G Dxt7nV4/j5tWtZRCodvv2+13Q+bLWQXa7JQMnPB8mnlYXQGpyRw2s2wyL8WmOPEO80JW G3+QlDvdQKdaO+6vZa/hyeRPnH0V8HrYEbuFxTSjkC2yp7Mb95AJYRvjNGv56ORqmwXj wjT0KKoAyLY86V0lL5fDZkMZyAdnZiIlx+3PYiy6aSkcazUNSbvqjCscfPPSYdXT2Tgg JUSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 m13-v6si13749134pls.70.2018.07.01.00.04.18; Sun, 01 Jul 2018 00:04:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752179AbeGAHEQ (ORCPT + 1 other); Sun, 1 Jul 2018 03:04:16 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47370 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192AbeGAHDq (ORCPT ); Sun, 1 Jul 2018 03:03:46 -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 350DD18A; Sun, 1 Jul 2018 00:03:46 -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 5950B3F318; Sun, 1 Jul 2018 00:03:44 -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 5/6] crypto: ccree: use CBC-CS3 CTS mode Date: Sun, 1 Jul 2018 08:02:38 +0100 Message-Id: <1530428560-4440-6-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-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The ccree driver implemented NIST 800-38A CBC-CS2 ciphertext format, which only reverses the last two blocks if the stolen ciphertext amount are none zero. Move it to the kernel chosen format of CBC-CS3 which swaps the final blocks unconditionally and rename it to "cts" now that it complies with the kernel format and passes the self tests. Ironically, the CryptoCell REE HW does just that, so the fix is dropping the code that forced it to use plain CBC if the ciphertext was block aligned. Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/ccree/cc_cipher.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) -- 2.7.4 diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c index 5d12372..7a80963 100644 --- a/drivers/crypto/ccree/cc_cipher.c +++ b/drivers/crypto/ccree/cc_cipher.c @@ -687,7 +687,7 @@ static int cc_cipher_process(struct skcipher_request *req, struct device *dev = drvdata_to_dev(ctx_p->drvdata); struct cc_hw_desc desc[MAX_ABLKCIPHER_SEQ_LEN]; struct cc_crypto_req cc_req = {}; - int rc, cts_restore_flag = 0; + int rc; unsigned int seq_len = 0; gfp_t flags = cc_gfp_flags(&req->base); @@ -719,13 +719,6 @@ static int cc_cipher_process(struct skcipher_request *req, goto exit_process; } - /*For CTS in case of data size aligned to 16 use CBC mode*/ - if (((nbytes % AES_BLOCK_SIZE) == 0) && - ctx_p->cipher_mode == DRV_CIPHER_CBC_CTS) { - ctx_p->cipher_mode = DRV_CIPHER_CBC; - cts_restore_flag = 1; - } - /* Setup request structure */ cc_req.user_cb = (void *)cc_cipher_complete; cc_req.user_arg = (void *)req; @@ -770,9 +763,6 @@ static int cc_cipher_process(struct skcipher_request *req, } exit_process: - if (cts_restore_flag) - ctx_p->cipher_mode = DRV_CIPHER_CBC_CTS; - if (rc != -EINPROGRESS && rc != -EBUSY) { kzfree(req_ctx->backup_info); kzfree(req_ctx->iv); @@ -1026,8 +1016,8 @@ static const struct cc_alg_template skcipher_algs[] = { .min_hw_rev = CC_HW_REV_712, }, { - .name = "cts1(cbc(paes))", - .driver_name = "cts1-cbc-paes-ccree", + .name = "cts(cbc(paes))", + .driver_name = "cts-cbc-paes-ccree", .blocksize = AES_BLOCK_SIZE, .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .template_skcipher = { @@ -1261,8 +1251,8 @@ static const struct cc_alg_template skcipher_algs[] = { .min_hw_rev = CC_HW_REV_630, }, { - .name = "cts1(cbc(aes))", - .driver_name = "cts1-cbc-aes-ccree", + .name = "cts(cbc(aes))", + .driver_name = "cts-cbc-aes-ccree", .blocksize = AES_BLOCK_SIZE, .type = CRYPTO_ALG_TYPE_ABLKCIPHER, .template_skcipher = { From patchwork Sun Jul 1 07:02:39 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: 140693 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2689579ljj; Sun, 1 Jul 2018 00:04:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfi+ny7soKRSnv4zgfMoJORHC/HN4Lt03rShlh7gMKhGT9jxo+6MXYbX0WFP4aETVmgw6bi X-Received: by 2002:aa7:8004:: with SMTP id j4-v6mr20657988pfi.174.1530428640868; Sun, 01 Jul 2018 00:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530428640; cv=none; d=google.com; s=arc-20160816; b=LL+lrj3/J3/K+oX7iz0iLlYZjp7UrHZ3njX2lIA/jPE3P8IZXj2hdzT0yMUqQxMdvx Nqn3vWv56zCB9ZFej8h+27r2a0CdDfm1yuJ6bmrTZbTmSxVKEnYDrXMsX8uJB6pDXM2M ttYxAYFfeHEStj8U1hQaRP2LJYzt2yz5CB4mv1HfzcRK6ZzGQTA1iHeoZL8/9aWLbQP6 CEP+NZUDsKugAole0smbdZg1DnYgMyRKZDFUANB+i9JINwSQ0VPhjrEbrdDpMGImNUr5 r2LfvCmiO+ARkyybDxZ/fYcVAguxOwp7DbPMbZ4XpFjfuDs3KSZSRMPjDjVd+UBpbkp/ 801g== 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=yepKTStayGr49QyhTc8t6NTW8pVPYnaUZ1Gf6aQ8SEg=; b=hENnk1i8+ae68kukIqVZAFHTvT4wFPZkyxCzXLxIayRjm31pboQeVTQbysFdCJi8Iw vq5wfcOqQe9CObpdR7MFgw8tjAdBjEHtuRTYgzCmiBqw11mmU2htr+mmzzgZ29Y4RDIO heguF9V9bRhT1tiyZXfg9ARdMOAPezvg32IulT95h7W3hCiMlivymjvmk69jJmVmuClR ZlrdSySNUcAv57q4ZgJOPCEVzklV8xI0n7yr+aj51SzfCQWGzOSoEwEIL4qPpPCLe99n cKf2Cc1HqKZsAH9VdyQwGXLIhZ8KlZ39ESSoa+3tFPK8MGVZUpHsD1S6bHf6r5MCU2CR PY1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 31-v6si13052711plz.217.2018.07.01.00.04.00; Sun, 01 Jul 2018 00:04:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752194AbeGAHDx (ORCPT + 1 other); Sun, 1 Jul 2018 03:03:53 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47378 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752175AbeGAHDt (ORCPT ); Sun, 1 Jul 2018 03:03:49 -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 621661529; Sun, 1 Jul 2018 00:03:49 -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 863193F318; Sun, 1 Jul 2018 00:03:47 -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 6/6] crypto: ccree: rate limit debug print Date: Sun, 1 Jul 2018 08:02:39 +0100 Message-Id: <1530428560-4440-7-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-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org A debug print about register status post interrupt can happen quite often. Rate limit it to avoid cluttering the log. Signed-off-by: Gilad Ben-Yossef Reported-by: Geert Uytterhoeven --- drivers/crypto/ccree/cc_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 Tested-by: Geert Uytterhoeven diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c index bd974fe..1ff229c 100644 --- a/drivers/crypto/ccree/cc_driver.c +++ b/drivers/crypto/ccree/cc_driver.c @@ -131,8 +131,8 @@ static irqreturn_t cc_isr(int irq, void *dev_id) } if (irr) { - dev_dbg(dev, "IRR includes unknown cause bits (0x%08X)\n", - irr); + dev_dbg_ratelimited(dev, "IRR includes unknown cause bits (0x%08X)\n", + irr); /* Just warning */ }