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: 10559197 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 062771390 for ; Tue, 7 Aug 2018 21:19:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8EC02A5F7 for ; Tue, 7 Aug 2018 21:19:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCC132A5FB; Tue, 7 Aug 2018 21:19:00 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8F2192A5F7 for ; Tue, 7 Aug 2018 21:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=P6KcOfK0n11P+oZjBe8p0oUDQe0C1HZ6O2uwSuT9LVM=; b=pie xdwLcwhqZg4bDTCImzeZBDP281sQMFjTSGmm3YaEkAE9slJKGN2BCBzCXzYky0gcp1l3UWjMtMCpI +O3GtPivbnkvTgDuIgZnQH2qeIcg6XQgFm8N/LZ1SjDkIsBVy3bgvfnyas4uhMrCTJgh/qRpBKDEf tvmsfbd1bYyMuTrtgAk7evtdPx/+90D3d6ptp+w05Caep8pDdYVh0q6Cej7cBRY89wApgVOEq/5cH zZSDoS6zhumYm2xe2fyDwtjGpeFuqipm9PCA9Fjlkm0e4BuCvWQfeCuMJPrEW6xfZz4Js9HocItTj G2Tl1e544TiZOFs1gZTSBj+Os84F1UA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fn9NX-0002Np-Vs; Tue, 07 Aug 2018 21:18:55 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fn9NT-0002Lh-Sj for linux-arm-kernel@lists.infradead.org; Tue, 07 Aug 2018 21:18:53 +0000 Received: by mail-ed1-x543.google.com with SMTP id s24-v6so257351edr.8 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=JLfHhg1OmMaN9qhDociAlhKRaM5ZJArMbp801Lmcrs4rUuKRp3WXiQ4r6UEY9QXgnm 8uejb/lrDOH9VD1e6QmDmhwbf8zyRIRXcrX0iDBl1SjBEDYgEaARPuDXAjSUdr+zcnfv AqcpxeM+B0S132lGKF6R+VqJkuXitQ1kce/ZXnRRaU5JcCFugH/9swofexQ4WMUDAexv 2kvonQbCHyDvzHIdLWANbxNMJUdyzULi4BvI3U92L616/3GW8rS8lh5dJ+hKbptfJV0h p/Nyq/jPN099zK5u1IIShcsc95QFyhvHZXGZ5/HE/Kmsh33SdenAtoW4eCnK2Y15xb3o DMyw== X-Gm-Message-State: AOUpUlEjVB3H5WlSZ8iUgRp29eFa5FD6AT8FMgbgdTpVM58O9WDItR+4 NiKNQf39QhqtOglu2qlpMIJJ4Q== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180807_141852_152616_E85DEA51 X-CRM114-Status: GOOD ( 13.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: herbert@gondor.apana.org.au, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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);