Home GnuPG
Diffusion GnuPG 15b8d100c9c8

g10/plaintext: do_hash: use iobuf_read for higher performance

Description

g10/plaintext: do_hash: use iobuf_read for higher performance

* g10/plaintext.c (do_hash): Use iobuf_read instead of iobuf_get for
reading data; Use gcry_md_write instead of gcry_md_putc for hash data.

This patch reduces iobuf_read per byte processing overhead and speeds
up detached signature verifying.

Detached verifying speed on AMD Ryzen 5800X (4.3GiB file, SHA256):

gpg process
user time

before: 9.410s
after: 1.913s (4.9x faster)

(cherry picked from commit 4e27b9defc608f1fa31ca50f1ed1d5761b73b480)

  • GnuPG-bug-id: T5826
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Feb 10 2022, 6:53 PM
wernerCommitted on Nov 29 2022, 11:48 AM
Parents
rG11f323271671: gpg: Make --require-compliance work with out --status-fd
Branches
Unknown
Tags
Unknown
Tasks
T5826: Improve detached signing and verification speed