]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: crc64-rocksoft - remove from crypto API
authorEric Biggers <ebiggers@google.com>
Thu, 30 Jan 2025 03:51:21 +0000 (19:51 -0800)
committerEric Biggers <ebiggers@google.com>
Sun, 9 Feb 2025 04:06:22 +0000 (20:06 -0800)
Remove crc64-rocksoft from the crypto API.  It has no known user now
that the lib is no longer built on top of it.  It was also added much
more recently than the longstanding crc32 and crc32c.  Unlike crc32 and
crc32c, crc64-rocksoft is also not mentioned in the dm-integrity
documentation and there are no references to it in anywhere in the
cryptsetup git repo, so it is unlikely to have any user there either.

Also, this CRC variant is named incorrectly; it has nothing to do with
Rocksoft and should be called crc64-nvme.  That is yet another reason to
remove it from the crypto API; we would not want anyone to start
depending on the current incorrect algorithm name of crc64-rocksoft.

Note that this change temporarily makes this CRC variant not be covered
by any tests, as previously it was relying on the crypto self-tests.
This will be fixed by adding this CRC variant to crc_kunit.

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Acked-by: Keith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/r/20250130035130.180676-3-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
crypto/Kconfig
crypto/Makefile
crypto/crc64_rocksoft_generic.c [deleted file]
crypto/testmgr.c
crypto/testmgr.h
include/linux/crc64.h

index 74ae5f52b784053848c7d93acc663532a3e5cd42..9ffb59b1aac3bf11b9b4b9787d78c89edac00def 100644 (file)
@@ -1090,17 +1090,6 @@ config CRYPTO_CRCT10DIF
 
          CRC algorithm used by the SCSI Block Commands standard.
 
-config CRYPTO_CRC64_ROCKSOFT
-       tristate "CRC64 based on Rocksoft Model algorithm"
-       depends on CRC64
-       select CRYPTO_HASH
-       help
-         CRC64 CRC algorithm based on the Rocksoft Model CRC Algorithm
-
-         Used by the NVMe implementation of T10 DIF (BLK_DEV_INTEGRITY)
-
-         See https://zlib.net/crc_v3.txt
-
 endmenu
 
 menu "Compression"
index f67e853c469021df630f94114ef4da00a292973c..d3b79b8c902229ab90640e16c6438f8aab431879 100644 (file)
@@ -157,7 +157,6 @@ CFLAGS_crc32c_generic.o += -DARCH=$(ARCH)
 CFLAGS_crc32_generic.o += -DARCH=$(ARCH)
 obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_generic.o
 CFLAGS_crct10dif_generic.o += -DARCH=$(ARCH)
-obj-$(CONFIG_CRYPTO_CRC64_ROCKSOFT) += crc64_rocksoft_generic.o
 obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o
 obj-$(CONFIG_CRYPTO_LZO) += lzo.o lzo-rle.o
 obj-$(CONFIG_CRYPTO_LZ4) += lz4.o
diff --git a/crypto/crc64_rocksoft_generic.c b/crypto/crc64_rocksoft_generic.c
deleted file mode 100644 (file)
index ce0f305..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-
-#include <linux/crc64.h>
-#include <linux/module.h>
-#include <crypto/internal/hash.h>
-#include <linux/unaligned.h>
-
-static int chksum_init(struct shash_desc *desc)
-{
-       u64 *crc = shash_desc_ctx(desc);
-
-       *crc = 0;
-
-       return 0;
-}
-
-static int chksum_update(struct shash_desc *desc, const u8 *data,
-                        unsigned int length)
-{
-       u64 *crc = shash_desc_ctx(desc);
-
-       *crc = crc64_rocksoft_generic(*crc, data, length);
-
-       return 0;
-}
-
-static int chksum_final(struct shash_desc *desc, u8 *out)
-{
-       u64 *crc = shash_desc_ctx(desc);
-
-       put_unaligned_le64(*crc, out);
-       return 0;
-}
-
-static int __chksum_finup(u64 crc, const u8 *data, unsigned int len, u8 *out)
-{
-       crc = crc64_rocksoft_generic(crc, data, len);
-       put_unaligned_le64(crc, out);
-       return 0;
-}
-
-static int chksum_finup(struct shash_desc *desc, const u8 *data,
-                       unsigned int len, u8 *out)
-{
-       u64 *crc = shash_desc_ctx(desc);
-
-       return __chksum_finup(*crc, data, len, out);
-}
-
-static int chksum_digest(struct shash_desc *desc, const u8 *data,
-                        unsigned int length, u8 *out)
-{
-       return __chksum_finup(0, data, length, out);
-}
-
-static struct shash_alg alg = {
-       .digestsize     =       sizeof(u64),
-       .init           =       chksum_init,
-       .update         =       chksum_update,
-       .final          =       chksum_final,
-       .finup          =       chksum_finup,
-       .digest         =       chksum_digest,
-       .descsize       =       sizeof(u64),
-       .base           =       {
-               .cra_name               =       CRC64_ROCKSOFT_STRING,
-               .cra_driver_name        =       "crc64-rocksoft-generic",
-               .cra_priority           =       200,
-               .cra_blocksize          =       1,
-               .cra_module             =       THIS_MODULE,
-       }
-};
-
-static int __init crc64_rocksoft_init(void)
-{
-       return crypto_register_shash(&alg);
-}
-
-static void __exit crc64_rocksoft_exit(void)
-{
-       crypto_unregister_shash(&alg);
-}
-
-module_init(crc64_rocksoft_init);
-module_exit(crc64_rocksoft_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Rocksoft model CRC64 calculation.");
-MODULE_ALIAS_CRYPTO("crc64-rocksoft");
-MODULE_ALIAS_CRYPTO("crc64-rocksoft-generic");
index e61490ba409589777cdcb757032fa627a1d7848e..0c1c3a6453b6a9901fd7af0cf45e0c3a7b94aafd 100644 (file)
@@ -4759,13 +4759,6 @@ static const struct alg_test_desc alg_test_descs[] = {
                .suite = {
                        .hash = __VECS(crc32c_tv_template)
                }
-       }, {
-               .alg = "crc64-rocksoft",
-               .test = alg_test_hash,
-               .fips_allowed = 1,
-               .suite = {
-                       .hash = __VECS(crc64_rocksoft_tv_template)
-               }
        }, {
                .alg = "crct10dif",
                .test = alg_test_hash,
index d754ab997186681d221d79dac6baf20fcc8f3543..61c7ae73105285d1d000e6c043f6cfbcd41e15ac 100644 (file)
@@ -6017,21 +6017,6 @@ static const struct hash_testvec rmd160_tv_template[] = {
        }
 };
 
-static const u8 zeroes[4096] = { [0 ... 4095] = 0 };
-static const u8 ones[4096] = { [0 ... 4095] = 0xff };
-
-static const struct hash_testvec crc64_rocksoft_tv_template[] = {
-       {
-               .plaintext      = zeroes,
-               .psize          = 4096,
-               .digest         = "\x4e\xb6\x22\xeb\x67\xd3\x82\x64",
-       }, {
-               .plaintext      = ones,
-               .psize          = 4096,
-               .digest         = "\xac\xa3\xec\x02\x73\xba\xdd\xc0",
-       }
-};
-
 static const struct hash_testvec crct10dif_tv_template[] = {
        {
                .plaintext      = "abc",
index 0a595b2721660c82f84b90b4cd134fe35efe3b32..7880aeab69d6583c70b5a4f993e1a467cd6005fe 100644 (file)
@@ -7,8 +7,6 @@
 
 #include <linux/types.h>
 
-#define CRC64_ROCKSOFT_STRING "crc64-rocksoft"
-
 u64 __pure crc64_be(u64 crc, const void *p, size_t len);
 u64 __pure crc64_rocksoft_generic(u64 crc, const void *p, size_t len);