From patchwork Mon Jul 23 17:01:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10540625 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F4B6112B for ; Mon, 23 Jul 2018 17:03:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77B2328CAA for ; Mon, 23 Jul 2018 17:03:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B17928CC4; Mon, 23 Jul 2018 17:03:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0300128CAA for ; Mon, 23 Jul 2018 17:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388580AbeGWSFf (ORCPT ); Mon, 23 Jul 2018 14:05:35 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:46024 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388357AbeGWSFf (ORCPT ); Mon, 23 Jul 2018 14:05:35 -0400 Received: by mail-pl0-f68.google.com with SMTP id j8-v6so419156pll.12 for ; Mon, 23 Jul 2018 10:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=OWA/RLz/VKPzeXJjViXi7BkemKRxnXtbsLFlXAjjzv8=; b=a9PWsbRuuCf1Ich/52kX0t9zUarl1eZ9hS4ZeRxU9lfgBlGTLwiijfUJBq0NkTYjA3 /IL3H2LNQBAJj0r86nb5jwx9fRpz2UO2gy8NFzibsogU2QrSm/AEcr35TrRyDleSg9P+ G629Kk9fMUfRiJLhaTqsQM/1z3djbyuYPBJI1NfJfdgsrm6UTkdA5HP3ZRJ12KUbcOOT s7EljT/CqHEZMFqnGxOopEi+Nc7vjdTyqv3yzWBMa3mFs4GXJiqgjItKrpdb6Tv9AzD1 INWdgftI4RT8rlAGaN1A1kqMiJCnA+b0UPPNVKhfgxWJ3gUPf4j3aKomqypphJ7qHl4J KO3A== 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; bh=OWA/RLz/VKPzeXJjViXi7BkemKRxnXtbsLFlXAjjzv8=; b=mAnGrTEP0iymQqnobcX2NrA87pIEw/yZqnj2mPJnbFxtK3Kx3LqaUMvVbu83MJSaRv kPNjCaPeUTdI83bA5dFFR9YrcUFyev9aWbbfWdHU9AOSie0pFwAK0bYrHYT+OTaD6t8k YZJELiQpcXNVfuyIBF1WIaLajkbJu90vZ8Se7pTQoub2mNejeC5GkESdyYVSRB0bbnvH 1cd+uJsf4elhEajEHD12S5Hcrs0O9OIiTgzwtitkpblr8gSvrNy5Q1aaI7ua8/4IJtU1 07L4HuK1VA3aeGPV9qtewsxm2saX45uDwIo8coF2vR+1Cu9fbjywfb1zmNK3g+ZvD57j RobA== X-Gm-Message-State: AOUpUlG/k6NJkr1P67eq5K47MOaXlGAOKS5kUzePprWuGLk0iTYdTG38 HLcoAw30/3c1yuPrsEdrheH9wiuO X-Google-Smtp-Source: AAOMgpeT4qCKYxDKnKUGCGgJ/tsFw8qp8CmIrMHZp9bCL01CCqbyEZwBH8hWpVBjalEVGekd2PShEA== X-Received: by 2002:a17:902:209:: with SMTP id 9-v6mr13777836plc.270.1532365406241; Mon, 23 Jul 2018 10:03:26 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([2620:15c:17:3:dc28:5c82:b905:e8a8]) by smtp.gmail.com with ESMTPSA id 13-v6sm13740409pfw.131.2018.07.23.10.03.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 10:03:25 -0700 (PDT) From: Eric Biggers To: linux-crypto@vger.kernel.org, Herbert Xu Cc: Eric Biggers Subject: [PATCH] crypto: scatterwalk - remove 'chain' argument from scatterwalk_crypto_chain() Date: Mon, 23 Jul 2018 10:01:33 -0700 Message-Id: <20180723170133.80436-1-ebiggers3@gmail.com> X-Mailer: git-send-email 2.18.0.233.g985f88cf7e-goog Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers All callers pass chain=0 to scatterwalk_crypto_chain(). Remove this unneeded parameter. Signed-off-by: Eric Biggers --- crypto/lrw.c | 4 ++-- crypto/scatterwalk.c | 2 +- crypto/xts.c | 4 ++-- include/crypto/scatterwalk.h | 8 +------- net/tls/tls_device_fallback.c | 2 +- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/crypto/lrw.c b/crypto/lrw.c index 954a7064a179..393a782679c7 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c @@ -188,7 +188,7 @@ static int post_crypt(struct skcipher_request *req) if (rctx->dst != sg) { rctx->dst[0] = *sg; sg_unmark_end(rctx->dst); - scatterwalk_crypto_chain(rctx->dst, sg_next(sg), 0, 2); + scatterwalk_crypto_chain(rctx->dst, sg_next(sg), 2); } rctx->dst[0].length -= offset - sg->offset; rctx->dst[0].offset = offset; @@ -265,7 +265,7 @@ static int pre_crypt(struct skcipher_request *req) if (rctx->src != sg) { rctx->src[0] = *sg; sg_unmark_end(rctx->src); - scatterwalk_crypto_chain(rctx->src, sg_next(sg), 0, 2); + scatterwalk_crypto_chain(rctx->src, sg_next(sg), 2); } rctx->src[0].length -= offset - sg->offset; rctx->src[0].offset = offset; diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c index c16c94f88733..d0b92c1cd6e9 100644 --- a/crypto/scatterwalk.c +++ b/crypto/scatterwalk.c @@ -91,7 +91,7 @@ struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2], sg_init_table(dst, 2); sg_set_page(dst, sg_page(src), src->length - len, src->offset + len); - scatterwalk_crypto_chain(dst, sg_next(src), 0, 2); + scatterwalk_crypto_chain(dst, sg_next(src), 2); return dst; } diff --git a/crypto/xts.c b/crypto/xts.c index 12284183bd20..ccf55fbb8bc2 100644 --- a/crypto/xts.c +++ b/crypto/xts.c @@ -138,7 +138,7 @@ static int post_crypt(struct skcipher_request *req) if (rctx->dst != sg) { rctx->dst[0] = *sg; sg_unmark_end(rctx->dst); - scatterwalk_crypto_chain(rctx->dst, sg_next(sg), 0, 2); + scatterwalk_crypto_chain(rctx->dst, sg_next(sg), 2); } rctx->dst[0].length -= offset - sg->offset; rctx->dst[0].offset = offset; @@ -204,7 +204,7 @@ static int pre_crypt(struct skcipher_request *req) if (rctx->src != sg) { rctx->src[0] = *sg; sg_unmark_end(rctx->src); - scatterwalk_crypto_chain(rctx->src, sg_next(sg), 0, 2); + scatterwalk_crypto_chain(rctx->src, sg_next(sg), 2); } rctx->src[0].length -= offset - sg->offset; rctx->src[0].offset = offset; diff --git a/include/crypto/scatterwalk.h b/include/crypto/scatterwalk.h index 880e6be9e95e..eac72840a7d2 100644 --- a/include/crypto/scatterwalk.h +++ b/include/crypto/scatterwalk.h @@ -22,14 +22,8 @@ #include static inline void scatterwalk_crypto_chain(struct scatterlist *head, - struct scatterlist *sg, - int chain, int num) + struct scatterlist *sg, int num) { - if (chain) { - head->length += sg->length; - sg = sg_next(sg); - } - if (sg) sg_chain(head, num, sg); else diff --git a/net/tls/tls_device_fallback.c b/net/tls/tls_device_fallback.c index 748914abdb60..4e1ec12bc0fb 100644 --- a/net/tls/tls_device_fallback.c +++ b/net/tls/tls_device_fallback.c @@ -42,7 +42,7 @@ static void chain_to_walk(struct scatterlist *sg, struct scatter_walk *walk) sg_set_page(sg, sg_page(src), src->length - diff, walk->offset); - scatterwalk_crypto_chain(sg, sg_next(src), 0, 2); + scatterwalk_crypto_chain(sg, sg_next(src), 2); } static int tls_enc_record(struct aead_request *aead_req,