在 /proc/crypto 我有 2 个同名的驱动程序。
name : gcm(aes)
driver : xilinx-zynqmp-aes-gcm
module : kernel
priority : 200
refcnt : 1
selftest : passed
internal : no
type : aead
async : yes
blocksize : 1
ivsize : 12
maxauthsize : 16
geniv : <none>
name : gcm(aes)
driver : gcm-aes-ce
module : kernel
priority : 300
refcnt : 1
selftest : passed
internal : no
type : aead
async : no
blocksize : 1
ivsize : 12
maxauthsize : 16
geniv : <none>
在代码中,我尝试将套接字绑定到驱动程序。
struct sockaddr_alg sa = {
.salg_family = AF_ALG,
.salg_type = "aead",
.salg_name = "gcm(aes)"
};
tfmfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
ret = bind(tfmfd, (struct sockaddr *)&sa, sizeof(sa));
if (ret == -1) {
printf("bind failed %s\n", strerror(errno));
close(tfmfd);
return -1;
}
我遇到错误。
绑定失败 没有这样的文件或目录
是因为内核发现两个同名的算法吗?
我刚刚遇到了同样的错误。
我确定需要在
petalinux-config -c kernel
中启用对 AEAD 的用户空间调用
我具体选择的是:
<*> Userspace cryptographic algorithm configuration
<*> User-space interface for AEAD cipher algorithms
如果您使用
driver
的名称,您还可以使用
name
而不是
salg_name
选择 xilinx 版本
希望这可以帮助其他尝试遵循 xilinx 示例但遇到问题的人。