This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 6676853589775b4ed699b08d73d6773cadafc457
Author: makejian <[email protected]>
AuthorDate: Mon Jun 26 19:54:41 2023 +0800

    crypto: add config of software algorithm
    
    software algorithm not used by default and managed by respective config
    Signed-off-by: makejian <[email protected]>
---
 crypto/Kconfig     | 5 +++++
 crypto/cryptodev.c | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/crypto/Kconfig b/crypto/Kconfig
index aafafa763b..583087bd0d 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -40,6 +40,11 @@ config CRYPTO_CRYPTODEV
        depends on ALLOW_BSD_COMPONENTS
        default n
 
+config CRYPTO_CRYPTODEV_SOFTWARE
+       bool "cryptodev software support"
+       depends on CRYPTO_CRYPTODEV
+       default n
+
 config CRYPTO_CRYPTODEV_HARDWARE
        bool "cryptodev hardware support"
        depends on CRYPTO_CRYPTODEV
diff --git a/crypto/cryptodev.c b/crypto/cryptodev.c
index adce436c2a..d993b4681f 100644
--- a/crypto/cryptodev.c
+++ b/crypto/cryptodev.c
@@ -59,9 +59,13 @@ extern FAR struct cryptocap *crypto_drivers;
 extern int crypto_drivers_num;
 int usercrypto = 1;         /* userland may do crypto requests */
 int userasymcrypto = 1;     /* userland may do asymmetric crypto reqs */
+#ifdef CONFIG_CRYPTO_CRYPTODEV_SOFTWARE
 int cryptodevallowsoft = 1; /* 0 is only use hardware crypto
                              * 1 is use hardware & software crypto
                              */
+#else
+int cryptodevallowsoft = 0;
+#endif
 
 /****************************************************************************
  * Private Types
@@ -887,7 +891,10 @@ int csefree(FAR struct csession *cse)
 void devcrypto_register(void)
 {
   register_driver("/dev/crypto", &g_cryptoops, 0666, NULL);
+
+#ifdef CONFIG_CRYPTO_CRYPTODEV_SOFTWARE
   swcr_init();
+#endif
 
 #ifdef CONFIG_CRYPTO_CRYPTODEV_HARDWARE
   hwcr_init();

Reply via email to