Whamcloud - gitweb
LU-14673 sec: annotate algorithms taking optional key 53/43653/7
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 11 May 2021 08:59:03 +0000 (10:59 +0200)
committerOleg Drokin <green@whamcloud.com>
Sun, 27 Jun 2021 10:57:51 +0000 (10:57 +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 and crc32 implementations define a ->setkey()
method, but their "key" is not actually a cryptographic key.

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

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I362211d1b1aa3763fe1481cebb3629b255f29e41
Reviewed-on: https://review.whamcloud.com/43653
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Aurelien Degremont <degremoa@amazon.com>
libcfs/libcfs/linux/linux-crypto-adler.c
libcfs/libcfs/linux/linux-crypto-crc32.c
libcfs/libcfs/linux/linux-crypto-crc32c-pclmul.c
libcfs/libcfs/linux/linux-crypto-crc32pclmul.c

index 9cd3fd0..2171817 100644 (file)
@@ -117,6 +117,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,
index 2df492e..9af855d 100644 (file)
@@ -130,6 +130,9 @@ static struct shash_alg alg = {
                .cra_name               = "crc32",
                .cra_driver_name        = "crc32-table",
                .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,
index 55024b5..da37923 100644 (file)
@@ -133,6 +133,9 @@ static struct shash_alg alg = {
                        .cra_name               = "crc32c",
                        .cra_driver_name        = "crc32c-pclmul",
                        .cra_priority           = 150,
+#ifdef CRYPTO_ALG_OPTIONAL_KEY
+                       .cra_flags              = CRYPTO_ALG_OPTIONAL_KEY,
+#endif
                        .cra_blocksize          = CHKSUM_BLOCK_SIZE,
                        .cra_ctxsize            = sizeof(u32),
                        .cra_module             = NULL,
index 6e34be6..47f0f98 100644 (file)
@@ -169,6 +169,9 @@ static struct shash_alg alg = {
                        .cra_name               = "crc32",
                        .cra_driver_name        = "crc32-pclmul",
                        .cra_priority           = 200,
+#ifdef CRYPTO_ALG_OPTIONAL_KEY
+                       .cra_flags              = CRYPTO_ALG_OPTIONAL_KEY,
+#endif
                        .cra_blocksize          = CHKSUM_BLOCK_SIZE,
                        .cra_ctxsize            = sizeof(u32),
                        .cra_module             = NULL,