From patchwork Mon Jul 23 16:57:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10540615 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 61120112B for ; Mon, 23 Jul 2018 16:58:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E93828B06 for ; Mon, 23 Jul 2018 16:58:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4078A28B7A; Mon, 23 Jul 2018 16:58:14 +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 CFD6C28B06 for ; Mon, 23 Jul 2018 16:58:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388236AbeGWSAT (ORCPT ); Mon, 23 Jul 2018 14:00:19 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:36289 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388686AbeGWSAT (ORCPT ); Mon, 23 Jul 2018 14:00:19 -0400 Received: by mail-pg1-f195.google.com with SMTP id s7-v6so807263pgv.3 for ; Mon, 23 Jul 2018 09:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=pss/QWhKX3isWNLtULcAcGWn2YSDiez/dtNsPdc0csU=; b=DvWBTdA3lV7PDRsfYcNn05nsye9vHxvqwgD38hpcQgZapsJsbziRCu/weR462I1NtE 0IeQeJlcnbzRNLc5aEQn9n2s5jgqLf8/3tG/tSbxfWy1BxMWQn407zp7YWbUeuajd4Md LxLINpwlKopw/TM0ZBbgcfcDKdfLla/LvznbosMYe+wk51mUxTRnigZBBcNluveNG9mA GEt4UOCPygeVc1b4wOF10MbBPxZgKvip+Ju9VOW3QBrL8NlAqMSXdvAjByiBblc3Is2B 6tx1q6fNKeSlxybp7wCC5J6VJoHFzVuuAz3uThcdhBLXpc/aoDlvWdPx4Dwe9xraEhFW Tteg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=pss/QWhKX3isWNLtULcAcGWn2YSDiez/dtNsPdc0csU=; b=qBuVHE5dXMg15OolmUOL581TRo7E3SbVmajvW0pDAyRBhB0jGtI/6rTkuDrBovF6vS g0VLk+89vQM6/2whkRKRk4CW1LYEs6tW2Kj8uw08Iko3vCzmZp1uqRpRaaVg0Xo1VSoh dPrBhsYhV93Bqw9WWHeQhlOuLMUdcAZ5ZJYfgOETV7ESr1Tv1nHmN0pFQsIBxe0OzPOv EAp3VkKyxf6XA1dDxjyrMgoINbamWmXE1YBmM1+zFb81DpqL15J1Y5fm4pKWzTpYSbzk KahL5cQYvJeKJS3kSXE6KE7qzPIF+t5DwciT2Jbvj4chrpeabYxiJvb/4aDzLkUwy9DR 3AkQ== X-Gm-Message-State: AOUpUlEepH1YlwV5aNlP4cnySLBdHOGAW/7Iuwv3kmvurPRvZ8IbuHCo CLBJmB3Lr63odKiSos9sAspomcFn X-Google-Smtp-Source: AAOMgpfuqi0kfrBbc7XB5Nk+4UayN+6gZQ7ldIIBcYC3zDKVKOg6ahBcsogksTtaP3+rLJpVsnR28A== X-Received: by 2002:a62:c4c3:: with SMTP id h64-v6mr13942089pfk.39.1532365092088; Mon, 23 Jul 2018 09:58:12 -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 u17-v6sm24776289pfa.176.2018.07.23.09.58.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 09:58:11 -0700 (PDT) From: Eric Biggers To: linux-crypto@vger.kernel.org, Herbert Xu Subject: [PATCH] crypto: skcipher - fix aligning block size in skcipher_copy_iv() Date: Mon, 23 Jul 2018 09:57:50 -0700 Message-Id: <20180723165750.77060-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 The ALIGN() macro needs to be passed the alignment, not the alignmask (which is the alignment minus 1). Fixes: b286d8b1a690 ("crypto: skcipher - Add skcipher walk interface") Cc: # v4.10+ Signed-off-by: Eric Biggers --- crypto/skcipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/skcipher.c b/crypto/skcipher.c index 7d6a49fe3047..4f6b8dadaceb 100644 --- a/crypto/skcipher.c +++ b/crypto/skcipher.c @@ -398,7 +398,7 @@ static int skcipher_copy_iv(struct skcipher_walk *walk) unsigned size; u8 *iv; - aligned_bs = ALIGN(bs, alignmask); + aligned_bs = ALIGN(bs, alignmask + 1); /* Minimum size to align buffer by alignmask. */ size = alignmask & ~a;