linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND] crypto: atmel-aes: use swap()
@ 2021-07-22 17:08 Salah Triki
  2021-07-23  4:24 ` Tudor.Ambarus
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Salah Triki @ 2021-07-22 17:08 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Nicolas Ferre, Alexandre Belloni,
	Ludovic Desroches, gregkh
  Cc: linux-crypto, linux-arm-kernel, linux-kernel

Use swap() instead of implementing it in order to make code more clean.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/crypto/atmel-aes.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index b1d286004295..60041022c4f5 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -1819,12 +1819,8 @@ static int atmel_aes_xts_process_data(struct atmel_aes_dev *dd)
 	 * the order of the ciphered tweak bytes need to be reversed before
 	 * writing them into the ODATARx registers.
 	 */
-	for (i = 0; i < AES_BLOCK_SIZE/2; ++i) {
-		u8 tmp = tweak_bytes[AES_BLOCK_SIZE - 1 - i];
-
-		tweak_bytes[AES_BLOCK_SIZE - 1 - i] = tweak_bytes[i];
-		tweak_bytes[i] = tmp;
-	}
+	for (i = 0; i < AES_BLOCK_SIZE/2; ++i)
+		swap(tweak_bytes[i], tweak_bytes[AES_BLOCK_SIZE - 1 - i]);
 
 	/* Process the data. */
 	atmel_aes_write_ctrl(dd, use_dma, NULL);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RESEND] crypto: atmel-aes: use swap()
  2021-07-22 17:08 [RESEND] crypto: atmel-aes: use swap() Salah Triki
@ 2021-07-23  4:24 ` Tudor.Ambarus
  2021-07-23  4:31 ` Tudor.Ambarus
  2021-07-30  3:11 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Tudor.Ambarus @ 2021-07-23  4:24 UTC (permalink / raw)
  To: salah.triki, herbert, davem, Nicolas.Ferre, alexandre.belloni,
	Ludovic.Desroches, gregkh
  Cc: linux-crypto, linux-arm-kernel, linux-kernel

On 7/22/21 8:08 PM, Salah Triki wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Use swap() instead of implementing it in order to make code more clean.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>

Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>

> ---
>  drivers/crypto/atmel-aes.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
> index b1d286004295..60041022c4f5 100644
> --- a/drivers/crypto/atmel-aes.c
> +++ b/drivers/crypto/atmel-aes.c
> @@ -1819,12 +1819,8 @@ static int atmel_aes_xts_process_data(struct atmel_aes_dev *dd)
>          * the order of the ciphered tweak bytes need to be reversed before
>          * writing them into the ODATARx registers.
>          */
> -       for (i = 0; i < AES_BLOCK_SIZE/2; ++i) {
> -               u8 tmp = tweak_bytes[AES_BLOCK_SIZE - 1 - i];
> -
> -               tweak_bytes[AES_BLOCK_SIZE - 1 - i] = tweak_bytes[i];
> -               tweak_bytes[i] = tmp;
> -       }
> +       for (i = 0; i < AES_BLOCK_SIZE/2; ++i)
> +               swap(tweak_bytes[i], tweak_bytes[AES_BLOCK_SIZE - 1 - i]);
> 
>         /* Process the data. */
>         atmel_aes_write_ctrl(dd, use_dma, NULL);
> --
> 2.25.1
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND] crypto: atmel-aes: use swap()
  2021-07-22 17:08 [RESEND] crypto: atmel-aes: use swap() Salah Triki
  2021-07-23  4:24 ` Tudor.Ambarus
@ 2021-07-23  4:31 ` Tudor.Ambarus
  2021-07-30  3:11 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Tudor.Ambarus @ 2021-07-23  4:31 UTC (permalink / raw)
  To: salah.triki, herbert, davem, Nicolas.Ferre, alexandre.belloni,
	Ludovic.Desroches, gregkh
  Cc: linux-crypto, linux-arm-kernel, linux-kernel

On 7/22/21 8:08 PM, Salah Triki wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Use swap() instead of implementing it in order to make code more clean.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
>  drivers/crypto/atmel-aes.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
> index b1d286004295..60041022c4f5 100644
> --- a/drivers/crypto/atmel-aes.c
> +++ b/drivers/crypto/atmel-aes.c
> @@ -1819,12 +1819,8 @@ static int atmel_aes_xts_process_data(struct atmel_aes_dev *dd)
>          * the order of the ciphered tweak bytes need to be reversed before
>          * writing them into the ODATARx registers.
>          */
> -       for (i = 0; i < AES_BLOCK_SIZE/2; ++i) {
> -               u8 tmp = tweak_bytes[AES_BLOCK_SIZE - 1 - i];
> -
> -               tweak_bytes[AES_BLOCK_SIZE - 1 - i] = tweak_bytes[i];
> -               tweak_bytes[i] = tmp;
> -       }
> +       for (i = 0; i < AES_BLOCK_SIZE/2; ++i)

There could have been spaces around that '/', but I see it was kept as it was
before. It's fine either way.
 
> +               swap(tweak_bytes[i], tweak_bytes[AES_BLOCK_SIZE - 1 - i]);
> 
>         /* Process the data. */
>         atmel_aes_write_ctrl(dd, use_dma, NULL);
> --
> 2.25.1
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RESEND] crypto: atmel-aes: use swap()
  2021-07-22 17:08 [RESEND] crypto: atmel-aes: use swap() Salah Triki
  2021-07-23  4:24 ` Tudor.Ambarus
  2021-07-23  4:31 ` Tudor.Ambarus
@ 2021-07-30  3:11 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2021-07-30  3:11 UTC (permalink / raw)
  To: Salah Triki
  Cc: David S. Miller, Nicolas Ferre, Alexandre Belloni,
	Ludovic Desroches, gregkh, linux-crypto, linux-arm-kernel,
	linux-kernel

On Thu, Jul 22, 2021 at 06:08:27PM +0100, Salah Triki wrote:
> Use swap() instead of implementing it in order to make code more clean.
> 
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
>  drivers/crypto/atmel-aes.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-30  3:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 17:08 [RESEND] crypto: atmel-aes: use swap() Salah Triki
2021-07-23  4:24 ` Tudor.Ambarus
2021-07-23  4:31 ` Tudor.Ambarus
2021-07-30  3:11 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).