Skip to contentSkip to conversation

crypto/arc4: now arc needs blockcipher support

PATCH In review Sebastian Andrzej Siewior 4 participants 6 messages Jun 26, 2012 – Jul 8, 2012 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/arc4: now arc needs blockcipher support

Since commit ce6dd368 ("crypto: arc4 - improve performance by adding ecb(arc4)) we need to pull in a blkcipher.

|ERROR: "crypto_blkcipher_type" [crypto/arc4.ko] undefined!
|ERROR: "blkcipher_walk_done" [crypto/arc4.ko] undefined!
|ERROR: "blkcipher_walk_virt" [crypto/arc4.ko] undefined!

---

On a side note: do we pull in the blkcipher block mode for each cipher now to gain some extra performance like the openssl project? I was under the impression that is in general not worth it.

 crypto/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/Kconfig +1 -1
index 2c1c2df..cefbe15 100644
@@ -593,7 +593,7 @@ config CRYPTO_ANUBIS
 
 config CRYPTO_ARC4
 	tristate "ARC4 cipher algorithm"
-	select CRYPTO_ALGAPI
+	select CRYPTO_BLKCIPHER
 	help
 	  ARC4 cipher algorithm.
 
Signature · 1 line
1.7.10
#1 lore raw
Quoted 7 lines · Sebastian Andrzej Siewior

Since commit ce6dd368 ("crypto: arc4 - improve performance by adding ecb(arc4)) we need to pull in a blkcipher.

|ERROR: "crypto_blkcipher_type" [crypto/arc4.ko] undefined!
|ERROR: "blkcipher_walk_done" [crypto/arc4.ko] undefined!
|ERROR: "blkcipher_walk_virt" [crypto/arc4.ko] undefined!
Quoted 6 lines

---

On a side note: do we pull in the blkcipher block mode for each cipher now to gain some extra performance like the openssl project? I was under the impression that is in general not worth it.

Arc4 is a stream cipher, NOT a block cipher. They are completely different things, and the requirements for using them securely are different. In particular, modes like ECB apply to block ciphers not to stream ciphers.

Unless these changes have been thoroughly analyzed by several people who actually know crypto, they should be immediately reverted.

#2 lore raw

Quoting Sandy Harris <[email protected]>:

Quoted 16 lines
Quoted 7 lines · Sebastian Andrzej Siewior

Since commit ce6dd368 ("crypto: arc4 - improve performance by adding ecb(arc4)) we need to pull in a blkcipher.

|ERROR: "crypto_blkcipher_type" [crypto/arc4.ko] undefined!
|ERROR: "blkcipher_walk_done" [crypto/arc4.ko] undefined!
|ERROR: "blkcipher_walk_virt" [crypto/arc4.ko] undefined!
Quoted 6 lines

---

On a side note: do we pull in the blkcipher block mode for each cipher now to gain some extra performance like the openssl project? I was under the impression that is in general not worth it.

Quoted 6 lines

Arc4 is a stream cipher, NOT a block cipher. They are completely different things, and the requirements for using them securely are different. In particular, modes like ECB apply to block ciphers not to stream ciphers.

Unless these changes have been thoroughly analyzed by several people who actually know crypto, they should be immediately reverted.

The 'arc4' is defined as one-byte cipher (that modifies its context to remember current stream state) and ecb module is just used to make arc4 iterate throught variable length buffers. 'ecb(arc4)' is then the actual stream cipher, with confusing and wrong name. I guess now that 'ecb(arc4)' is moved to arc4 module completely, it could be renamed to 'arc4stream' and in-kernel arc4 users which to use that.

-Jussi

maintainer
#3 lore raw
In reply to Sebastian Andrzej Siewior
Quoted 8 lines · Sebastian Andrzej Siewior

Since commit ce6dd368 ("crypto: arc4 - improve performance by adding ecb(arc4)) we need to pull in a blkcipher.

|ERROR: "crypto_blkcipher_type" [crypto/arc4.ko] undefined!
|ERROR: "blkcipher_walk_done" [crypto/arc4.ko] undefined!
|ERROR: "blkcipher_walk_virt" [crypto/arc4.ko] undefined!

Patch applied. Thanks!

Quoted 3 lines

On a side note: do we pull in the blkcipher block mode for each cipher now to gain some extra performance like the openssl project? I was under the impression that is in general not worth it.

You mean normal block ciphers? Does it really make that much of a difference?

Cheers,

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
#4 lore raw
Quoted 6 lines · Herbert Xu
Quoted 3 lines

On a side note: do we pull in the blkcipher block mode for each cipher now to gain some extra performance like the openssl project? I was under the impression that is in general not worth it.

You mean normal block ciphers? Does it really make that much of a difference?

Yes. Jussi added block mode for RC4 instead that auto block-mode that is prefered over the "automatic" one that is generated otherwise. I don't know how much performance it brings but I would be supprised if it is a lot on an average CPU. With this patch in I think it is a matter of time until we get the AES-CBC & and friends block mode optimized code (which should be a little faster since comparing to calling a function call for the XOR…) you get the idea.

Sebastian

#5 lore raw

Quoting Sebastian Andrzej Siewior <[email protected]>:

Quoted 17 lines · Herbert Xu
Quoted 7 lines
Quoted 1 line

On a side note: do we pull in the blkcipher block mode for each

cipher now to

Quoted 2 lines

gain some extra performance like the openssl project? I was under the impression that is in general not worth it.

You mean normal block ciphers? Does it really make that much of a difference?

Yes. Jussi added block mode for RC4 instead that auto block-mode that is prefered over the "automatic" one that is generated otherwise. I don't know how much performance it brings but I would be supprised if it is a lot on an average CPU. With this patch in I think it is a matter of time until we get the AES-CBC & and friends block mode optimized code (which should be a little faster since comparing to calling a function call for the XOR…) you get the idea.

Quoted 2 lines

Sebastian

I made quick tests with aes_generic, added block iterating loop into aes_encrypt() and aes_decrypt() and registered ecb(aes). Encryption 0.97x vs auto block-mode, decryption 1.03x. So I'd think, for real block ciphers, it makes no difference if looping is in ecb-module or in cipher module. ARC4 performance difference can be found in d366db605c8c4a9878589bc4a87e55f6063184ac commit log.

-Jussi