crypto: Enable fuzz testing for arch code
Subsystems (2)
v2 cover crypto: Enable fuzz testing for arch code
From: Ard Biesheuvel <[email protected]>
Follow-up to [0].
crc32-generic and crc32c-generic are built around the architecture library code for CRC-32, and the lack of distinct drivers for this arch code means they are lacking test coverage.
Fix this by exposing the arch library code as a separate driver (with a higher priority) if it is different from the generic C code. Update the crc32-generic drivers to always use the generic C code.
Changes since [0]:
- make generic drivers truly generic, and expose the arch code as a separate driver
[0] https://lore.kernel.org/all/[email protected]/T/#u
Ard Biesheuvel (2):
crypto/crc32: Provide crc32-arch driver for accelerated library code crypto/crc32c: Provide crc32c-arch driver for accelerated library code
crypto/Makefile | 2 + crypto/crc32_generic.c | 94 +++++++++++++++----- crypto/crc32c_generic.c | 94 +++++++++++++++----- lib/crc32.c | 4 + 4 files changed, 148 insertions(+), 46 deletions(-)
Signature · 1 line
2.47.0.rc1.288.g06298d1525-goog
PATCH v2 1/2 crypto/crc32: Provide crc32-arch driver for accelerated library code
From: Ard Biesheuvel <[email protected]>
crc32-generic is currently backed by the architecture's CRC-32 library code, which may offer a variety of implementations depending on the capabilities of the platform. These are not covered by the crypto subsystem's fuzz testing capabilities because crc32-generic is the reference driver that the fuzzing logic uses as a source of truth.
Fix this by providing a crc32-arch implementation which is based on the arch library code if available, and modify crc32-generic so it is always based on the generic C implementation. If the arch has no CRC-32 library code, this change does nothing.
--- crypto/Makefile | 1 + crypto/crc32_generic.c | 94 +++++++++++++++----- lib/crc32.c | 2 + 3 files changed, 73 insertions(+), 24 deletions(-)
crypto/Makefile +1 -0
@@ -152,6 +152,7 @@ obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o obj-$(CONFIG_CRYPTO_CRC32C) += crc32c_generic.o obj-$(CONFIG_CRYPTO_CRC32) += crc32_generic.o +CFLAGS_crc32_generic.o += -DARCH=$(ARCH) obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_common.o crct10dif_generic.o obj-$(CONFIG_CRYPTO_CRC64_ROCKSOFT) += crc64_rocksoft_generic.o obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o
crypto/crc32_generic.c +70 -24
126 lines not on this page · raw message
lib/crc32.c +2 -0
@@ -205,6 +205,8 @@ EXPORT_SYMBOL(crc32_le);EXPORT_SYMBOL (__crc32c_le); u32 __pure crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le); +EXPORT_SYMBOL (crc32_le_base ); + u32 __pure __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le); u32 __pure crc32_be_base(u32, unsigned char const *, size_t) __alias(crc32_be);
Signature · 1 line
2.47.0.rc1.288.g06298d1525-goog
PATCH v2 2/2 crypto/crc32c: Provide crc32c-arch driver for accelerated library code
In reply to Ard BiesheuvelFrom: Ard Biesheuvel <[email protected]>
crc32c-generic is currently backed by the architecture's CRC-32c library code, which may offer a variety of implementations depending on the capabilities of the platform. These are not covered by the crypto subsystem's fuzz testing capabilities because crc32c-generic is the reference driver that the fuzzing logic uses as a source of truth.
Fix this by providing a crc32c-arch implementation which is based on the arch library code if available, and modify crc32c-generic so it is always based on the generic C implementation. If the arch has no CRC-32c library code, this change does nothing.
--- crypto/Makefile | 1 + crypto/crc32c_generic.c | 94 +++++++++++++++----- lib/crc32.c | 2 + 3 files changed, 75 insertions(+), 22 deletions(-)
crypto/Makefile +1 -0
@@ -152,6 +152,7 @@ obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o obj-$(CONFIG_CRYPTO_CRC32C) += crc32c_generic.o obj-$(CONFIG_CRYPTO_CRC32) += crc32_generic.o +CFLAGS_crc32c_generic.o += -DARCH=$(ARCH) CFLAGS_crc32_generic.o += -DARCH=$(ARCH) obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_common.o crct10dif_generic.o obj-$(CONFIG_CRYPTO_CRC64_ROCKSOFT) += crc64_rocksoft_generic.o
crypto/crc32c_generic.c +72 -22
131 lines not on this page · raw message
lib/crc32.c +2 -0
@@ -208,6 +208,8 @@ u32 __pure crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);EXPORT_SYMBOL (crc32_le_base); u32 __pure __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le); +EXPORT_SYMBOL (__crc32c_le_base ); + u32 __pure crc32_be_base(u32, unsigned char const *, size_t) __alias(crc32_be);/*
Signature · 1 line
2.47.0.rc1.288.g06298d1525-goog
Quoted 22 lines · Ard Biesheuvel
From: Ard Biesheuvel <[email protected]>
Follow-up to [0].
crc32-generic and crc32c-generic are built around the architecture library code for CRC-32, and the lack of distinct drivers for this arch code means they are lacking test coverage.
Fix this by exposing the arch library code as a separate driver (with a higher priority) if it is different from the generic C code. Update the crc32-generic drivers to always use the generic C code.
Changes since [0]:
- make generic drivers truly generic, and expose the arch code as a separate driver[0] https://lore.kernel.org/all/[email protected]/T/#u
Ard Biesheuvel (2):
crypto/crc32: Provide crc32-arch driver for accelerated library codecrypto/crc32c: Provide crc32c-arch driver for accelerated library code
Quoted 5 lines
crypto/Makefile | 2 + crypto/crc32_generic.c | 94 +++++++++++++++----- crypto/crc32c_generic.c | 94 +++++++++++++++----- lib/crc32.c | 4 + 4 files changed, 148 insertions(+), 46 deletions(-)
- Eric
Herbert Xu
maintainerQuoted 22 lines · Ard Biesheuvel
From: Ard Biesheuvel <[email protected]>
Follow-up to [0].
crc32-generic and crc32c-generic are built around the architecture library code for CRC-32, and the lack of distinct drivers for this arch code means they are lacking test coverage.
Fix this by exposing the arch library code as a separate driver (with a higher priority) if it is different from the generic C code. Update the crc32-generic drivers to always use the generic C code.
Changes since [0]:
- make generic drivers truly generic, and expose the arch code as a separate driver[0] https://lore.kernel.org/all/[email protected]/T/#u
Ard Biesheuvel (2):
crypto/crc32: Provide crc32-arch driver for accelerated library codecrypto/crc32c: Provide crc32c-arch driver for accelerated library code
Quoted 8 lines
crypto/Makefile | 2 + crypto/crc32_generic.c | 94 +++++++++++++++----- crypto/crc32c_generic.c | 94 +++++++++++++++----- lib/crc32.c | 4 + 4 files changed, 148 insertions(+), 46 deletions(-)Signature · 1 line
2.47.0.rc1.288.g06298d1525-goog
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt