linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] crypto: add IV generation templates
@ 2018-07-18  7:30 Xiongfeng Wang
  2018-07-18  7:30 ` [PATCH 1/5] crypto: api - introduce API to (un)register a array of templates Xiongfeng Wang
                   ` (5 more replies)
  0 siblings, 6 replies; 28+ messages in thread
From: Xiongfeng Wang @ 2018-07-18  7:30 UTC (permalink / raw)
  To: agk, snitzer, herbert
  Cc: dm-devel, linux-kernel, wangxiongfeng2, broonie, arnd, jonathan.cameron

Currently, the iv generation algorithms are implemented in dm-crypt.c.
This patchset moves these algorithms from the dm layer to the kernel
crypto layer by implementing them as template ciphers so they
can be implemented in hardware for performance. We modify the dm layer
to send a whole 'bio' rather than a sector at a time, so the dm layer
needs to called into the crypto layer less times. Each bio contains an
in memory representation of physically contiguous disk blocks. The dm
layer sets up a chained scatterlist of these blocks split into physically
contiguous segments in memory so that DMA can be performed.

This patchset is based on the patchset originally started by
Binoy Jayan <binoy.jayan@linaro.org>
( crypto: Add IV generation algorithms
https://patchwork.kernel.org/patch/9803469/ )

I tested the performance of software implemented ciphers before and after
applying this patchset. The performance didn't change much except for 
slight regression when writting. The detail information is as follows.

The command I used:
cryptsetup -y -c aes-xts-plain -s 256 --hash sha256 luksFormat /dev/sdd1
cryptsetup -y -c aes-cbc-essiv:sha256 -s 256 --hash sha256 luksFormat /dev/sdd1
cryptsetup -y -c aes-cbc-benbi -s 256 --hash sha256 luksFormat /dev/sdd1

cryptsetup luksOpen /dev/sdd1 crypt_fun
time dd if=/dev/mapper/crypt_fun of=/dev/null bs=1M count=500 iflag=direct
time dd if=/dev/zero of=/dev/mapper/crypt_fun bs=1M count=500 oflag=direct

Performance comparision:
--------------------------------------------------------
algorithms	| before applying   | 	after applying
--------------------------------------------------------
		|  read  | write    |  read  | write
--------------------------------------------------------
aes-xts-plain 	| 145.34 | 145.09   | 145.89 | 144.2 
--------------------------------------------------------
aes-cbc-essiv 	| 146.87 | 144.62   | 146.74 | 143.41
--------------------------------------------------------
aes-cbc-benbi 	| 146.03 | 144.74   | 146.77 | 144.46
--------------------------------------------------------

Xiongfeng Wang (5):
  crypto: api - introduce API to (un)register a array of templates
  crypto: ccm - use template array registering API to simplify the code
  crypto: gcm - use template array registering API to simplify the code
  crypto: Add IV generation templates
  dm-crypt: modify dm-crypt to rely on IV generation templates

 crypto/Kconfig          |    7 +
 crypto/Makefile         |    1 +
 crypto/algapi.c         |   27 +
 crypto/ccm.c            |   82 +-
 crypto/gcm.c            |   76 +-
 crypto/geniv.c          | 2240 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/md/Kconfig      |    1 +
 drivers/md/dm-crypt.c   | 1697 ++++++++---------------------------
 include/crypto/algapi.h |    2 +
 include/crypto/geniv.h  |   47 +
 10 files changed, 2722 insertions(+), 1458 deletions(-)
 create mode 100644 crypto/geniv.c
 create mode 100644 include/crypto/geniv.h

-- 
1.7.12.4


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2018-07-23  0:13 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-18  7:30 [PATCH 0/5] crypto: add IV generation templates Xiongfeng Wang
2018-07-18  7:30 ` [PATCH 1/5] crypto: api - introduce API to (un)register a array of templates Xiongfeng Wang
2018-07-18  7:30 ` [PATCH 2/5] crypto: ccm - use template array registering API to simplify the code Xiongfeng Wang
2018-07-18  7:30 ` [PATCH 3/5] crypto: gcm " Xiongfeng Wang
2018-07-18  7:30 ` [PATCH 4/5] crypto: Add IV generation templates Xiongfeng Wang
2018-07-18  8:16   ` Milan Broz
2018-07-18  8:48     ` Xiongfeng Wang
2018-07-18 13:11     ` Mike Snitzer
2018-07-18 16:46     ` Mark Brown
2018-07-18 17:17       ` Milan Broz
2018-07-18 17:47         ` Mark Brown
2018-07-19  1:46         ` Xiongfeng Wang
2018-07-19  8:50           ` Arnd Bergmann
2018-07-19  8:54             ` Herbert Xu
2018-07-19 13:30             ` Mark Brown
2018-07-19 18:14   ` kbuild test robot
2018-07-18  7:30 ` [PATCH 5/5] dm-crypt: modify dm-crypt to rely on " Xiongfeng Wang
2018-07-18 10:59 ` [PATCH 0/5] crypto: add " Arnd Bergmann
2018-07-18 15:34   ` Ard Biesheuvel
2018-07-19 10:55     ` Xiongfeng Wang
2018-07-19 14:08       ` Ard Biesheuvel
2018-07-19 15:50         ` Mark Brown
2018-07-20  1:02           ` Ard Biesheuvel
2018-07-20 11:45             ` Mark Brown
2018-07-20 12:23               ` Ard Biesheuvel
2018-07-20 12:32                 ` Mark Brown
2018-07-22 13:39               ` Gilad Ben-Yossef
2018-07-23  0:13                 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).