How can i add more algorithm in cryptoAPI in linux

 ̄綄美尐妖づ 提交于 2019-12-04 14:13:46

Abhi, Kernel crypto API was created in 2002 for protocols, which requires cryptography inside the kernel (in the kernel mode, when you has no reliable way of using user-space crypto):

Although initially aimed at supporting IPSec, the API has been designed as a general-purpose facility, with potential applications including encrypted files, encrypted filesystems, strong filesystem integrity, the random character device (/dev/random), network filesystem security (for example, CIFS) and other kernel networking services requiring cryptography.

So, If you are working in the user-space and has no plans to move into kernel as new FS or new part of network stack, it is easier and more portable to use user-space library for crypto. User-space lib may use or not use kernel API for some ciphers, but likely it will use user-space implementation. There are a lot of such libs, e.g. openssl, Libgcrypt etc. Some huge frameworks, like Qt may include some popular crypto too.

To expand cryptoapi in kernel with new algo you should have this algo implemented and compiled for your kernel (either as module or as part of kernel binary). To find name of modules compiled for your kernel, try ls /lib/modules/*/*/arch/*/crypto/ /lib/modules/*/*/crypto/; then you can call for example modprobe aes_generic or modprobe aes-x86_64 to load additional crypto module in API.

After modprobe aes-x86_64 I have:

# cat /proc/crypto |grep aes
name         : aes
driver       : aes-asm
module       : aes_x86_64
name         : aes
driver       : aes-generic
module       : aes_generic

you can take aes-generic.c as an example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!