Stephan Müller
43490e8046
crypto: drbg - in-place cipher operation for CTR
The cipher implementations of the kernel crypto API favor in-place
cipher operations. Thus, switch the CTR cipher operation in the DRBG to
perform in-place operations. This is implemented by using the output
buffer as input buffer and zeroizing it before the cipher operation to
implement a CTR encryption of a NULL buffer.
The speed improvement is quite visibile with the following comparison
using the LRNG implementation.
Without the patch set:
16 bytes| 12.267661 MB/s| 61338304 bytes | 5000000213 ns
32 bytes| 23.603770 MB/s| 118018848 bytes | 5000000073 ns
64 bytes| 46.732262 MB/s| 233661312 bytes | 5000000241 ns
128 bytes| 90.038042 MB/s| 450190208 bytes | 5000000244 ns
256 bytes| 160.399616 MB/s| 801998080 bytes | 5000000393 ns
512 bytes| 259.878400 MB/s| 1299392000 bytes | 5000001675 ns
1024 bytes| 386.050662 MB/s| 1930253312 bytes | 5000001661 ns
2048 bytes| 493.641728 MB/s| 2468208640 bytes | 5000001598 ns
4096 bytes| 581.835981 MB/s| 2909179904 bytes | 5000003426 ns
With the patch set:
16 bytes | 17.051142 MB/s | 85255712 bytes | 5000000854 ns
32 bytes | 32.695898 MB/s | 163479488 bytes | 5000000544 ns
64 bytes | 64.490739 MB/s | 322453696 bytes | 5000000954 ns
128 bytes | 123.285043 MB/s | 616425216 bytes | 5000000201 ns
256 bytes | 233.434573 MB/s | 1167172864 bytes | 5000000573 ns
512 bytes | 384.405197 MB/s | 1922025984 bytes | 5000000671 ns
1024 bytes | 566.313370 MB/s | 2831566848 bytes | 5000001080 ns
2048 bytes | 744.518042 MB/s | 3722590208 bytes | 5000000926 ns
4096 bytes | 867.501670 MB/s | 4337508352 bytes | 5000002181 ns
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2018-08-03 18:05:48 +08:00
..
2018-03-03 00:03:17 +08:00
2016-10-25 11:08:31 +08:00
2018-01-12 23:03:39 +11:00
2017-11-02 11:10:55 +01:00
2017-06-10 12:04:29 +08:00
2018-04-21 00:58:32 +08:00
2013-10-16 20:56:25 +08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2016-11-28 21:23:21 +08:00
2017-11-29 17:33:33 +11:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2008-01-11 08:16:41 +11:00
2017-11-02 11:10:55 +01:00
2018-07-09 00:26:22 +08:00
2018-08-03 18:05:48 +08:00
2017-10-12 22:55:00 +08:00
2018-02-15 23:26:50 +08:00
2017-09-22 17:43:08 +08:00
2017-11-03 21:50:43 +08:00
2017-11-02 11:10:55 +01:00
2015-12-20 15:27:12 +02:00
2018-03-16 23:35:52 +08:00
2017-11-02 11:10:55 +01:00
2018-06-28 10:40:47 -07:00
2017-07-18 17:50:57 +08:00
2017-12-11 22:29:54 +11:00
2017-11-02 11:10:55 +01:00
2018-05-19 00:15:18 +08:00
2018-05-19 00:15:18 +08:00
2018-05-19 00:15:00 +08:00
2017-12-22 19:29:08 +11:00
2011-01-07 14:52:00 +11:00
2010-01-07 15:57:19 +11:00
2016-04-06 16:14:24 +01:00
2018-01-12 23:03:14 +11:00
2017-04-04 14:10:13 -07:00
2015-06-04 15:05:08 +08:00
2016-07-18 17:35:50 +08:00
2017-11-02 11:10:55 +01:00
2015-04-10 21:39:39 +08:00
2018-01-26 01:10:34 +11:00
2015-04-10 21:39:39 +08:00
2015-04-10 21:39:39 +08:00
2018-06-22 23:03:05 +08:00
2018-01-12 23:03:39 +11:00
2017-09-22 17:43:07 +08:00
2017-09-22 17:43:07 +08:00
2018-05-05 14:52:51 +08:00
2018-02-22 22:16:54 +08:00
2017-11-02 11:10:55 +01:00
2018-03-03 00:03:33 +08:00