From mboxrd@z Thu Jan 1 00:00:00 1970 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=-15.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,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 A14A1C43461 for ; Thu, 17 Sep 2020 18:38:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2C95F206D4 for ; Thu, 17 Sep 2020 18:38:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yWlA+ZxL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="Iu747+4n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C95F206D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CnOVV5RBSo5mfnzwx++Pe3kTeZc1Izw4cbw32xCBUts=; b=yWlA+ZxLc2F2Ask/xcpdXXZy4u BRujsN+nNma2KJX5aRRt2QFVF/VhWt2Jqg0velTsvGp8u3bzAjxmzJgMR3Ss+4vXsfqI1eZpMlgJS 5HBY+jiTEgroHetmjG4p9e+BF0fEK6eWj84+2+3IPye8ljbUMNQknE1v8XgYWYq3U16Om7gwig/07 n7u9SyoGEfjjJ5wrNXCnugh+xIj8IwQAjuvLvJJBABWGAkaJuu6gxyyqFqucxlLpnnx/Xs1NKIXGu 2Ujtow9KFeI+WLo2Z1Twn6VOjhd/eVgKiX0Epi0A0RiZ0o1+8uJWqNsEFmhkhulR+m00aME1cLzLp PcjgyH9g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIylh-0006AW-5h; Thu, 17 Sep 2020 18:36:29 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIylP-00064V-48 for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2020 18:36:13 +0000 Received: by mail-wr1-x441.google.com with SMTP id j2so3116351wrx.7 for ; Thu, 17 Sep 2020 11:36:09 -0700 (PDT) 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=jTdlzUzyc1hcRCjE509a2kDcbNHBKMDXHMkrLBJjCcg=; b=Iu747+4nadzvDfyHCyTyuRJhiIU4JEOTx7wcl9fRZmk4C2hj26XLP/pLYoNWCXkNoa jOG8/8qUQh9csSVrxPpXSLZB7w7m2/mkvWFMko8b/zg/Z7ttLd1ZC+hExrJdPx60e0PY DGPFCHfb55pFL94T4GzExTONjciAmVl0VIYj29tldHOgshEBgmTCekX5f9FxIO8xVy93 TQrf1HjVu9cDXHHOMehhlpk8KxDRSZt7TDhRQoq66hjhfqUUWsDJC5vKyCqpCfaCHW+3 JhvQWkL851NyQoea13o8i1gW2piPvOrQirFTd+7HYoZIDSFRTpLgyuneoMGuurVSFMNa nHTg== 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=jTdlzUzyc1hcRCjE509a2kDcbNHBKMDXHMkrLBJjCcg=; b=WcKx+tnG5CighdOYvHnlagGAPwIIDxai3IkG5pPgAGUL0/PsBPu28StaU8BVlY3j0B sPKT4k7sHF2mkzvWjsTijcoYa1J73d7lF2wPvuz0hjP+gByfhVwtZ+8avEGowaidDaO1 vsUFtnYRJUHTUuf2kZjVUOMAEXLfAxGAWCWkeaTK70Wes9mv3jf4LAMU59BulaGhvJ91 TnTEhtuB5+AqccGJuOUq/7f8ekmCNv5p7tbaZPIS84M0z/pcgzFOVQKV/RQM8LV5uUeb 1WRkpzdpwnIJVrUAtddCwnXLIFTTPGUh5j/LkPwgnekq28FZnOb8TKgY2snJw/qKdfO3 jXzw== X-Gm-Message-State: AOAM532bU46XZY6hh005kDq7Rs+ZubIhm5NmCI4+sDyrH4P4d2jcS4/b LNXNhi9DLTAAnPg5kewWn5VS7OobjVNILg== X-Google-Smtp-Source: ABdhPJwPR3kJwirxBvcg7+EKXYc7it131pIcBWGKU+Rwhgt8ETaSOml+RRDdd+wopE0SsNNZADqqUg== X-Received: by 2002:adf:cd0e:: with SMTP id w14mr36379858wrm.0.1600367768639; Thu, 17 Sep 2020 11:36:08 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id x16sm571901wrq.62.2020.09.17.11.36.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2020 11:36:07 -0700 (PDT) From: Corentin Labbe To: arnd@arndb.de, davem@davemloft.net, herbert@gondor.apana.org.au, mripard@kernel.org, wens@csie.org Subject: [PATCH 1/7] crypto: sun4i-ss: linearize buffers content must be kept Date: Thu, 17 Sep 2020 18:35:52 +0000 Message-Id: <1600367758-28589-2-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600367758-28589-1-git-send-email-clabbe@baylibre.com> References: <1600367758-28589-1-git-send-email-clabbe@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200917_143611_168933_ADFD1498 X-CRM114-Status: GOOD ( 15.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corentin Labbe , linux-sunxi@googlegroups.com, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When running the non-optimized cipher function, SS produce partial random output. This is due to linearize buffers being reseted after each loop. Fixes: 8d3bcb9900ca ("crypto: sun4i-ss - reduce stack usage") Signed-off-by: Corentin Labbe --- drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c | 6 ++---- 1 file changed, 2 insertions(+), 4 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..b92d175b5d2a 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c @@ -163,6 +163,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) unsigned int todo; struct sg_mapping_iter mi, mo; unsigned int oi, oo; /* offset for in and out */ + char buf[4 * SS_RX_MAX];/* buffer for linearize SG src */ + char bufo[4 * SS_TX_MAX]; /* buffer for linearize SG dst */ unsigned int ob = 0; /* offset in buf */ unsigned int obo = 0; /* offset in bufo*/ unsigned int obl = 0; /* length of data in bufo */ @@ -233,8 +235,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 @@ -295,8 +295,6 @@ 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 -- 2.26.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel