diff mbox series

crypto: arm64/sm4-ce - check for the right CPU feature bit

Message ID 20180807211836.9899-1-ard.biesheuvel@linaro.org (mailing list archive)
State New, archived
Headers show
Series crypto: arm64/sm4-ce - check for the right CPU feature bit | expand

Commit Message

Ard Biesheuvel Aug. 7, 2018, 9:18 p.m. UTC
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 <ard.biesheuvel@linaro.org>
---
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(-)

Comments

Herbert Xu Aug. 25, 2018, 1:27 p.m. UTC | #1
On Tue, Aug 07, 2018 at 11:18:36PM +0200, Ard Biesheuvel wrote:
> 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 <ard.biesheuvel@linaro.org>

Patch applied.  Thanks.
diff mbox series

Patch

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);