Whamcloud - gitweb
LU-14673 sec: annotate algorithms taking optional key
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 11 May 2021 08:59:03 +0000 (10:59 +0200)
committerLi Xi <lixi@ddn.com>
Tue, 13 Jul 2021 08:24:23 +0000 (08:24 +0000)
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

Lustre-change: https://review.whamcloud.com/43656
Lustre-commit: b161e7b777e63bb4328aeab9e50560f919fedc31

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I362211d1b1aa3763fe1481cebb3629b255f29e41
Reviewed-on: https://review.whamcloud.com/43860
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
libcfs/libcfs/linux-crypto-adler.c

index 5b21ef7..6f19bca 100644 (file)
@@ -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,