内核算法自检模块tcrypt的加载流程

纯原创哈,在使用内核目录加密模块下的tcrypt.c时遇到了如下问题。

modprobe: ERROR: could not insert 'tcrypt': Resource temporarily unavailable

百度上完全找不到答案,在谷歌时找到了一点线索~

下面是我的加载流程:
1.进入默认内核目录下(例:/usr/src/kernels/linux-4.9.25.arm64.1.b2.06/

2.修改CONFIG_CRYPTO_TEST相关选项 ①vi .config ②/CONFIG_CRYPTO_TEST
③修改为CONFIG_CRYPTO_TEST=m

3.进入文本菜单make menuconfig
(未安装ncurses需要yum -y install ncurses-devel

  1. Device Drivers —>
    Character devices —>
    <*> Hardware Random Number Generator Core support 查看是否勾选

  2. — 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 algorithms

6.# [*] Hardware crypto devices —> 如有硬件算法加速需勾选相关选项
< > Support for Intel® C62X
[ ] Support for AMD Cryptographic Coprocessor

7.退出回到主配置屏幕,最后退出配置实用程序。当询问是否保存新配置时,请选择是。该实用程序将指示已写入.config的配置。

8.接下来,使用新配置重建内核。
make -j8
make modules -j8 //内核模块编译
make modules_install //安装内核模块,将内核模块安装到相应的目录中。
make install //安装内核

9.modprobe tcrypt mode=1000 //检查可用算法
modprobe tcrypt sec=2 mode=402 //异步md5测试速度,每个测试时长2s
200—206是密码速度测试
300—318是同步哈希速度测试
400—417是异步哈希速度测试

10.通过dmesg查看结果
11.

testing speed of async md5 (md5-generic) //异步md5测试速度:
test  0 (   16 byte blocks,   16 bytes per update,   1 updates):  89133 opers/sec,   1426136 bytes/sec
test  1 (   64 byte blocks,   16 bytes per update,   4 updates):  54745 opers/sec,   3503680 bytes/sec
test  2 (   64 byte blocks,   64 bytes per update,   1 updates):  66364 opers/sec,   4247296 bytes/sec
test  3 (  256 byte blocks,   16 bytes per update,  16 updates):  32564 opers/sec,   8336512 bytes/sec
test  4 (  256 byte blocks,   64 bytes per update,   4 updates):  39010 opers/sec,   9986688 bytes/sec
test  5 (  256 byte blocks,  256 bytes per update,   1 updates):  40957 opers/sec,  10484992 bytes/sec
test  6 ( 1024 byte blocks,   16 bytes per update,  64 updates):  14083 opers/sec,  14420992 bytes/sec
test  7 ( 1024 byte blocks,  256 bytes per update,   4 updates):  21510 opers/sec,  22026240 bytes/sec
test  8 ( 1024 byte blocks, 1024 bytes per update,   1 updates):  21969 opers/sec,  22496768 bytes/sec
test  9 ( 2048 byte blocks,   16 bytes per update, 128 updates):   9908 opers/sec,  20291584 bytes/sec
test 10 ( 2048 byte blocks,  256 bytes per update,   8 updates):  19549 opers/sec,  40036352 bytes/sec
test 11 ( 2048 byte blocks, 1024 bytes per update,   2 updates):  20811 opers/sec,  42620928 bytes/sec
test 12 ( 2048 byte blocks, 2048 bytes per update,   1 updates):  21066 opers/sec,  43143168 bytes/sec
test 13 ( 4096 byte blocks,   16 bytes per update, 256 updates):   5630 opers/sec,  23062528 bytes/sec
test 14 ( 4096 byte blocks,  256 bytes per update,  16 updates):  13241 opers/sec,  54235136 bytes/sec
test 15 ( 4096 byte blocks, 1024 bytes per update,   4 updates):  13919 opers/sec,  57012224 bytes/sec
test 16 ( 4096 byte blocks, 4096 bytes per update,   1 updates):  16484 opers/sec,  67518464 bytes/sec
test 17 ( 8192 byte blocks,   16 bytes per update, 512 updates):   2745 opers/sec,  22487040 bytes/sec
test 18 ( 8192 byte blocks,  256 bytes per update,  32 updates):   6253 opers/sec,  51228672 bytes/sec
test 19 ( 8192 byte blocks, 1024 bytes per update,   8 updates):   6722 opers/sec,  55066624 bytes/sec
test 20 ( 8192 byte blocks, 4096 bytes per update,   2 updates):   7425 opers/sec,  60829696 bytes/sec
test 21 ( 8192 byte blocks, 8192 bytes per update,   1 updates):   9794 opers/sec,  80232448 bytes/sec
modprobe: ERROR: could not insert 'tcrypt': Resource temporarily unavailable    
alg des found
alg md5 found
alg des3_ede found
alg rot13 not found
alg sha1 found
alg sha224 found
alg sha256 found
alg blowfish not found
alg twofish not found
alg serpent not found
alg sha384 found
alg sha512 found
alg md4 found
alg aes found
alg cast6 not found
alg arc4 found
alg michael_mic found
alg deflate found
alg crc32c found

详情查看默认内核目录下(例:/usr/src/kernels/linux-4.9.25.arm64.1.b2.06/ ) /crypto/tcrypt.c 中的do_test函数,可以通过手动输入来增加相应算法的检测,十分方便。

已经在2020年3月13日更正了~!

你可能感兴趣的:(内核算法自检模块tcrypt的加载流程)