Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3499938pxv; Mon, 12 Jul 2021 19:38:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZ8mMDBai4vVUP3j9XBgyta5yFxrf8zMjxEksINoE0//KIkuEOhMdx6rom1bYak6i4+J+w X-Received: by 2002:a05:6e02:12a6:: with SMTP id f6mr1228448ilr.123.1626143939051; Mon, 12 Jul 2021 19:38:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626143939; cv=none; d=google.com; s=arc-20160816; b=pVn09SZOtzGpzdRlPheDxiLy5KEEOPXH7cjWuqNG2Xp7wteAb24iJdn4cwUfyuyru8 eusbP16IGdzKq9To28yc0OoC0pi2M2w9sbrrEFvP2G+wDPaqugb9H7uApO42WN0iiYNS 662gyI0fYVluuBwa7NS24Qmyce4QOecc8pyFQyrg/wFu1Pl7Cv0/+kOUE9Tq7P5cTtEH ftOkcqdvDqB+a0yv32RjwBWJ+g2ptHu6ttGQhrPzZF+Qse7xrd1hLkYURFG/61Agqgse yw41mWo6guyYt9Hz/FDxo3eu5DqHWEmG4GGjRrJtZOJ1n/QbZf2We7Y8xp+Ef/yFRzUS cqSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=BM24k6H9LcY/dUUeA4LE+RhfS6GQmXK+4XERxfAvlv0=; b=pEknl54vkiOZm0tcRdwjyPOFKW3QWC1BWhsHhcEQEkL3xCjxaEJyjXMcHKZmWBsDSj LT8Y8/lTQg4H4ZDb09I1iQBWic6EBHkx1V7SwfIwtHRbG2ahPzWrI3VlzQNpWcYMXAT1 uH9ZjpcsJ9bkdMrkIM1BfT9AeeIhLda3CiTPet2H9A6gZ8r6vVcLGAaCbfMWJ/h4ZWe8 NIjdpmeOgrlmh3pZBd6SfY3VOo2N1qvgqo/glgP/r3759aB7yN0kkE1/wyGHjGEVdXcU IGCrhRdQVlGfPcWvGYd5uja9ZMOlVS+1AIz1zYqmiFsCSJQEquAVAAXZdYyrXgiGIYB1 sI4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oR2mglMx; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o7si3822047ilc.64.2021.07.12.19.38.36; Mon, 12 Jul 2021 19:38:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oR2mglMx; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230105AbhGMClY (ORCPT + 99 others); Mon, 12 Jul 2021 22:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbhGMClY (ORCPT ); Mon, 12 Jul 2021 22:41:24 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80A4CC0613DD; Mon, 12 Jul 2021 19:38:34 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id h2so31003771edt.3; Mon, 12 Jul 2021 19:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=BM24k6H9LcY/dUUeA4LE+RhfS6GQmXK+4XERxfAvlv0=; b=oR2mglMxlqz8UVA4bDS/Vy20tMYeUdc0P45H4Di/KhCpwZEd0TIR4lhe1TtNTEnHYr Tm0C56cv0awj95FPRIVu7se2mMU/rSAEHmqocxvlyh5syHrXTEfLeWjeZgkb81XTlM85 f9rK5ozXdDb/YJ6gh6HfN7xzzeAA+YYi6unlpvTknjVk034tFMpmtX4ZWbpLf8QcoJw3 pt8YKgfC9IKMqQ3P545piuKy4BMbP3JrBaUmx1Ux4xkhqoDm9A6LnhKRNXyAMhfti6Wd 2krhkIlXRR7oF9S6NvNlWrnxLRDJ/ncZLkLv+te0RSFmKSjEa4iwTLGdi/FAIKaayeRb 9HHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=BM24k6H9LcY/dUUeA4LE+RhfS6GQmXK+4XERxfAvlv0=; b=cTnTmGy1oneZSLTbTcNjYhmf0O09By//+jwkdRZcIBSHdYAY49gSg9uB8XfxiCeGwf u8hDWFDtKKLk7BjuZGHXTImwF302F1LIEahRtIClY8CzWU5pAlrz1x4YJBiBzLDSb5Ra YjuNm0UOyb5fjPy2+19gRJsRrsW8VxgbB7YcbOwu6S2RPt0Z9+/tmW8PAaYZrqAVlq5O npqq4NucDsC8af5qZRNABWVWVDvagkcMsclkpjgYNPgPW6/uiL1fjbzzlZ1S/Txnj12S EBtmeJmd2wc7fc52nD0znpO420Zi06XsXmk/tP+n+9K7aGH29oM46clRq2EP7DoHW7Ws qPAA== X-Gm-Message-State: AOAM533r4XzuxqahcDtja7myXGwTZJJSLnqkrFlUSNWjCCQ3X+JDBxmJ hFv4FRl8xL8GljAh82oym7U= X-Received: by 2002:a05:6402:90a:: with SMTP id g10mr2427996edz.365.1626143913168; Mon, 12 Jul 2021 19:38:33 -0700 (PDT) Received: from pc ([196.235.212.194]) by smtp.gmail.com with ESMTPSA id n13sm7300744ejk.97.2021.07.12.19.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 19:38:32 -0700 (PDT) Date: Tue, 13 Jul 2021 03:38:28 +0100 From: Salah Triki To: herbert@gondor.apana.org.au, davem@davemloft.net, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, ludovic.desroches@microchip.com Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] use swap() Message-ID: <20210713023828.GA1841817@pc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Use swap() instead of implementing it in order to make code more clean. Signed-off-by: Salah Triki --- 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