From patchwork Wed May 6 13:54:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 6349871 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3E0629F1C2 for ; Wed, 6 May 2015 13:55:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5ED1C201F2 for ; Wed, 6 May 2015 13:55:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 33257201ED for ; Wed, 6 May 2015 13:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751554AbbEFNzD (ORCPT ); Wed, 6 May 2015 09:55:03 -0400 Received: from mail-wg0-f50.google.com ([74.125.82.50]:32871 "EHLO mail-wg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752018AbbEFNzB (ORCPT ); Wed, 6 May 2015 09:55:01 -0400 Received: by wgin8 with SMTP id n8so12556699wgi.0 for ; Wed, 06 May 2015 06:55:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZQeflUzpWD9GFlT4u2XaigTyJoF8ailyh6vWf+2F6ek=; b=hQtfT8wOdJb0foVjgTUB/xLsm+Of5Tx4rtenvmPbB84ptHQIevx/Cn2mc37qjzTsYv ZfCnlcN81dwJGh2X21mFPPIDoh6C4v/ZWkDcyQj5kznIP+fVlePUVjldo+U6eF7B0seM aIQaR5FfoeW+3k0Xk+Yu0a4p2QQFGhZ6BtkviNNjPD8pboget/YiGzjbIJ4PZI0I+Wph koKjvByyFPccRIAit0VAze3PJrM/Fp+4UIVMi0tlb5SP3By5qNZvC4isy9nhGWvl8iXa qrCelx0rUerTMDSJ8NhGNXFyxWK3buTZbzML3DoYDh/9pW7wAteuvLGGgfdAFtPGiK+Z xwfw== X-Gm-Message-State: ALoCoQnK/jqvGWCtQ0rjXk/iegt192ZtX5ErBk0j9bT4zXy182fM6+XBQ2avagsAx27N+SOgfvio X-Received: by 10.195.18.103 with SMTP id gl7mr60488584wjd.34.1430920500279; Wed, 06 May 2015 06:55:00 -0700 (PDT) Received: from localhost.localdomain (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id nb9sm2306564wic.10.2015.05.06.06.54.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 May 2015 06:54:59 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH bugfix 1/2] crypto: arm64/sha1-ce - prevent asm code finalization in final() path Date: Wed, 6 May 2015 15:54:31 +0200 Message-Id: <1430920472-20416-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ensure that the asm code finalization path is not triggered when invoked via final(), since it already takes care of that itself. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/sha1-ce-glue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/crypto/sha1-ce-glue.c b/arch/arm64/crypto/sha1-ce-glue.c index 114e7cc5de8c..aefda9868627 100644 --- a/arch/arm64/crypto/sha1-ce-glue.c +++ b/arch/arm64/crypto/sha1-ce-glue.c @@ -74,6 +74,9 @@ static int sha1_ce_finup(struct shash_desc *desc, const u8 *data, static int sha1_ce_final(struct shash_desc *desc, u8 *out) { + struct sha1_ce_state *sctx = shash_desc_ctx(desc); + + sctx->finalize = 0; kernel_neon_begin_partial(16); sha1_base_do_finalize(desc, (sha1_block_fn *)sha1_ce_transform); kernel_neon_end();