Socket
libkcapi - 錯誤:Netlink 錯誤:無法打開 netlink 套接字
我正在嘗試使用我的隨機生成器,所以我決定嘗試一下libkcapi。
這是我所做的:
$ wget http://www.chronox.de/libkcapi/libkcapi-0.13.0.tar.xz $ tar xf libkcapi-0.13.0.tar.xz $ cd libkcapi-0.13.0 $ cd lib $ make $ cd ../test $ make $ ./kcapi -x 3 -c sha1 -p 8c899bba libkcapi - Error: Netlink error: cannot open netlink socket libkcapi - Error: Netlink error: cannot open netlink socket libkcapi - Error: NETLINK_CRYPTO: cannot obtain cipher information for sha1 (is required crypto_user.c patch missing? see documentation) Allocation of hash sha1 failed Failed to invoke testing
看看這裡的 strace 輸出是我所看到的:
socket(AF_NETLINK, SOCK_RAW, NETLINK_CRYPTO) = -1 EPROTONOSUPPORT (Protocol not supported) write(2, "libkcapi - Error: Netlink error:"..., 60libkcapi - Error: Netlink error: cannot open netlink socket ) = 60 socket(AF_NETLINK, SOCK_RAW, NETLINK_CRYPTO) = -1 EPROTONOSUPPORT (Protocol not supported) write(2, "libkcapi - Error: Netlink error:"..., 60libkcapi - Error: Netlink error: cannot open netlink socket ) = 60 write(2, "libkcapi - Error: NETLINK_CRYPTO"..., 137libkcapi - Error: NETLINK_CRYPTO: cannot obtain cipher information for sha1 (is required crypto_user.c patch missing? see documentation)
正如頂層 README.md 文件中提到的:
核心介面和因此這個庫可以被非特權程序使用。
我也試過使用
sudo
沒有太多運氣。作為參考,我正在使用:
$ uname -a Linux macbookpro 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26) x86_64 GNU/Linux
有誰知道如何
libkcapi
在 Linux 上使用?
事實上,答案很簡單。從文件中:
我需要以下內容:
- CONFIG_CRYPTO_USER
- CONFIG_CRYPTO_USER_API
- CONFIG_CRYPTO_USER_API_HASH
- CONFIG_CRYPTO_USER_API_SKCIPHER
- CONFIG_CRYPTO_USER_API_AEAD
- CONFIG_CRYPTO_USER_API_RNG
- (CONFIG_CRYPTO_USER_API_AKCIPHER) 不需要
然而,這是我使用預設 Debian 核心得到的:
% grep CONFIG_CRYPTO_USER /boot/config-4.9.0-3-amd64 # CONFIG_CRYPTO_USER is not set CONFIG_CRYPTO_USER_API=m CONFIG_CRYPTO_USER_API_HASH=m CONFIG_CRYPTO_USER_API_SKCIPHER=m # CONFIG_CRYPTO_USER_API_RNG is not set CONFIG_CRYPTO_USER_API_AEAD=m
我舉報了,讓我們看看會發生什麼: