Whamcloud - gitweb
LU-14673 sec: annotate algorithms taking optional key
[fs/lustre-release.git] / libcfs / libcfs / linux-crypto-adler.c
index 44bf374..6f19bca 100644 (file)
@@ -51,10 +51,9 @@ static int adler32_setkey(struct crypto_shash *hash, const u8 *key,
 {
        u32 *mctx = crypto_shash_ctx(hash);
 
-       if (keylen != sizeof(u32)) {
-               crypto_shash_set_flags(hash, CRYPTO_TFM_RES_BAD_KEY_LEN);
+       if (keylen != sizeof(u32))
                return -EINVAL;
-       }
+
        *mctx = *(u32 *)key;
        return 0;
 }
@@ -117,9 +116,12 @@ 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             = THIS_MODULE,
+               .cra_module             = NULL,
                .cra_init               = adler32_cra_init,
        }
 };