From patchwork Tue Aug 7 21:18:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10559185 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 C03761390 for ; Tue, 7 Aug 2018 21:18:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B19322A5F1 for ; Tue, 7 Aug 2018 21:18:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A590E2A5F9; Tue, 7 Aug 2018 21:18:43 +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,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 5ABE22A5F1 for ; Tue, 7 Aug 2018 21:18:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726521AbeHGXfA (ORCPT ); Tue, 7 Aug 2018 19:35:00 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:44468 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726414AbeHGXfA (ORCPT ); Tue, 7 Aug 2018 19:35:00 -0400 Received: by mail-ed1-f67.google.com with SMTP id f23-v6so246706edr.11 for ; Tue, 07 Aug 2018 14:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=vzgLFq91yHGGujgj15OKqco7J+iWGXLuqBP2jim9Ro4=; b=gSfMqS3EumokkmKcv2vLwWt52RdW9P1xCyUL3c1H6oDn4nrPgvximsrf5l1EEjsEXD Knrid82lGYFYTw0ifHxd74F9048nXbrel1hedcpCj7ArUopka8QY6Zx62DCRI/6i9If2 SZzRYv3G7Vzaj0iuhgQGKvzrX/1Zi0q6THdWI= 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=vzgLFq91yHGGujgj15OKqco7J+iWGXLuqBP2jim9Ro4=; b=q4x300N2KrY4nFrfifWU4cIlkf2W6Q3GMiSsyUhomTc5YKNoECuqkekzHm0Ht6eG+C 2eLfBzgmUjWZuLL4ldzPdosRRZKJF0tvZ6KR9saaV+Nojo0oK7f3Dk71YJG8tJYP3RLc Och4xid5JRwPPmrd/PvNnv3HaUULhTBRtlJjN5GMKOF1RPrTks2t7dFzFRuTtSNUeldZ Rg888+4Qc8uq5T+IX8krRSyGnTVxnVpPvE1MpkX/0T9xhQablGBnwXBe7rk7I40OPi4I IlBgVrfRTgXMgBkQvt7hKuabRUDlHJ8RrDd7F/g1sbscBtp+6oV2vhyEzlj25192f/pQ +Z7A== X-Gm-Message-State: AOUpUlFq+ievA0pdWE46iwOWUN4XuHSjjLMQYyrmTcKxF8zE4tsm35Lc FDX0KtErPkCEzrKTL6TRf9ykzgi/MO8= X-Google-Smtp-Source: AA+uWPyL7u6HiTSD4pbkkTElUyqtToY/IXbctSrSrULJRMJ/2HqouPvgBlZIQkfiq8IAPhc7OsqNyg== X-Received: by 2002:a50:ed09:: with SMTP id j9-v6mr108504eds.28.1533676720158; Tue, 07 Aug 2018 14:18:40 -0700 (PDT) Received: from rev02.home (b80182.upc-b.chello.nl. [212.83.80.182]) by smtp.gmail.com with ESMTPSA id g14-v6sm1015891edm.25.2018.08.07.14.18.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Aug 2018 14:18:39 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH] crypto: arm64/sm4-ce - check for the right CPU feature bit Date: Tue, 7 Aug 2018 23:18:36 +0200 Message-Id: <20180807211836.9899-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.18.0 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 ARMv8.2 specifies special instructions for the SM3 cryptographic hash and the SM4 symmetric cipher. While it is unlikely that a core would implement one and not the other, we should only use SM4 instructions if the SM4 CPU feature bit is set, and we currently check the SM3 feature bit instead. So fix that. Signed-off-by: Ard Biesheuvel --- It would be good to get this backported to -stable but there is no need to merge this as a fix at -rc8 arch/arm64/crypto/sm4-ce-glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/crypto/sm4-ce-glue.c b/arch/arm64/crypto/sm4-ce-glue.c index b7fb5274b250..0c4fc223f225 100644 --- a/arch/arm64/crypto/sm4-ce-glue.c +++ b/arch/arm64/crypto/sm4-ce-glue.c @@ -69,5 +69,5 @@ static void __exit sm4_ce_mod_fini(void) crypto_unregister_alg(&sm4_ce_alg); } -module_cpu_feature_match(SM3, sm4_ce_mod_init); +module_cpu_feature_match(SM4, sm4_ce_mod_init); module_exit(sm4_ce_mod_fini);