如何在Linux中的cryptoAPI中添加更多算法教程
当我检查/ proc / crypto时,它显示了我:
[email protected]:/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
我需要为我的项目之一使用aes256.
有人可以指出我如何将这种算法添加到crypto api中,或者有其他任何方法可以在(ubuntu 10.4,2.6.32-35)中实现.
是否存在用cryptoapi内核2.6实现的受支持(默认)算法的列表?
解决方法:
Abhi,2002年用于协议的内核加密API was created,它要求内核内部进行加密(在内核模式下,当您没有可靠的使用用户空间加密方法时):
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.
因此,如果您正在用户空间中工作,并且没有计划作为新的FS或网络堆栈的新部分移入内核,则使用用户空间库进行加密将变得更加容易和可移植.用户空间库可能对某些密码使用或不使用内核API,但可能会使用用户空间实现.有很多这样的库,例如openssl,Libgcrypt等.一些大型框架(例如Qt)也可能包含一些流行的加密货币.
要使用新算法在内核中扩展cryptoapi,您应该为您的内核实现并编译该算法(作为模块或作为内核二进制文件的一部分).要查找为您的内核编译的模块的名称,请尝试ls / lib / modules / * / * / arch / * / crypto / / lib / modules / * / * / crypto /;那么您可以调用例如modprobe aes_generic或modprobe 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