From patchwork Wed May 6 13:54:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 6349881 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B8CC7BEEE1 for ; Wed, 6 May 2015 13:55:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D886201D3 for ; Wed, 6 May 2015 13:55:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6130E201F4 for ; Wed, 6 May 2015 13:55:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752023AbbEFNzD (ORCPT ); Wed, 6 May 2015 09:55:03 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:37621 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752098AbbEFNzD (ORCPT ); Wed, 6 May 2015 09:55:03 -0400 Received: by widdi4 with SMTP id di4so23410834wid.0 for ; Wed, 06 May 2015 06:55:02 -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:in-reply-to :references; bh=FKu1xSLy3CxV7h/FYqiId5D3snS3lpV7V1MEABcsy2w=; b=MmjFF0X7CRRoJG6PVW5WN5wT8K0ge4aSp7Rkn8+SUFBdVXXvFvyp8cRIBd22SBRXZ5 Gt5DFH6GXFF/qBYMJwOPnjdPlF71DThc7eaZnhuFiltj78upR+9PSVAfu9Vbmv9b/PfL U7yuVhMijcLOM53245g36sU5rPCP8NKwX/X/DYMEhfSXDdK8sIQEfioN1IPa4OWMZe3O LBvViAhqPKd0rVlL9vPSFHtnXIuNeJFaxO6ZHoFBzi++oSMlezCfXDShGtmc17OVlk/B VZ/EUoLRAktLW3t/+DdE2GKk4hvNylIOSN16iHZQl7tns5XkgLbAk253CfNAHrQEEL4c czCA== X-Gm-Message-State: ALoCoQk+0wBPW6O/VR8yMKx+40G86XYqX/P6s+wTo2ZanoxEbcXOZHaFBdYFw0a97zuQRRKXKW2O X-Received: by 10.194.248.132 with SMTP id ym4mr64003929wjc.74.1430920501801; Wed, 06 May 2015 06:55:01 -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.55.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 May 2015 06:55:01 -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 2/2] crypto: arm64/sha2-ce - prevent asm code finalization in final() path Date: Wed, 6 May 2015 15:54:32 +0200 Message-Id: <1430920472-20416-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430920472-20416-1-git-send-email-ard.biesheuvel@linaro.org> References: <1430920472-20416-1-git-send-email-ard.biesheuvel@linaro.org> 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/sha2-ce-glue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/crypto/sha2-ce-glue.c b/arch/arm64/crypto/sha2-ce-glue.c index 1340e44c048b..7cd587564a41 100644 --- a/arch/arm64/crypto/sha2-ce-glue.c +++ b/arch/arm64/crypto/sha2-ce-glue.c @@ -75,6 +75,9 @@ static int sha256_ce_finup(struct shash_desc *desc, const u8 *data, static int sha256_ce_final(struct shash_desc *desc, u8 *out) { + struct sha256_ce_state *sctx = shash_desc_ctx(desc); + + sctx->finalize = 0; kernel_neon_begin_partial(28); sha256_base_do_finalize(desc, (sha256_block_fn *)sha2_ce_transform); kernel_neon_end();