All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antoine Tenart <antoine.tenart@free-electrons.com>
To: herbert@gondor.apana.org.au, davem@davemloft.net,
	maxime.ripard@free-electrons.com, wens@csie.org,
	clabbe.montjoie@gmail.com
Cc: Antoine Tenart <antoine.tenart@free-electrons.com>,
	linux-crypto@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 07/12] crypto: sun4i-ss: simplify the appended bit assignment
Date: Mon, 29 May 2017 22:27:33 +0200	[thread overview]
Message-ID: <20170529202738.2167-8-antoine.tenart@free-electrons.com> (raw)
In-Reply-To: <20170529202738.2167-1-antoine.tenart@free-electrons.com>

A bit is appended at the end of the input buffer for sha1. Simplify the
code assigning it.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
index 59d9b4412aca..0c2efc88bc0a 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
@@ -392,12 +392,8 @@ static int sun4i_hash(struct ahash_request *areq)
 	}
 
 	/* write the remaining bytes of the nbw buffer */
-	if (nbw) {
-		wb |= ((1 << 7) << (nbw * 8));
-		bf[j++] = wb;
-	} else {
-		bf[j++] = 1 << 7;
-	}
+	wb |= ((1 << 7) << (nbw * 8));
+	bf[j++] = wb;
 
 	/*
 	 * number of space to pad to obtain 64o minus 8(size) minus 4 (final 1)
-- 
2.9.4

WARNING: multiple messages have this Message-ID (diff)
From: antoine.tenart@free-electrons.com (Antoine Tenart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 07/12] crypto: sun4i-ss: simplify the appended bit assignment
Date: Mon, 29 May 2017 22:27:33 +0200	[thread overview]
Message-ID: <20170529202738.2167-8-antoine.tenart@free-electrons.com> (raw)
In-Reply-To: <20170529202738.2167-1-antoine.tenart@free-electrons.com>

A bit is appended at the end of the input buffer for sha1. Simplify the
code assigning it.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
index 59d9b4412aca..0c2efc88bc0a 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
@@ -392,12 +392,8 @@ static int sun4i_hash(struct ahash_request *areq)
 	}
 
 	/* write the remaining bytes of the nbw buffer */
-	if (nbw) {
-		wb |= ((1 << 7) << (nbw * 8));
-		bf[j++] = wb;
-	} else {
-		bf[j++] = 1 << 7;
-	}
+	wb |= ((1 << 7) << (nbw * 8));
+	bf[j++] = wb;
 
 	/*
 	 * number of space to pad to obtain 64o minus 8(size) minus 4 (final 1)
-- 
2.9.4

  parent reply	other threads:[~2017-05-29 20:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-29 20:27 [PATCH v2 00/12] ARM: sun5i: cryptographic engine support Antoine Tenart
2017-05-29 20:27 ` Antoine Tenart
2017-05-29 20:27 ` [PATCH v2 01/12] crypto: sun4i-ss: group variable definitions in sun4i_hash() Antoine Tenart
2017-05-29 20:27   ` Antoine Tenart
2017-05-29 20:27 ` [PATCH v2 02/12] crypto: sun4i-ss: remove conditional checks against 0 Antoine Tenart
2017-05-29 20:27   ` Antoine Tenart
2017-05-29 20:27 ` [PATCH v2 03/12] crypto: sun4i-ss: use lower/upper_32_bits helpers Antoine Tenart
2017-05-29 20:27   ` Antoine Tenart
2017-05-29 20:27 ` [PATCH v2 04/12] crypto: sun4i-ss: cannot use DMA is the request is 0 length Antoine Tenart
2017-05-29 20:27   ` Antoine Tenart
2017-05-29 20:27 ` [PATCH v2 05/12] crypto: sun4i-ss: do not dynamically set parts of the last buffer to 0 Antoine Tenart
2017-05-29 20:27   ` Antoine Tenart
2017-05-29 20:27 ` [PATCH v2 06/12] crypto: sun4i-ss: simplify the pad length calculation Antoine Tenart
2017-05-29 20:27   ` Antoine Tenart
2017-05-29 20:27 ` Antoine Tenart [this message]
2017-05-29 20:27   ` [PATCH v2 07/12] crypto: sun4i-ss: simplify the appended bit assignment Antoine Tenart
2017-05-29 20:27 ` [PATCH v2 08/12] crypto: sun4i-ss: use GENMASK to generate masks Antoine Tenart
2017-05-29 20:27   ` Antoine Tenart
2017-05-29 20:27 ` [PATCH v2 09/12] crypto: sun4i-ss: move from ablkcipher to skcipher API Antoine Tenart
2017-05-29 20:27   ` Antoine Tenart
2017-05-29 20:27 ` [PATCH v2 10/12] crypto: sun4i-ss: add the CRYPTO_ALG_KERN_DRIVER_ONLY flag Antoine Tenart
2017-05-29 20:27   ` Antoine Tenart
2017-05-29 20:27 ` [PATCH v2 11/12] crypto: sun4i-ss: fix large block size support Antoine Tenart
2017-05-29 20:27   ` Antoine Tenart
2017-05-29 20:27 ` [PATCH v2 12/12] ARM: sun5i: add a cryptographic engine node Antoine Tenart
2017-05-29 20:27   ` Antoine Tenart
2017-05-30  6:48   ` Maxime Ripard
2017-05-30  6:48     ` Maxime Ripard
2017-05-30  6:51     ` Antoine Tenart
2017-05-30  6:51       ` Antoine Tenart
2017-05-30 11:52 ` [PATCH v2 00/12] ARM: sun5i: cryptographic engine support Corentin Labbe
2017-05-30 11:52   ` Corentin Labbe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170529202738.2167-8-antoine.tenart@free-electrons.com \
    --to=antoine.tenart@free-electrons.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.