lkml.org 
[lkml]   [2021]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RESEND] crypto: atmel-aes: use swap()
Date
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
>

\
 
 \ /
  Last update: 2021-07-23 06:32    [W:0.425 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site