Skip to contentSkip to conversation

Using Intel CRC32 instruction to implement hardware accelerated CRC32c algorithm.]

PATCH austin zhang 3 participants 5 messages Jul 8, 2008 – Jul 10, 2008 1 message not in the archive Crypto API

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Thanks, Herbert, see my reply as below.

Quoted 1 line

1) Utilise the brand new crypto ahash interface (note that it's

When you mentioned ahash, can you give a explanation on it? The brand new crypto interface is different with crypto/api?

Quoted 1 line

designed to support sync just as well as async despite the name)

Do you mean use async_xxx interface?

Quoted 9 lines

to rewrite the crypto/crc32c implementation such that one tfm can be used by multiple users. All that has to be done is to move the state from the tfm into the request object.

2) Convert all crc32c users to use the crypto interface and phase out lib/crc32c completely.

3) Add the Intel-specific crc32c implementation through the crypto API.

Agreed. And which module in crypto is the template for following the crypto API?

Quoted 8 lines

That way none of this iffy testing will be necessary. Even better, most users can share one common tfm and therefore there will only be one test for the CPU flag at boot time rather than every time it's used.

In fact, we could even skip 2) and reimplement lib/crc32c as a wrapper on the crypto crc32c interface with a shared tfm so you don't need to modify its existing users.

Good idea.

Quoted 1 line

Cheers,

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi.

Quoted 2 lines · austin zhang
Quoted 1 line

designed to support sync just as well as async despite the name)

Do you mean use async_xxx interface?

No, async_xxx is very different hardware assist, although it can be converted to cryptoapi too.

Quoted 10 lines
Quoted 9 lines

to rewrite the crypto/crc32c implementation such that one tfm can be used by multiple users. All that has to be done is to move the state from the tfm into the request object.

2) Convert all crc32c users to use the crypto interface and phase out lib/crc32c completely.

3) Add the Intel-specific crc32c implementation through the crypto API.

Agreed. And which module in crypto is the template for following the crypto API?

This is some kind of how cbc(cipher) or ecb(cipher) templates are done:
cbc(aes), cbc(aes-i686) for example.
The same would be possible to do with crc32c but for checksumming (which is effectively a hash).

Signature · 1 line
	Evgeniy Polyakov
maintainer
#3 lore raw
In reply to austin zhang
Quoted 2 lines · austin zhang

Agreed. And which module in crypto is the template for following the crypto API?

I've just converted the crc32c module over to the new interface. You can use this as an example.

Quoted 4 lines
Quoted 3 lines

In fact, we could even skip 2) and reimplement lib/crc32c as a wrapper on the crypto crc32c interface with a shared tfm so you don't need to modify its existing users.

Good idea.

Unfortunately this leads to nasty hacks because the existing interface does chaining in a way that isn't easily mapped over to the crypto API. However this is no great loss since there is a grand total of two users in the tree :)

So my plan is to convert them and then remove the libcrc32c interface completely.

commit d55f7a6c8efa17bcbc3b5d240cc72ed8a71196c2

Author: Herbert Xu <[email protected]>
Date:   Tue Jul 8 20:54:28 2008 +0800

crypto: crc32c - Add ahash implementation

This patch reimplements crc32c using the ahash interface. This allows one tfm to be used by an unlimited number of users provided that they all use the same key (which all current crc32c users do).

crypto/Kconfig +1 -1
index 43b7473..ea50357 100644
@@ -213,7 +213,7 @@ comment "Digest"
 
 config CRYPTO_CRC32C
 	tristate "CRC32c CRC algorithm"
-	select CRYPTO_ALGAPI
+	select CRYPTO_HASH
 	select LIBCRC32C
 	help
 	  Castagnoli, et al Cyclic Redundancy-Check Algorithm.  Used
crypto/crc32c.c +121 -7

176 lines not on this page · raw message

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#4 lore raw
Quoted 2 lines · Herbert Xu

I've just converted the crc32c module over to the new interface. You can use this as an example.

Herbert and Evgeniy,
Sorry for late reply. Thanks a lot for your information and example, I will work out the intel-specific implemetation. After internal discussing and approval, I will post here for review again.

Quoted 7 lines

Unfortunately this leads to nasty hacks because the existing interface does chaining in a way that isn't easily mapped over to the crypto API. However this is no great loss since there is a grand total of two users in the tree :)

So my plan is to convert them and then remove the libcrc32c interface completely.

Because libcrc32c can be a module in original implemetation, so for those other routine which call crc32c_le directly, this may not work for them?

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#5 lore raw
Quoted 6 lines · austin zhang
Quoted 3 lines

So my plan is to convert them and then remove the libcrc32c interface completely.

Because libcrc32c can be a module in original implemetation, so for those other routine which call crc32c_le directly, this may not work for them?

I've looked at them all (there are only three users of crc32c in the tree) and they can all be converted across. I'll wait for ahash to hit Linus's tree before starting the conversion.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt