From ff2c93c0ec7ad1d352d9c7240acb6f36398afc54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Fri, 11 Jul 2014 22:06:52 +0200 Subject: [PATCH] New struct ecc_curve constant, edwards_root. --- ChangeLog | 9 +++++++++ ecc-192.c | 1 + ecc-224.c | 1 + ecc-25519.c | 1 + ecc-256.c | 1 + ecc-384.c | 1 + ecc-521.c | 1 + ecc-internal.h | 3 +++ 8 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index dd3c045c..c7177074 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2014-07-11 Niels Möller <nisse@lysator.liu.se> + * ecc-internal.h (struct ecc_curve): New constant edwards_root. + * ecc-192.c (nettle_secp_192r1): Updated accordingly, additional + NULL pointer. + * ecc-224.c (nettle_secp_224r1): Likewise. + * ecc-256.c (nettle_secp_256r1): Likewise. + * ecc-384.c (nettle_secp_384r1): Likewise. + * ecc-521.c (nettle_secp_521r1): Likewise. + * ecc-25519.c (nettle_curve25519): Initialize new constant. + * eccdata.c (ecc_curve_init): For curve 25519, use correct constant for edwards coordinate transform, and output the constant as ecc_edwards. diff --git a/ecc-192.c b/ecc-192.c index 2af501fa..ee898b11 100644 --- a/ecc-192.c +++ b/ecc-192.c @@ -122,6 +122,7 @@ const struct ecc_curve nettle_secp_192r1 = ecc_q, ecc_g, ecc_redc_g, + NULL, ecc_192_modp, ecc_generic_redc, ecc_192_modp, diff --git a/ecc-224.c b/ecc-224.c index 6ed2365b..15abb248 100644 --- a/ecc-224.c +++ b/ecc-224.c @@ -68,6 +68,7 @@ const struct ecc_curve nettle_secp_224r1 = ecc_q, ecc_g, ecc_redc_g, + NULL, ecc_224_modp, ecc_generic_redc, USE_REDC ? ecc_generic_redc : ecc_224_modp, diff --git a/ecc-25519.c b/ecc-25519.c index 890fbe59..25eeed99 100644 --- a/ecc-25519.c +++ b/ecc-25519.c @@ -75,6 +75,7 @@ const struct ecc_curve nettle_curve25519 = ecc_q, ecc_g, ecc_redc_g, + ecc_edwards, ecc_25519_modp, NULL, ecc_25519_modp, diff --git a/ecc-256.c b/ecc-256.c index 2f2297e6..506c9afa 100644 --- a/ecc-256.c +++ b/ecc-256.c @@ -233,6 +233,7 @@ const struct ecc_curve nettle_secp_256r1 = ecc_q, ecc_g, ecc_redc_g, + NULL, ecc_256_modp, ecc_256_redc, USE_REDC ? ecc_256_redc : ecc_256_modp, diff --git a/ecc-384.c b/ecc-384.c index 8bfcb214..e5ec87e5 100644 --- a/ecc-384.c +++ b/ecc-384.c @@ -161,6 +161,7 @@ const struct ecc_curve nettle_secp_384r1 = ecc_q, ecc_g, ecc_redc_g, + NULL, ecc_384_modp, ECC_REDC_SIZE != 0 ? ecc_generic_redc : NULL, ecc_384_modp, diff --git a/ecc-521.c b/ecc-521.c index fc84dfe6..821c9645 100644 --- a/ecc-521.c +++ b/ecc-521.c @@ -89,6 +89,7 @@ const struct ecc_curve nettle_secp_521r1 = ecc_q, ecc_g, ecc_redc_g, + NULL, ecc_521_modp, ecc_generic_redc, ecc_521_modp, diff --git a/ecc-internal.h b/ecc-internal.h index 3d284bd6..8c3b6f78 100644 --- a/ecc-internal.h +++ b/ecc-internal.h @@ -107,6 +107,9 @@ struct ecc_curve const mp_limb_t *g; /* Generator with coordinates in Montgomery form. */ const mp_limb_t *redc_g; + /* If non-NULL, the constant needed for transformation to the + equivalent Edwards curve. */ + const mp_limb_t *edwards_root; ecc_mod_func *modp; ecc_mod_func *redc; -- GitLab