Whamcloud - gitweb
LU-14673 sec: annotate algorithms taking optional key 56/43656/3
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 11 May 2021 08:59:03 +0000 (10:59 +0200)
committerOleg Drokin <green@whamcloud.com>
Thu, 27 May 2021 18:18:55 +0000 (18:18 +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

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/43656
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Olaf Faaland-LLNL <faaland1@llnl.gov>
Tested-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,