如何在linux中的cryptoAPI中添加更多算法

abh*_*bhi 3 linux kernel cryptography aes

当我检查/ proc/crypto它显示我:

abhi@ubuntu:/proc$ cat crypto 
name         : stdrng
driver       : krng
module       : kernel
priority     : 200
refcnt       : 1
selftest     : passed
type         : rng
seedsize     : 0

name         : md5
driver       : md5-generic
module       : kernel
priority     : 0
refcnt       : 1
selftest     : passed
type         : shash
blocksize    : 64
digestsize   : 16
Run Code Online (Sandbox Code Playgroud)

我需要在我的一个项目中使用aes256.

有人可以指出我如何将这个算法添加到crypto api或者是否有任何其他方式可以实现这一点(ubuntu 10.4,2.6.32-35).

是否有一个支持(默认情况下)使用cryptoapi for kernel 2.6实现的算法列表?

osg*_*sgx 6

Abhi,Kernel crypto API 在2002年为协议创建的,它需要在内核中进行加密(在内核模式下,当你没有使用用户空间加密的可靠方法时):

尽管API最初旨在支持IPSec,但API已被设计为通用设施,其潜在应用包括加密文件,加密文件系统,强大的文件系统完整性,随机字符设备(/ dev/random),网络文件系统安全性(例如,CIFS)和其他需要加密的内核网络服务.

因此,如果您在用户空间中工作并且没有计划作为新FS或网络堆栈的新部分进入内核,则使用用户空间库进行加密更容易且更便携.用户空间lib可能使用或不使用内核API用于某些密码,但可能会使用用户空间实现.有很多这样的库,例如openssl,Libgcrypt等.一些巨大的框架,如Qt也可能包括一些流行的加密.

要使用新的算法在内核中扩展cryptoapi,你应该为你的内核实现和编译这个算法(作为模块或作为内核二进制文件的一部分).要查找为内核编译的模块的名称,请尝试ls /lib/modules/*/*/arch/*/crypto/ /lib/modules/*/*/crypto/; 然后你可以调用例子modprobe aes_genericmodprobe aes-x86_64在API中加载额外的加密模块.

之后modprobe aes-x86_64我有:

# cat /proc/crypto |grep aes
name         : aes
driver       : aes-asm
module       : aes_x86_64
name         : aes
driver       : aes-generic
module       : aes_generic
Run Code Online (Sandbox Code Playgroud)