Skip to contentSkip to conversation

crypto: Add fpu template, a wrapper for blkcipher touching FPU

PATCH In review Huang Ying 2 participants 2 messages Mar 18, 2009 – Mar 29, 2009 Crypto API

lore
Share & tools
lore

Huang Ying

author
#0 lore raw

PATCH 2/3 crypto: Add fpu template, a wrapper for blkcipher touching FPU

Blkcipher touching FPU need to be enclosed by kernel_fpu_begin() and kernel_fpu_end(). If they are invoked in cipher algorithm implementation, they will be invoked for each block, so that performance will be hurt, because they are "slow" operations. This patch implements "fpu" template, which makes these operations to be invoked for each request.

v2: Make FPU mode invisible to end user

---
 crypto/Kconfig  |    5 +
 crypto/Makefile |    1 
 crypto/fpu.c    |  166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 172 insertions(+)
crypto/Kconfig +5 -0
@@ -241,6 +241,11 @@ config CRYPTO_XTS
 	  key size 256, 384 or 512 bits. This implementation currently
 	  can't handle a sectorsize which is not a multiple of 16 bytes.
 
+config CRYPTO_FPU
+	tristate
+	select CRYPTO_BLKCIPHER
+	select CRYPTO_MANAGER
+
 comment "Hash modes"
 
 config CRYPTO_HMAC
crypto/Makefile +1 -0
@@ -53,6 +53,7 @@ obj-$(CONFIG_CRYPTO_PCBC) += pcbc.o
 obj-$(CONFIG_CRYPTO_CTS) += cts.o
 obj-$(CONFIG_CRYPTO_LRW) += lrw.o
 obj-$(CONFIG_CRYPTO_XTS) += xts.o
+obj-$(CONFIG_CRYPTO_FPU) += fpu.o
 obj-$(CONFIG_CRYPTO_CTR) += ctr.o
 obj-$(CONFIG_CRYPTO_GCM) += gcm.o
 obj-$(CONFIG_CRYPTO_CCM) += ccm.o
crypto/fpu.c new file +166 -0

166 lines not on this page · raw message

maintainer
#1 lore raw
Quoted 10 lines · Huang Ying

Blkcipher touching FPU need to be enclosed by kernel_fpu_begin() and kernel_fpu_end(). If they are invoked in cipher algorithm implementation, they will be invoked for each block, so that performance will be hurt, because they are "slow" operations. This patch implements "fpu" template, which makes these operations to be invoked for each request.

v2: Make FPU mode invisible to end user

I've applied all the three patches with no changes except moving fpu.c into arch/x86/crypto.

Thanks,

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