From b161e7b777e63bb4328aeab9e50560f919fedc31 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Tue, 11 May 2021 10:59:03 +0200 Subject: [PATCH] LU-14673 sec: annotate algorithms taking optional key Crypto algorithms implementing a ->setkey() method but that can also be used without a key must set the CRYPTO_ALG_OPTIONAL_KEY flag if defined in the kernel. In Lustre, adler32 implementation defines a ->setkey() method, but its "key" is not actually a cryptographic key. Linux-commit: a208fa8f33031b9e0aba44c7d1b7e68eb0cbd29e Signed-off-by: Eric Biggers Signed-off-by: Herbert Xu Signed-off-by: Sebastien Buisson Change-Id: I362211d1b1aa3763fe1481cebb3629b255f29e41 Reviewed-on: https://review.whamcloud.com/43656 Reviewed-by: Andreas Dilger Tested-by: jenkins Reviewed-by: James Simmons Reviewed-by: Olaf Faaland-LLNL Tested-by: Andreas Dilger --- libcfs/libcfs/linux-crypto-adler.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libcfs/libcfs/linux-crypto-adler.c b/libcfs/libcfs/linux-crypto-adler.c index 5b21ef7..6f19bca 100644 --- a/libcfs/libcfs/linux-crypto-adler.c +++ b/libcfs/libcfs/linux-crypto-adler.c @@ -116,6 +116,9 @@ static struct shash_alg alg = { .cra_name = "adler32", .cra_driver_name = "adler32-zlib", .cra_priority = 100, +#ifdef CRYPTO_ALG_OPTIONAL_KEY + .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, +#endif .cra_blocksize = CHKSUM_BLOCK_SIZE, .cra_ctxsize = sizeof(u32), .cra_module = NULL, -- 1.8.3.1