Home GnuPG

mpi/ec: small optimization for ec_mulm_25519

Description

mpi/ec: small optimization for ec_mulm_25519

* mpi/ec.c (ec_addm_25519): Remove one addition.
(ec_subm_25519): Change order of add_n and set_cond to remove
need to clear 'n'.
(ec_mulm_25519): Avoid extra memory copies; Use _gcry_mpih_addmul_1
for multiplying by 19 and adding; Remove one addition at end.

Benchmarks on AMD Ryzen 7 5800X:

Before:
Ed25519 | nanosecs/iter cycles/iter auto Mhz

keygen |         304980       1478913      4849
  sign |         328657       1589657      4837
verify |         625133       3032355      4851

After (~22% faster):
Ed25519 | nanosecs/iter cycles/iter auto Mhz

keygen |         244288       1184862      4850
  sign |         267831       1298934      4850
verify |         504745       2449106      4852
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Apr 15 2021, 11:09 PM
Parents
rC9722da5bfc4a: mpi/longlong.h: fix missing macro parameter parentheses
Branches
Unknown
Tags
Unknown