Page MenuHome GnuPG

Improve detached signing and verification speed
Closed, ResolvedPublic

Description

g10/plaintext.c:do_hash() and g10/sign.c:sign_file() use iobuf_get for process data byte-by-byte. This causes significant processing overhead.

Use of iobuf_read here increases signing speed by 2.0x and verify speed by 4.9x (Ryzen 5800X, SHA256, 4.3GiB file).

Patches used for testing:

Event Timeline

jukivili renamed this task from Detached signing and verification unexpectly slow to Improve detached signing and verification speed.Feb 16 2022, 6:52 PM
jukivili claimed this task.
jukivili triaged this task as Normal priority.
jukivili removed a project: Bug Report.

Patches look good for me.
Please go ahead.

Minor nitpicking: I'd prefer use of 32768 for both (now, [PATCH 1/2] uses 32768, while [PATCH 2/2] uses 1<<30)

I used "1<<30" by example of existing code in g10/free-packet.c, which is another place where iobuf_read is reading to NULL.

@werner Could these two patches could be backported to 2.2? These changes give same level of performance increase in 2.2 as seen in 2.3.

Any comments on applying these to gnupg-2.2?

Yes, I'll do that. Thanks for the reminder.

Done (STABLE-BRANCH-2-2.40 for now)