crypto: add config of software algorithm

software algorithm not used by default and managed by respective config
Signed-off-by: makejian <makejian@xiaomi.com>
This commit is contained in:
makejian 2023-06-26 19:54:41 +08:00 committed by Xiang Xiao
parent 9dabcf9ad2
commit 6676853589
2 changed files with 12 additions and 0 deletions

View file

@ -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

View file

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