问题背景
加载内核算法自检模块tcrypt.ko时出现问题
root@localhost:/boot/modules/5.10.35-rt39-dirty/kernel/crypto# modprobe tcrypt
modprobe: ERROR: could not insert 'tcrypt': Resource temporarily unavailable
查看有该驱动:
在百度上没搜到这个问题,在谷歌上找到了一点线索,是因为tcrypt作为内核加密模块中的算法检测模块时,需要在menuconfig中设置允许算法自检。
步骤
查看使用的内核
$ uname -a
Linux root 5.4.0-104-generic #118-Ubuntu SMP Wed Mar 2 19:02:41 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
修改内核配置
vim /usr/src/linux-headers-5.4.0-104-generic/.config
修改为CONFIG_CRYPTO_TEST=m
修改文本菜单make menuconfig
说明:未安装ncurses需要yum -y install ncurses-devel
Device Drivers --->
Character devices --->
<*> Hardware Random Number Generator Core support 查看是否勾选Cryptographic API --->
< * > Cryptographic algorithm manager
[ ] Disable run-time self tests
< M > Testing module
< * > Sequence Number IV Generator
*** Block modes ***
< * > CBC support
< * > CTR support
< * > ECB support
< * > HMAC support
< * > MD5 digest algorithm
< * > SHA1 digest algorithm
< * > SHA224 and SHA256 digest algorithm
< * > AES cipher algorithms
< * > DES and Triple DES EDE cipher algorithms6.# [*] Hardware crypto devices ---> 如有硬件算法加速需勾选相关选项
< > Support for Intel® C62X
[ ] Support for AMD Cryptographic Coprocessor
保存
退出回到主配置屏幕,最后退出配置实用程序。当询问是否保存新配置时,请选择是。该实用程序将指示已写入.config的配置。
使用新配置重建内核
make -j8
make modules -j8 //内核模块编译
make modules_install //安装内核模块,将内核模块安装到相应的目录中。
make install //安装内核
probe
modprobe tcrypt mode=1000 //检查可用算法
modprobe tcrypt sec=2 mode=402 //异步md5测试速度,每个测试时长2s