From beb1540064d5da15b51ac94169aaf4d891c5e589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Fri, 22 Aug 2014 19:34:05 +0200 Subject: [PATCH] Prepare for assembly ecc_25519_modp. --- ChangeLog | 8 ++++++++ configure.ac | 3 ++- ecc-25519.c | 9 +++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 404fd4e0..a0d83c88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-08-22 Niels Möller <nisse@lysator.liu.se> + + * ecc-25519.c [HAVE_NATIVE_ecc_25519_modp]: Use assembly version + if available. + + * configure.ac (asm_hogweed_optional_list): Added ecc-25519-modp.asm. + Also add HAVE_NATIVE_ecc_25519_modp to config.h.in. + 2014-08-19 Niels Möller <nisse@lysator.liu.se> * examples/ecc-benchmark.c (bench_curve): Support benchmarking of diff --git a/configure.ac b/configure.ac index 6923d3a3..ddee35c7 100644 --- a/configure.ac +++ b/configure.ac @@ -285,7 +285,7 @@ asm_nettle_optional_list="gcm-hash8.asm" asm_hogweed_optional_list="" if test "x$enable_public_key" = "xyes" ; then asm_hogweed_optional_list="ecc-192-modp.asm ecc-224-modp.asm \ - ecc-256-redc.asm ecc-384-modp.asm ecc-521-modp.asm" + ecc-25519-modp.asm ecc-256-redc.asm ecc-384-modp.asm ecc-521-modp.asm" fi OPT_ASM_NETTLE_SOURCES="" @@ -365,6 +365,7 @@ AH_VERBATIM([HAVE_NATIVE], #undef HAVE_NATIVE_ecc_192_redc #undef HAVE_NATIVE_ecc_224_modp #undef HAVE_NATIVE_ecc_224_redc +#undef HAVE_NATIVE_ecc_25519_modp #undef HAVE_NATIVE_ecc_256_modp #undef HAVE_NATIVE_ecc_256_redc #undef HAVE_NATIVE_ecc_384_modp diff --git a/ecc-25519.c b/ecc-25519.c index e6d402f2..cd6bc4bf 100644 --- a/ecc-25519.c +++ b/ecc-25519.c @@ -41,6 +41,13 @@ #include "ecc-25519.h" +#if HAVE_NATIVE_ecc_25519_modp + +#define ecc_25519_modp nettle_ecc_25519_modp +void +ecc_25519_modp (const struct ecc_curve *ecc, mp_limb_t *rp); +#else + #define HIGH_BITS (GMP_NUMB_BITS * ECC_LIMB_SIZE - 255) #if HIGH_BITS == 0 @@ -60,6 +67,8 @@ ecc_25519_modp(const struct ecc_curve *ecc UNUSED, mp_limb_t *rp) + sec_add_1 (rp, rp, ECC_LIMB_SIZE - 1, 19 * cy); } +#endif /* HAVE_NATIVE_ecc_25519_modp */ + /* Needs 2*ecc->size limbs at rp, and 2*ecc->size additional limbs of scratch space. No overlap allowed. */ static void -- GitLab