lkml.org 
[lkml]   [2016]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 1/3] arm64: crypto/aes-ce-ccm: Cleanup hwcap check
Date
Use the module_cpu_feature_match to make sure the system has
HWCAP_AES to use the module.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
arch/arm64/crypto/aes-ce-ccm-glue.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/crypto/aes-ce-ccm-glue.c b/arch/arm64/crypto/aes-ce-ccm-glue.c
index f4bf2f2..fa82eaa 100644
--- a/arch/arm64/crypto/aes-ce-ccm-glue.c
+++ b/arch/arm64/crypto/aes-ce-ccm-glue.c
@@ -14,6 +14,7 @@
#include <crypto/algapi.h>
#include <crypto/scatterwalk.h>
#include <crypto/internal/aead.h>
+#include <linux/cpufeature.h>
#include <linux/module.h>

#include "aes-ce-setkey.h"
@@ -296,8 +297,6 @@ static struct aead_alg ccm_aes_alg = {

static int __init aes_mod_init(void)
{
- if (!(elf_hwcap & HWCAP_AES))
- return -ENODEV;
return crypto_register_aead(&ccm_aes_alg);
}

@@ -306,7 +305,7 @@ static void __exit aes_mod_exit(void)
crypto_unregister_aead(&ccm_aes_alg);
}

-module_init(aes_mod_init);
+module_cpu_feature_match(AES, aes_mod_init);
module_exit(aes_mod_exit);

MODULE_DESCRIPTION("Synchronous AES in CCM mode using ARMv8 Crypto Extensions");
--
2.7.4
\
 
 \ /
  Last update: 2016-10-31 17:05    [W:0.054 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site