1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00
Jussi Kivilinna 9116fd1e9a
g10: Avoid extra hash contexts when decrypting MDC input
* g10/mainproc.c (mainproc_context): New member
'seen_pkt_encrypted_mdc'.
(release_list): Clear 'seen_pkt_encrypted_mdc'.
(proc_encrypted): Set 'seen_pkt_encrypted_mdc'.
(have_seen_pkt_encrypted_aead): Rename to...
(have_seen_pkt_encrypted_aead_or_mdc): ...this and add check for
'seen_pkt_encrypted_mdc'.
(proc_plaintext): Do not enable extra hash contexts when decrypting
MDC input.
--

Avoiding extra hash contexts speeds up CFB/MDC decryption quite
a lot. For example, decrypting symmetric-key AES-256 encrypted
4 GiB file from RAM to /dev/null sees ~3.4x speed increase on
AMD Ryzen 5800X:

 AES256.CFB encryption: 783 MB/s
 AES256.CFB decryption: 386 MB/s (before)
 AES256.CFB encryption: 1.3 GB/s (after patch)

Note, AEAD is still significantly faster:

 AES256.OCB encryption: 2.2 GB/s
 AES256.OCB decryption: 3.0 GB/s

GnuPG-bug-id: T5820
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
(cherry picked from commit ab177eed514f7f3432d78e7e6521ad24cc0f4762)

Even 2.2 with the older Libgcrypt 1.8 gets a threefold speedup; see
https://dev.gnupg.org/T5820#155447 (AES-128 vs. AES-256 does not make
a substanial difference)

Signed-off-by: Werner Koch <wk@gnupg.org>
2022-02-24 14:14:48 +01:00
..
2019-05-14 11:24:35 +09:00
2018-05-31 12:08:22 +02:00
2019-06-23 20:17:47 -04:00
2021-11-13 21:02:22 +01:00
2015-02-04 09:15:34 +01:00
2018-03-08 14:08:51 +09:00
2017-03-07 20:25:54 +09:00
2017-03-07 20:25:54 +09:00
2021-03-11 11:32:00 +01:00
2020-10-28 18:10:01 +01:00
2017-03-07 20:25:54 +09:00
2020-04-16 08:36:28 +02:00
2017-03-07 20:25:54 +09:00
2017-01-23 19:16:55 +01:00
2020-10-28 18:10:01 +01:00
2017-02-21 13:11:46 -05:00
2017-03-07 20:32:09 +09:00
2017-03-07 20:25:54 +09:00
2017-04-28 10:06:33 +09:00
2016-03-08 14:08:49 +01:00
2016-12-06 12:16:56 +01:00