3

I am trying to play with my random generator, so I decided to give libkcapi a try.

Here is what I did:

$ 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

Taking a look at strace output here is what I see:

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)

As mentionned in the toplevel README.md file:

The kernel interface and therefore this library can be used by unprivileged processes.

I also tried using sudo without much luck.

For reference I am using:

$ uname -a
Linux macbookpro 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26) x86_64 GNU/Linux

Does anyone knows how to use the libkcapi on Linux ?

3

In fact the answer was pretty easy. From the documentation:

I need the following:

  • 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) not required

However here is what I get with the default Debian kernel:

% 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

I reported it, let's see what happen:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.