From patchwork Mon Dec 14 20:02:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 343618 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35362C2BB40 for ; Mon, 14 Dec 2020 20:04:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E8DC622512 for ; Mon, 14 Dec 2020 20:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502944AbgLNUDp (ORCPT ); Mon, 14 Dec 2020 15:03:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502956AbgLNUDg (ORCPT ); Mon, 14 Dec 2020 15:03:36 -0500 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8D7EC061794 for ; Mon, 14 Dec 2020 12:02:56 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id w5so12593972pgj.3 for ; Mon, 14 Dec 2020 12:02:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IcIRwkZ8OZdNHBj5vIxvJw4vzDArIn2JvgviRxGrME0=; b=BxgQm4GOTVDXkX8er1nP7MnoFp1SSFm0fOFDppClgd5e+RfY2YSQO8U4xhDsZydL5y droFoRW+xtGGZFSuvMCLYmX8CUXDRlCQqvnTjQbUliug0cF4rTfHEYnIPQze9c0U0qus tklfphhmK4d0q+PrZmu183Z4Fg+pOj7XuHPJP9HynYRtzL8CLCXyGG5yB9T/OGtTLPjO sIcpoFFAeTtn1pdBu8NOzVT45MXxKguubd/z2WpkQIKwpJYS5stNxIAdadtDCvgD06/Y J/BAt2YVUv31WZakw51Gk24D5Yerypg62C2s3vKJH49JjF97nmlzCyoI28ezisy34xBN EGrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IcIRwkZ8OZdNHBj5vIxvJw4vzDArIn2JvgviRxGrME0=; b=K3Cs5MUVf0clhnaaKz1feeZVguPpHmfS2HZyYgOembX7ktuMMv7+QcJZdPHUz3r7yl cY6EMDLKZU7NloeUPxikZbSf33MeCN4uATuOFy2LMvJ/K8qaLCMOex175j5oxD8M47Ap epal0vVDvuGp1XS46w45RRT3+JeUGriOuRNPU9YsWnj57rm5suJppkdWOJk9ps1h9zAg F9pIjXciv901CfFzVG+/4ECyKwFZAaKSYSPV/21hKDWMtUVOGcMzHc2qnRJY6hAQxLNZ dfEOBECZZDGL4ZCcpG8hoUf4g/jYe72On4UU8BFfeZhxXTLLALO4xZPylmgDNltRdNod hluQ== X-Gm-Message-State: AOAM530qPWhcrsa5IMvfsSA+F3gLGqFXVUJk3fQOZ5OknUWWwWbqUcrG hSTpDJ1RTy34BhcW2lTwrTJxmw== X-Google-Smtp-Source: ABdhPJwO/V/z0sxQfPRx31wpvQ3CP7pHObiVAuAdG03+4tQ8oJkJX2O9uVVXDk6uzKgWyKip5r4pFQ== X-Received: by 2002:a63:5849:: with SMTP id i9mr25981184pgm.271.1607976176314; Mon, 14 Dec 2020 12:02:56 -0800 (PST) Received: from localhost.localdomain ([163.172.76.58]) by smtp.googlemail.com with ESMTPSA id js9sm22434109pjb.2.2020.12.14.12.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 12:02:55 -0800 (PST) From: Corentin Labbe To: arnd@arndb.de, davem@davemloft.net, herbert@gondor.apana.org.au, jernej.skrabec@siol.net, mripard@kernel.org, wens@csie.org Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH v4 1/8] crypto: sun4i-ss: linearize buffers content must be kept Date: Mon, 14 Dec 2020 20:02:25 +0000 Message-Id: <20201214200232.17357-2-clabbe@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201214200232.17357-1-clabbe@baylibre.com> References: <20201214200232.17357-1-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org When running the non-optimized cipher function, SS produce partial random output. This is due to linearize buffers being reseted after each loop. For preserving stack, instead of moving them back to start of function, I move them in sun4i_ss_ctx. Fixes: 8d3bcb9900ca ("crypto: sun4i-ss - reduce stack usage") Signed-off-by: Corentin Labbe --- drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c | 12 ++++-------- drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h | 2 ++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c index b72de8939497..19f1aa577ed4 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c @@ -233,8 +233,6 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) while (oleft) { if (ileft) { - char buf[4 * SS_RX_MAX];/* buffer for linearize SG src */ - /* * todo is the number of consecutive 4byte word that we * can read from current SG @@ -256,12 +254,12 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) */ todo = min(rx_cnt * 4 - ob, ileft); todo = min_t(size_t, todo, mi.length - oi); - memcpy(buf + ob, mi.addr + oi, todo); + memcpy(ss->buf + ob, mi.addr + oi, todo); ileft -= todo; oi += todo; ob += todo; if (!(ob % 4)) { - writesl(ss->base + SS_RXFIFO, buf, + writesl(ss->base + SS_RXFIFO, ss->buf, ob / 4); ob = 0; } @@ -295,13 +293,11 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) oo = 0; } } else { - char bufo[4 * SS_TX_MAX]; /* buffer for linearize SG dst */ - /* * read obl bytes in bufo, we read at maximum for * emptying the device */ - readsl(ss->base + SS_TXFIFO, bufo, tx_cnt); + readsl(ss->base + SS_TXFIFO, ss->bufo, tx_cnt); obl = tx_cnt * 4; obo = 0; do { @@ -313,7 +309,7 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) */ todo = min_t(size_t, mo.length - oo, obl - obo); - memcpy(mo.addr + oo, bufo + obo, todo); + memcpy(mo.addr + oo, ss->bufo + obo, todo); oleft -= todo; obo += todo; oo += todo; diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h index 5c291e4a6857..c242fccb2ab6 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h @@ -148,6 +148,8 @@ struct sun4i_ss_ctx { struct reset_control *reset; struct device *dev; struct resource *res; + char buf[4 * SS_RX_MAX];/* buffer for linearize SG src */ + char bufo[4 * SS_TX_MAX]; /* buffer for linearize SG dst */ spinlock_t slock; /* control the use of the device */ #ifdef CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG u32 seed[SS_SEED_LEN / BITS_PER_LONG]; From patchwork Mon Dec 14 20:02:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 343617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AE08C2BB9A for ; Mon, 14 Dec 2020 20:04:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 12AD22255F for ; Mon, 14 Dec 2020 20:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502859AbgLNUDu (ORCPT ); Mon, 14 Dec 2020 15:03:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502869AbgLNUDn (ORCPT ); Mon, 14 Dec 2020 15:03:43 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 507A6C06179C for ; Mon, 14 Dec 2020 12:03:03 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id w16so13356146pga.9 for ; Mon, 14 Dec 2020 12:03:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BdxMVC3y5nlR7LDMxIQSz3qWj9jrWm9Nsf2wISBO6pc=; b=LFVHg2rNbEt02LLPnkWOohGk8VIhywesyIxgHiqAVoru6cI75unOmiStz32cZ6y+5B GL+mJ6YH7mTcGxudEG3o5arOqjNvAQrUwRWzSPqM3W3iJv9O34xi9vG3w41FH5zMUvN1 3ADDsOv8n7jI+sQAcZBmLufNtQsEwc1/LoOT/1hVCz/kru0CHAKgtKnTGlmeHskONmo+ CEAoXXJ3X+2jP2fcKovBAXjO4XiHWndTM5VjpJcyjYGp+eqkdDH2c+691UZpMUAAERWu 8ScMA0Hp3TEsajRGKrtzklh2DM7t/Vu5rGcrKy+t2aRigykj3BF+P0iSSeHgZ4TQ6FQ/ 93bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BdxMVC3y5nlR7LDMxIQSz3qWj9jrWm9Nsf2wISBO6pc=; b=O6OB0867OqHROFNp9Wr6b8CUesr9nkp1Ipd1AWqzzIrC3wBti+hkAtYu2YXJclEFVS Wj8UDaGW5L+fFTBq93aRSReRmjDpU7/VPUwn72AolyQZUNjXUGkBSgVIJv07oOWgjiHu ootlqpQe9LLqo/cfZzfcegYe06izpuV2yJ1yZVsdtzNDh1beDxnq5WTmZXtcn4BQi3v6 jVqNj1oWqVi0/f2QZAw9PgL8dpKao9Lsws8KSNPf6UZ9YyCXLxkfCX2BDdVuslRedWhO mvJTdlXxu9tiZ5hVRgJosXDUtMlACwzDEYKTfNNoBHRxFe02F1fRMXBxKdP/RANBGkXJ 8iNA== X-Gm-Message-State: AOAM5312NcqE6iB5q864aGuZ7kX1h16N2FcopjQ/Un5dZiXnDqyCOUe+ RdNPV4Yobp+RDOzZpXsaWPKsiw== X-Google-Smtp-Source: ABdhPJzKh8HJaK54TRvEM5Wt0CA7yuq8pZy4BPn2IMdwD95gbsiCsgLgHhwTk/FqSplATiFqAetjqw== X-Received: by 2002:a63:c04b:: with SMTP id z11mr25034328pgi.74.1607976182932; Mon, 14 Dec 2020 12:03:02 -0800 (PST) Received: from localhost.localdomain ([163.172.76.58]) by smtp.googlemail.com with ESMTPSA id js9sm22434109pjb.2.2020.12.14.12.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 12:03:02 -0800 (PST) From: Corentin Labbe To: arnd@arndb.de, davem@davemloft.net, herbert@gondor.apana.org.au, jernej.skrabec@siol.net, mripard@kernel.org, wens@csie.org Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe , stable@vger.kernel.org Subject: [PATCH v4 2/8] crypto: sun4i-ss: checking sg length is not sufficient Date: Mon, 14 Dec 2020 20:02:26 +0000 Message-Id: <20201214200232.17357-3-clabbe@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201214200232.17357-1-clabbe@baylibre.com> References: <20201214200232.17357-1-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The optimized cipher function need length multiple of 4 bytes. But it get sometimes odd length. This is due to SG data could be stored with an offset. So the fix is to check also if the offset is aligned with 4 bytes. Fixes: 6298e948215f2 ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator") Cc: Signed-off-by: Corentin Labbe --- drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c index 19f1aa577ed4..f49797588329 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c @@ -186,12 +186,12 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) * we can use the SS optimized function */ while (in_sg && no_chunk == 1) { - if (in_sg->length % 4) + if ((in_sg->length | in_sg->offset) & 3u) no_chunk = 0; in_sg = sg_next(in_sg); } while (out_sg && no_chunk == 1) { - if (out_sg->length % 4) + if ((out_sg->length | out_sg->offset) & 3u) no_chunk = 0; out_sg = sg_next(out_sg); } From patchwork Mon Dec 14 20:02:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 343614 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44985C2BBD5 for ; Mon, 14 Dec 2020 20:08:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B099207A0 for ; Mon, 14 Dec 2020 20:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728276AbgLNUIc (ORCPT ); Mon, 14 Dec 2020 15:08:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502978AbgLNUEU (ORCPT ); Mon, 14 Dec 2020 15:04:20 -0500 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1544BC061257 for ; Mon, 14 Dec 2020 12:03:17 -0800 (PST) Received: by mail-pj1-x1043.google.com with SMTP id l23so7345210pjg.1 for ; Mon, 14 Dec 2020 12:03:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K1Ybs+hT1nPIORP2XwYBCL9D0EZYSmN/d5S7S6dnsio=; b=g+LNnNxBUNpU7QpFrxNKjl6txTsOOQHzwo1n74/ZGkW1xYEo3ghMx8d8gv17is0vfB /IiG6hqy3cl9DDBeK3tJoosmjJiEUDmGeI9BfcZbvS9vg8ZrqrSvMuA9bIc7L2mQY/o6 CdXgXVvBNUVQu/zEl9PQ+rLiGCdTsRfSZR52IaaLGfGTOISRWVt1+jkbs+JNOZBX23tA 5Sto69xFCyXCsr4u6S399effMuJiVAZjrI/5TnEaIiwyNXQ8RqImDBA2lMySSN9cfYRX AnHuYTIZDQmEFTkoaVN51W2xitoRo9Fbag24kZ/eNeQ0BX70JVm31nDLPaOJZqPhPdZj iGjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K1Ybs+hT1nPIORP2XwYBCL9D0EZYSmN/d5S7S6dnsio=; b=ToDQalodZ880xQxnoCwVGeRzyJNnZZ6SBKOJ7i9xCGnD1GQqoTP82fEpzNdsGJnzsl vQuw+PbHiZuWzErOwJG3b1yQqaR038Y4y/XS3yySATzhcrPz3fePx9M3CPJSr1lw/EO3 qaLeU/fMw20TSN8qPHl24bEew/NKvKSwW1AaVqwoM2ohXOrS5Ym5YIbrWPiAbUlq8dJW cG+f2ZQV8VHpOO5GWFRQlG+fvczV3/sxFvspX6cQ3TsBg6sVIME1LlhwRJSxEMZsbIai Q3z8/jD57bSb17++C3qoGo5MTUD8yiwKjb/DHpglbBkinV086XVoOhMAIH1sB93dRJHf bGEg== X-Gm-Message-State: AOAM531vZKAIifCdZElInI3bp+fimFN3YjXkY4TTdcDSdScS1iej2XYx Buu+hHQQyHqqCm9snlrBdtATnA== X-Google-Smtp-Source: ABdhPJxadrTTvMZ1XJcLsGOHcN+QNjm9wpcmYYgls91MdCy9Qa3wTYd/uomMSGJUuJXoDU5RmvPlOA== X-Received: by 2002:a17:90a:a58f:: with SMTP id b15mr19829282pjq.17.1607976196699; Mon, 14 Dec 2020 12:03:16 -0800 (PST) Received: from localhost.localdomain ([163.172.76.58]) by smtp.googlemail.com with ESMTPSA id js9sm22434109pjb.2.2020.12.14.12.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 12:03:16 -0800 (PST) From: Corentin Labbe To: arnd@arndb.de, davem@davemloft.net, herbert@gondor.apana.org.au, jernej.skrabec@siol.net, mripard@kernel.org, wens@csie.org Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe , stable@vger.kernel.org Subject: [PATCH v4 4/8] crypto: sun4i-ss: handle BigEndian for cipher Date: Mon, 14 Dec 2020 20:02:28 +0000 Message-Id: <20201214200232.17357-5-clabbe@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201214200232.17357-1-clabbe@baylibre.com> References: <20201214200232.17357-1-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Ciphers produce invalid results on BE. Key and IV need to be written in LE. Fixes: 6298e948215f2 ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator") Cc: Signed-off-by: Corentin Labbe --- drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c index c7bf731dad7b..e097f4c3e68f 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c @@ -52,13 +52,13 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq) spin_lock_irqsave(&ss->slock, flags); - for (i = 0; i < op->keylen; i += 4) - writel(*(op->key + i / 4), ss->base + SS_KEY0 + i); + for (i = 0; i < op->keylen / 4; i++) + writesl(ss->base + SS_KEY0 + i * 4, &op->key[i], 1); if (areq->iv) { for (i = 0; i < 4 && i < ivsize / 4; i++) { v = *(u32 *)(areq->iv + i * 4); - writel(v, ss->base + SS_IV0 + i * 4); + writesl(ss->base + SS_IV0 + i * 4, &v, 1); } } writel(mode, ss->base + SS_CTL); @@ -223,13 +223,13 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) spin_lock_irqsave(&ss->slock, flags); - for (i = 0; i < op->keylen; i += 4) - writel(*(op->key + i / 4), ss->base + SS_KEY0 + i); + for (i = 0; i < op->keylen / 4; i++) + writesl(ss->base + SS_KEY0 + i * 4, &op->key[i], 1); if (areq->iv) { for (i = 0; i < 4 && i < ivsize / 4; i++) { v = *(u32 *)(areq->iv + i * 4); - writel(v, ss->base + SS_IV0 + i * 4); + writesl(ss->base + SS_IV0 + i * 4, &v, 1); } } writel(mode, ss->base + SS_CTL); From patchwork Mon Dec 14 20:02:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 343615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDADFC4361B for ; Mon, 14 Dec 2020 20:07:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97B0E207A0 for ; Mon, 14 Dec 2020 20:07:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502063AbgLNUFC (ORCPT ); Mon, 14 Dec 2020 15:05:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502925AbgLNUE4 (ORCPT ); Mon, 14 Dec 2020 15:04:56 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AA72C0613D3 for ; Mon, 14 Dec 2020 12:03:36 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id v3so9372018plz.13 for ; Mon, 14 Dec 2020 12:03:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ogpWsvnZoTjsVLTMRwt0MUzlpuTaHOsyq+/rZpbzBIA=; b=KN7E6r54tS+57WRULrmmLeaw88D1Jj68cHY9ifod+rnE8TkdZfWWuAeHYfDl7npTuT Az9qnXF4556bv5SJSqaQyZUCfqF4kWCZEAVneVdpMnL2nZxN11iMWr0Xb44+DKmzhAwc xf4vxanuiHvuFo+ls2wKAZHPGUp+WRBr3y9W2mhxH71esdIH8mcok2/T2bfVbWJXYQ7y +Tbkb76pFVLwvyadTD+0kp84GYnmo3Di5fH2oHC3dQiu01lmOeZpusFNIMeF7sBU6DoG Uz3N5DLoYy38B6ZNilVRqdOaXcvaj1t7KWSr7owWHoaKTbx84jjrt/oedwjZT2Se+5RI 39fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ogpWsvnZoTjsVLTMRwt0MUzlpuTaHOsyq+/rZpbzBIA=; b=dl7WCjj9Gl6zD+YmIpINSbD3PmmI/zfm1UQj/cbOhZWvKEZiH+wP/WK1S0EHvJjbUg IRphXBLR4d72cZ3SdTD3TD13ZOqPlnsLl8t1MqT+uINSouFl8JE+jb7e0kulMNZNGjRe CevNlPt9fnNei584U+8vQ5bt8cIwRjc9/R5m6KJ1WDGk8F1UNePgK7hvnYY6l3t3CQev HYwIAGOjL+oaEYvMLQZsxOgiyaMhts1DMwBdyYHKAFWOhrrlUbgBO3wmoadBdRkhBZ9B 9l0RgsYv2EjLTYO1ssDeAf6ys8i96KCgy26jTUTXDg+AG5TwQ2oCvpdL59wVp3eCRsfk +rfg== X-Gm-Message-State: AOAM532uepih0ofKkdit/6W9axsgmrbwskoplFr9ONYxOUNxc9iyA2lG +cVRMieGR/Qx314wrC3gHQmUZw== X-Google-Smtp-Source: ABdhPJxnwCeO9nOyTdaRjxZ6GMaPGJjCrMkYzCFe+XNY3AESM6nW89/uvfknHadfXxweJ1ZLXeY7mw== X-Received: by 2002:a17:90b:346:: with SMTP id fh6mr15544080pjb.225.1607976215664; Mon, 14 Dec 2020 12:03:35 -0800 (PST) Received: from localhost.localdomain ([163.172.76.58]) by smtp.googlemail.com with ESMTPSA id js9sm22434109pjb.2.2020.12.14.12.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 12:03:35 -0800 (PST) From: Corentin Labbe To: arnd@arndb.de, davem@davemloft.net, herbert@gondor.apana.org.au, jernej.skrabec@siol.net, mripard@kernel.org, wens@csie.org Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH v4 7/8] crypto: sun4i-ss: enabled stats via debugfs Date: Mon, 14 Dec 2020 20:02:31 +0000 Message-Id: <20201214200232.17357-8-clabbe@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201214200232.17357-1-clabbe@baylibre.com> References: <20201214200232.17357-1-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This patch enable to access usage stats for each algorithm. Signed-off-by: Corentin Labbe --- drivers/crypto/allwinner/Kconfig | 9 ++++ .../allwinner/sun4i-ss/sun4i-ss-cipher.c | 20 +++++++ .../crypto/allwinner/sun4i-ss/sun4i-ss-core.c | 52 +++++++++++++++++++ .../crypto/allwinner/sun4i-ss/sun4i-ss-hash.c | 6 +++ .../crypto/allwinner/sun4i-ss/sun4i-ss-prng.c | 5 ++ drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h | 6 +++ 6 files changed, 98 insertions(+) diff --git a/drivers/crypto/allwinner/Kconfig b/drivers/crypto/allwinner/Kconfig index 3bd917584754..16eb42140e28 100644 --- a/drivers/crypto/allwinner/Kconfig +++ b/drivers/crypto/allwinner/Kconfig @@ -51,6 +51,15 @@ config CRYPTO_DEV_SUN4I_SS_PRNG Select this option if you want to provide kernel-side support for the Pseudo-Random Number Generator found in the Security System. +config CRYPTO_DEV_SUN4I_SS_DEBUG + bool "Enable sun4i-ss stats" + depends on CRYPTO_DEV_SUN4I_SS + depends on DEBUG_FS + help + Say y to enable sun4i-ss debug stats. + This will create /sys/kernel/debug/sun4i-ss/stats for displaying + the number of requests per algorithm. + config CRYPTO_DEV_SUN8I_CE tristate "Support for Allwinner Crypto Engine cryptographic offloader" select CRYPTO_SKCIPHER diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c index ffa628c89e21..d5275d914d09 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c @@ -36,6 +36,8 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq) struct sg_mapping_iter mi, mo; unsigned int oi, oo; /* offset for in and out */ unsigned long flags; + struct skcipher_alg *alg = crypto_skcipher_alg(tfm); + struct sun4i_ss_alg_template *algt; if (!areq->cryptlen) return 0; @@ -52,6 +54,12 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq) scatterwalk_map_and_copy(backup_iv, areq->src, areq->cryptlen - ivsize, ivsize, 0); } + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN4I_SS_DEBUG)) { + algt = container_of(alg, struct sun4i_ss_alg_template, alg.crypto); + algt->stat_opti++; + algt->stat_bytes += areq->cryptlen; + } + spin_lock_irqsave(&ss->slock, flags); for (i = 0; i < op->keylen / 4; i++) @@ -147,6 +155,13 @@ static int noinline_for_stack sun4i_ss_cipher_poll_fallback(struct skcipher_requ struct sun4i_tfm_ctx *op = crypto_skcipher_ctx(tfm); struct sun4i_cipher_req_ctx *ctx = skcipher_request_ctx(areq); int err; + struct skcipher_alg *alg = crypto_skcipher_alg(tfm); + struct sun4i_ss_alg_template *algt; + + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN4I_SS_DEBUG)) { + algt = container_of(alg, struct sun4i_ss_alg_template, alg.crypto); + algt->stat_fb++; + } skcipher_request_set_tfm(&ctx->fallback_req, op->fallback_tfm); skcipher_request_set_callback(&ctx->fallback_req, areq->base.flags, @@ -236,6 +251,11 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) scatterwalk_map_and_copy(backup_iv, areq->src, areq->cryptlen - ivsize, ivsize, 0); } + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN4I_SS_DEBUG)) { + algt->stat_req++; + algt->stat_bytes += areq->cryptlen; + } + spin_lock_irqsave(&ss->slock, flags); for (i = 0; i < op->keylen / 4; i++) diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c index a2b67f7f8a81..709905ec4680 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c @@ -10,6 +10,7 @@ */ #include #include +#include #include #include #include @@ -234,6 +235,51 @@ static struct sun4i_ss_alg_template ss_algs[] = { #endif }; +static int sun4i_ss_dbgfs_read(struct seq_file *seq, void *v) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(ss_algs); i++) { + if (!ss_algs[i].ss) + continue; + switch (ss_algs[i].type) { + case CRYPTO_ALG_TYPE_SKCIPHER: + seq_printf(seq, "%s %s reqs=%lu opti=%lu fallback=%lu tsize=%lu\n", + ss_algs[i].alg.crypto.base.cra_driver_name, + ss_algs[i].alg.crypto.base.cra_name, + ss_algs[i].stat_req, ss_algs[i].stat_opti, ss_algs[i].stat_fb, + ss_algs[i].stat_bytes); + break; + case CRYPTO_ALG_TYPE_RNG: + seq_printf(seq, "%s %s reqs=%lu tsize=%lu\n", + ss_algs[i].alg.rng.base.cra_driver_name, + ss_algs[i].alg.rng.base.cra_name, + ss_algs[i].stat_req, ss_algs[i].stat_bytes); + break; + case CRYPTO_ALG_TYPE_AHASH: + seq_printf(seq, "%s %s reqs=%lu\n", + ss_algs[i].alg.hash.halg.base.cra_driver_name, + ss_algs[i].alg.hash.halg.base.cra_name, + ss_algs[i].stat_req); + break; + } + } + return 0; +} + +static int sun4i_ss_dbgfs_open(struct inode *inode, struct file *file) +{ + return single_open(file, sun4i_ss_dbgfs_read, inode->i_private); +} + +static const struct file_operations sun4i_ss_debugfs_fops = { + .owner = THIS_MODULE, + .open = sun4i_ss_dbgfs_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + /* * Power management strategy: The device is suspended unless a TFM exists for * one of the algorithms proposed by this driver. @@ -454,6 +500,12 @@ static int sun4i_ss_probe(struct platform_device *pdev) break; } } + + /* Ignore error of debugfs */ + ss->dbgfs_dir = debugfs_create_dir("sun4i-ss", NULL); + ss->dbgfs_stats = debugfs_create_file("stats", 0444, ss->dbgfs_dir, ss, + &sun4i_ss_debugfs_fops); + return 0; error_alg: i--; diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c index 1dff48558f53..c1b4585e9bbc 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c @@ -191,8 +191,10 @@ static int sun4i_hash(struct ahash_request *areq) u32 spaces, rx_cnt = SS_RX_DEFAULT, bf[32] = {0}, v, ivmode = 0; struct sun4i_req_ctx *op = ahash_request_ctx(areq); struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); + struct ahash_alg *alg = __crypto_ahash_alg(tfm->base.__crt_alg); struct sun4i_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); struct sun4i_ss_ctx *ss = tfmctx->ss; + struct sun4i_ss_alg_template *algt; struct scatterlist *in_sg = areq->src; struct sg_mapping_iter mi; int in_r, err = 0; @@ -398,6 +400,10 @@ static int sun4i_hash(struct ahash_request *areq) */ hash_final: + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN4I_SS_DEBUG)) { + algt = container_of(alg, struct sun4i_ss_alg_template, alg.hash); + algt->stat_req++; + } /* write the remaining words of the wait buffer */ if (op->len) { diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-prng.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-prng.c index 729aafdbea84..152841076e3a 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-prng.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-prng.c @@ -32,6 +32,11 @@ int sun4i_ss_prng_generate(struct crypto_rng *tfm, const u8 *src, if (err < 0) return err; + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN4I_SS_DEBUG)) { + algt->stat_req++; + algt->stat_bytes += todo; + } + spin_lock_bh(&ss->slock); writel(mode, ss->base + SS_CTL); diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h index c242fccb2ab6..0fee6f4e2d90 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h @@ -154,6 +154,8 @@ struct sun4i_ss_ctx { #ifdef CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG u32 seed[SS_SEED_LEN / BITS_PER_LONG]; #endif + struct dentry *dbgfs_dir; + struct dentry *dbgfs_stats; }; struct sun4i_ss_alg_template { @@ -165,6 +167,10 @@ struct sun4i_ss_alg_template { struct rng_alg rng; } alg; struct sun4i_ss_ctx *ss; + unsigned long stat_req; + unsigned long stat_fb; + unsigned long stat_bytes; + unsigned long stat_opti; }; struct sun4i_tfm_ctx { From patchwork Mon Dec 14 20:02:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 343616 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8605C2BB48 for ; Mon, 14 Dec 2020 20:05:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 717E8207A0 for ; Mon, 14 Dec 2020 20:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502909AbgLNUEp (ORCPT ); Mon, 14 Dec 2020 15:04:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503003AbgLNUEf (ORCPT ); Mon, 14 Dec 2020 15:04:35 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84EC6C061794 for ; Mon, 14 Dec 2020 12:03:43 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id w4so13333446pgg.13 for ; Mon, 14 Dec 2020 12:03:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=glOnBFiECF8TpThPY1T9sfOwrbTI0Z62FinuvRqJFM0=; b=Ihg/wFKGpdoKe519ELAQtVqcDaavMDG5r1bihOEcNRbZQC+E7hplzqpQEDgnpdH4j+ Oq4WgDsgFsUhl2gaWy8jb2LcpU6VfJdTj6goH9M5mG8HI3M9NSfZXSjLLnRzMDPxRtZs IimAH8Frd9xs5hPPBaUPviKS0I7ce5DX4v0ZMKbI11ovv2oy9SoqLOumdsXFRraW1ef6 9resbu3JryZ2X3XZ6eUytHER6uZ/MiBvaApyfiaQoE3wk1lLeFkuAxTAtI7gDcBRsy3G UBZto2UDXbLui+9dqZ0GmYsiYJ2T2wxV7cNEUQls7zJ7ffuD4TV8Jowwfi9/FyzTiK9K 4CXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=glOnBFiECF8TpThPY1T9sfOwrbTI0Z62FinuvRqJFM0=; b=m/symo0rwdZic86N3GtZslXn2YBITnnq4Nlmss9ph5wbiX9Y1jN1TpCLRAorqsZG55 y7wRFn+R9MgwVjQkJ+4qmz5EZrbqvn6namStghihFvJhF0PWnejgmFGbCndLPG/MC3J6 S2zDCot+AS1JgrrtuxDRVZVMuOeT3JpOJLzGk6yFEL6ROiecy8EqVJugHBfiNB2emgVx AltR5MlRqcblAY4KjV3ffybQ91rl76pjB9+ME/+M3qaq41C96svRa94azQ84mSuWW2NG PxK3alG7dKWDNF2TOL8/Nve5KhhIFvZGy6z7YHatxDuvRHQZfMdyGkTzsXGFKfm4pJcb tHVg== X-Gm-Message-State: AOAM533Y9RyNWbxwBdz6g7SvQN4jtUHNusd/KNqyB/trpak4VXCGRGp3 MSAvrfjPNU9JalXYbBWiNDjK6g== X-Google-Smtp-Source: ABdhPJwvuNU7fNETFGXKRki8LGh9J9X3JjvJeJr8KA/CryX3oDtGLsr/ecJej4eRH91ApwyyhXsmww== X-Received: by 2002:a63:4f4c:: with SMTP id p12mr23050633pgl.432.1607976221864; Mon, 14 Dec 2020 12:03:41 -0800 (PST) Received: from localhost.localdomain ([163.172.76.58]) by smtp.googlemail.com with ESMTPSA id js9sm22434109pjb.2.2020.12.14.12.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 12:03:41 -0800 (PST) From: Corentin Labbe To: arnd@arndb.de, davem@davemloft.net, herbert@gondor.apana.org.au, jernej.skrabec@siol.net, mripard@kernel.org, wens@csie.org Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH v4 8/8] crypto: sun4i-ss: add SPDX header and remove blank lines Date: Mon, 14 Dec 2020 20:02:32 +0000 Message-Id: <20201214200232.17357-9-clabbe@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201214200232.17357-1-clabbe@baylibre.com> References: <20201214200232.17357-1-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This patchs fixes some remaining style issue. Signed-off-by: Corentin Labbe Signed-off-by: Corentin Labbe --- drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c | 3 --- drivers/crypto/allwinner/sun4i-ss/sun4i-ss-prng.c | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c index d5275d914d09..c2e6f5ed1d79 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c @@ -148,7 +148,6 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq) return err; } - static int noinline_for_stack sun4i_ss_cipher_poll_fallback(struct skcipher_request *areq) { struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); @@ -562,7 +561,6 @@ int sun4i_ss_cipher_init(struct crypto_tfm *tfm) sizeof(struct sun4i_cipher_req_ctx) + crypto_skcipher_reqsize(op->fallback_tfm)); - err = pm_runtime_get_sync(op->ss->dev); if (err < 0) goto error_pm; @@ -649,5 +647,4 @@ int sun4i_ss_des3_setkey(struct crypto_skcipher *tfm, const u8 *key, crypto_skcipher_set_flags(op->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK); return crypto_skcipher_setkey(op->fallback_tfm, key, keylen); - } diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-prng.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-prng.c index 152841076e3a..443160a114bb 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-prng.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-prng.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later #include "sun4i-ss.h" int sun4i_ss_prng_seed(struct crypto_rng *tfm, const u8 *seed,