Page MenuHome GnuPG

libgcrypt: (EC)DSA signature generation should be constant-time
Open, WishlistPublic

Description

Current implementation of (EC)DSA signature generation is leaky for K.
Reportedly, for NIST384p curve, timing difference ~800 ns could be observed (by billion of invocations).

Details

Version
1.11

Event Timeline

gniibe triaged this task as Wishlist priority.
gniibe created this task.

This is needed for RFC6979 flag support.

And then, calls of mpi_cmp should be fixed (by using _gcry_mpih_cmp_lli), so that no timing difference by the value of K.

Commit rC35a6a6feb9dc: Fix _gcry_dsa_modify_k. is related, but it doesn't matter for usual compilers (it's an issue for MSVC).

This is needed before we remove leaks by mpi_add in _gcry_dsa_modify_k :

And this is for less leak for _gcry_dsa_modify_k:

And then, we need to use less leaky version of mpi_cmp (because mpi_cmp calls mpi_normalize, it's not good).