Skip to contentSkip to conversation

crypto: add adler32 to CryptoAPI

PATCH In review [email protected] 4 participants 5 messages May 28, 2020 – Jun 2, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: add adler32 to CryptoAPI

From: Sebastien Buisson <[email protected]>

Add adler32 to CryptoAPI so that it can be used with the normal kernel API, and potentially accelerated if architecture-specific optimizations are available.

---
 crypto/Kconfig        |   7 +
 crypto/Makefile       |   1 +
 crypto/adler32_zlib.c | 117 ++++++++++++++++
 crypto/testmgr.c      |   7 +
 crypto/testmgr.h      | 362 ++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 494 insertions(+)
 create mode 100644 crypto/adler32_zlib.c
crypto/Kconfig +7 -0
index c24a474..46ee054 100644
@@ -637,6 +637,13 @@ config CRYPTO_CRC32_MIPS
 	  CRC32c and CRC32 CRC algorithms implemented using mips crypto
 	  instructions, when available.
 
+config CRYPTO_ADLER32
+	tristate "ADLER32 CRC algorithm"
+	select CRYPTO_HASH
+	default m
+	help
+	  Adler32 redundancy-check algorithm.
+	  Shash crypto api wrappers to zlib_adler32 function.
 
 config CRYPTO_XXHASH
 	tristate "xxHash hash algorithm"
crypto/Makefile +1 -0
index 4ca12b6..5ed9636 100644
@@ -140,6 +140,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
+obj-$(CONFIG_CRYPTO_ADLER32) += adler32_zlib.o
 obj-$(CONFIG_CRYPTO_CRCT10DIF) += crct10dif_common.o crct10dif_generic.o
 obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o
 obj-$(CONFIG_CRYPTO_LZO) += lzo.o lzo-rle.o
crypto/adler32_zlib.c new file +117 -0

117 lines not on this page · raw message

crypto/testmgr.c +7 -0
index 6863f91..9ca87f5 100644
@@ -4166,6 +4166,13 @@ static int alg_test_null(const struct alg_test_desc *desc,
 			.cipher = __VECS(adiantum_xchacha20_aes_tv_template)
 		},
 	}, {
+		.alg = "adler32",
+		.test = alg_test_hash,
+		.fips_allowed = 1,
+		.suite = {
+			.hash = __VECS(adler32_tv_template)
+		}
+	}, {
 		.alg = "aegis128",
 		.test = alg_test_aead,
 		.suite = {
crypto/testmgr.h +362 -0

368 lines not on this page · raw message

Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 7 lines · On Thu, May 28, 2020 at 07:00:51PM +0200, [email protected] wrote:

From: Sebastien Buisson <[email protected]>

Add adler32 to CryptoAPI so that it can be used with the normal kernel API, and potentially accelerated if architecture-specific optimizations are available.

Quoted 8 lines
---
 crypto/Kconfig        |   7 +
 crypto/Makefile       |   1 +
 crypto/adler32_zlib.c | 117 ++++++++++++++++
 crypto/testmgr.c      |   7 +
 crypto/testmgr.h      | 362 ++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 494 insertions(+)
 create mode 100644 crypto/adler32_zlib.c

Who is going to use this inside the kernel?

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
#2 lore raw
In reply to [email protected]
Quoted 7 lines · On Thu, May 28, 2020 at 07:00:51PM +0200, [email protected] wrote:

From: Sebastien Buisson <[email protected]>

Add adler32 to CryptoAPI so that it can be used with the normal kernel API, and potentially accelerated if architecture-specific optimizations are available.

Quoted 8 lines
---
 crypto/Kconfig        |   7 +
 crypto/Makefile       |   1 +
 crypto/adler32_zlib.c | 117 ++++++++++++++++
 crypto/testmgr.c      |   7 +
 crypto/testmgr.h      | 362 ++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 494 insertions(+)
 create mode 100644 crypto/adler32_zlib.c

Did you actually run the self-tests for this? They fail for me.

- Eric

#3 lore raw
Quoted 20 lines · Eric Biggers
Quoted 7 lines · On Thu, May 28, 2020 at 07:00:51PM +0200, [email protected] wrote:

From: Sebastien Buisson <[email protected]>

Add adler32 to CryptoAPI so that it can be used with the normal kernel API, and potentially accelerated if architecture-specific optimizations are available.

Quoted 8 lines

---

crypto/Kconfig        |   7 +
crypto/Makefile       |   1 +
crypto/adler32_zlib.c | 117 ++++++++++++++++
crypto/testmgr.c      |   7 +
crypto/testmgr.h      | 362 ++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 494 insertions(+)

create mode 100644 crypto/adler32_zlib.c

Quoted 1 line

Did you actually run the self-tests for this? They fail for me.

I was wondering how to run testmgr tests alone?

#4 lore raw
Quoted 20 lines · Sebastien Buisson
Quoted 20 lines · Eric Biggers
Quoted 15 lines · On Thu, May 28, 2020 at 07:00:51PM +0200, [email protected] wrote:

From: Sebastien Buisson <[email protected]>

Add adler32 to CryptoAPI so that it can be used with the normal kernel API, and potentially accelerated if architecture-specific optimizations are available.

---

crypto/Kconfig        |   7 +
crypto/Makefile       |   1 +
crypto/adler32_zlib.c | 117 ++++++++++++++++
crypto/testmgr.c      |   7 +
crypto/testmgr.h      | 362 ++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 494 insertions(+)

create mode 100644 crypto/adler32_zlib.c

Quoted 3 lines
Quoted 1 line

Did you actually run the self-tests for this? They fail for me.

I was wondering how to run testmgr tests alone?

Just boot with:

# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y

Then check dmesg or /proc/crypto.

- Eric