* Re: [PATCH] drbd: select CRYPTO and CRYPTO_HASH
2026-11-11 8:35 [PATCH] drbd: select CRYPTO and CRYPTO_HASH Christoph Böhmwalder
@ 2026-11-11 21:22 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2026-11-11 21:22 UTC (permalink / raw)
To: Christoph Böhmwalder
Cc: Jens Axboe, drbd-dev, linux-kernel, Lars Ellenberg,
Philipp Reisner, linux-block
On Wed, Nov 11, 2026 at 09:35:05AM +0100, Christoph Böhmwalder wrote:
> DRBD uses the shash API for the data integrity, online verify and
> checksum-based resync algorithms and for peer authentication, but
> BLK_DEV_DRBD does not select the crypto core. With CRYPTO=n, a kernel
> with DRBD built in does not link:
>
> ld: drbd_sender.c:(.text+0x137f): undefined reference to `crypto_shash_finup'
> ld: drbd_receiver.c:(.text+0x58f): undefined reference to `crypto_alloc_shash'
>
> Select CRYPTO and CRYPTO_HASH.
>
> Fixes: b411b3637fa7 ("The DRBD driver")
> Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Looks fine for now, but you should consider what algorithms DRBD
actually needs and consider switching to the library APIs for those
instead of crypto_shash. Presumably not more than a handful are
actually used in practice with DRBD, and you don't really need to keep
"supporting" MD4, Whirlpool, RIPEMD, CMAC-SM4, etc.?
The "pass arbitrary string from userspace to crypto_alloc_*()" strategy
has been problematic for other kernel features using it. For one, it
gives access to algorithms that are obsolete, insecure, redundant or
make no sense for the use case. And it makes it more difficult to
remove unused algorithms from the crypto API, since it makes it harder
to prove that they are in fact unused.
Note that the crypto_shash API is also somewhat inefficient and
difficult to use correctly, even though it's better than crypto_ahash.
(And the DRBD driver got it wrong, so just FYI, you should expect fixes
if you keep using it...).
- Eric
^ permalink raw reply [flat|nested] 2+ messages in thread