From: Dmitry Eremin-Solenikov <dbarysh...@gmail.com> Rename curve functions to use curve names instead of just bits. Otherwise function names can easily become confusing after adding other curves.
Signed-off-by: Dmitry Eremin-Solenikov <dbarysh...@gmail.com> --- arm/ecc-secp192r1-modp.asm | 6 +++--- arm/ecc-secp224r1-modp.asm | 6 +++--- arm/ecc-secp256r1-redc.asm | 6 +++--- arm/ecc-secp384r1-modp.asm | 6 +++--- arm/ecc-secp521r1-modp.asm | 6 +++--- configure.ac | 22 +++++++++++----------- ecc-curve25519.c | 34 +++++++++++++++++----------------- ecc-curve448.c | 24 ++++++++++++------------ ecc-secp192r1.c | 16 ++++++++-------- ecc-secp224r1.c | 16 ++++++++-------- ecc-secp256r1.c | 32 ++++++++++++++++---------------- ecc-secp384r1.c | 16 ++++++++-------- ecc-secp521r1.c | 12 ++++++------ eddsa-sign.c | 2 +- x86_64/ecc-curve25519-modp.asm | 4 ++-- x86_64/ecc-secp192r1-modp.asm | 6 +++--- x86_64/ecc-secp224r1-modp.asm | 6 +++--- x86_64/ecc-secp256r1-redc.asm | 4 ++-- x86_64/ecc-secp384r1-modp.asm | 4 ++-- x86_64/ecc-secp521r1-modp.asm | 4 ++-- 20 files changed, 116 insertions(+), 116 deletions(-) diff --git a/arm/ecc-secp192r1-modp.asm b/arm/ecc-secp192r1-modp.asm index 4680336f1bc7..4c596a168b3d 100644 --- a/arm/ecc-secp192r1-modp.asm +++ b/arm/ecc-secp192r1-modp.asm @@ -49,11 +49,11 @@ define(<H1>, <T1>) define(<C2>, <HP>) define(<C4>, <r12>) - C ecc_192_modp (const struct ecc_modulo *m, mp_limb_t *rp) + C ecc_secp192r1_modp (const struct ecc_modulo *m, mp_limb_t *rp) .text .align 2 -PROLOGUE(_nettle_ecc_192_modp) +PROLOGUE(_nettle_ecc_secp192r1_modp) push {r4,r5,r6,r7,r8,r10} C Reduce two words at a time add HP, RP, #48 @@ -103,4 +103,4 @@ PROLOGUE(_nettle_ecc_192_modp) pop {r4,r5,r6,r7,r8,r10} bx lr -EPILOGUE(_nettle_ecc_192_modp) +EPILOGUE(_nettle_ecc_secp192r1_modp) diff --git a/arm/ecc-secp224r1-modp.asm b/arm/ecc-secp224r1-modp.asm index 400b7a815c2c..67089a0c2981 100644 --- a/arm/ecc-secp224r1-modp.asm +++ b/arm/ecc-secp224r1-modp.asm @@ -48,11 +48,11 @@ define(<L0>, <r11>) define(<L1>, <r12>) define(<L2>, <lr>) - C ecc_224_modp (const struct ecc_modulo *m, mp_limb_t *rp) + C ecc_secp224r1_modp (const struct ecc_modulo *m, mp_limb_t *rp) .text .align 2 -PROLOGUE(_nettle_ecc_224_modp) +PROLOGUE(_nettle_ecc_secp224r1_modp) push {r4,r5,r6,r7,r8,r10,r11,lr} add L2, RP, #28 @@ -121,4 +121,4 @@ PROLOGUE(_nettle_ecc_224_modp) stmdb RP, {T0,T1,T2,T3,T4,T5,T6} pop {r4,r5,r6,r7,r8,r10,r11,pc} -EPILOGUE(_nettle_ecc_224_modp) +EPILOGUE(_nettle_ecc_secp224r1_modp) diff --git a/arm/ecc-secp256r1-redc.asm b/arm/ecc-secp256r1-redc.asm index 7b117de43fbc..f8386c39c9a6 100644 --- a/arm/ecc-secp256r1-redc.asm +++ b/arm/ecc-secp256r1-redc.asm @@ -48,11 +48,11 @@ define(<F1>, <r11>) define(<F2>, <r12>) define(<F3>, <lr>) - C ecc_256_redc (const struct ecc_modulo *m, mp_limb_t *rp) + C ecc_secp256r1_redc (const struct ecc_modulo *m, mp_limb_t *rp) .text .align 2 -PROLOGUE(_nettle_ecc_256_redc) +PROLOGUE(_nettle_ecc_secp256r1_redc) push {r4,r5,r6,r7,r8,r10,r11,lr} ldm RP!, {T0,T1,T2,T3,T4,T5,T6,T7} @@ -170,4 +170,4 @@ PROLOGUE(_nettle_ecc_256_redc) stm RP, {T0,T1,T2,T3,T4,T5,T6,T7} pop {r4,r5,r6,r7,r8,r10,r11,pc} -EPILOGUE(_nettle_ecc_256_redc) +EPILOGUE(_nettle_ecc_secp256r1_redc) diff --git a/arm/ecc-secp384r1-modp.asm b/arm/ecc-secp384r1-modp.asm index dd9a325b09de..1983ee68cdd4 100644 --- a/arm/ecc-secp384r1-modp.asm +++ b/arm/ecc-secp384r1-modp.asm @@ -46,11 +46,11 @@ define(<F4>, <r10>) define(<N>, <r12>) define(<H>, <lr>) - C ecc_384_modp (const struct ecc_modulo *m, mp_limb_t *rp) + C ecc_secp384r1_modp (const struct ecc_modulo *m, mp_limb_t *rp) .text .align 2 -PROLOGUE(_nettle_ecc_384_modp) +PROLOGUE(_nettle_ecc_secp384r1_modp) push {r4,r5,r6,r7,r8,r10,lr} add RP, RP, #80 @@ -267,4 +267,4 @@ PROLOGUE(_nettle_ecc_384_modp) adcs T3, T3, H stm RP!, {T0,T1,T2,T3} C 8-11 pop {r4,r5,r6,r7,r8,r10,pc} -EPILOGUE(_nettle_ecc_384_modp) +EPILOGUE(_nettle_ecc_secp384r1_modp) diff --git a/arm/ecc-secp521r1-modp.asm b/arm/ecc-secp521r1-modp.asm index f11967634689..6d1759ec8a2a 100644 --- a/arm/ecc-secp521r1-modp.asm +++ b/arm/ecc-secp521r1-modp.asm @@ -45,14 +45,14 @@ define(<F3>, <r8>) define(<H>, <r12>) define(<N>, <lr>) - C ecc_521_modp (const struct ecc_modulo *m, mp_limb_t *rp) + C ecc_secp521r1_modp (const struct ecc_modulo *m, mp_limb_t *rp) .text .Lc511: .int 511 .align 2 -PROLOGUE(_nettle_ecc_521_modp) +PROLOGUE(_nettle_ecc_secp521r1_modp) push {r4,r5,r6,r7,r8,lr} C Use that B^17 = 2^23 (mod p) @@ -124,4 +124,4 @@ PROLOGUE(_nettle_ecc_521_modp) stm RP, {T0,T1,T2,F0,F1,F2,F3,H} C 9-16 pop {r4,r5,r6,r7,r8,pc} -EPILOGUE(_nettle_ecc_521_modp) +EPILOGUE(_nettle_ecc_secp521r1_modp) diff --git a/configure.ac b/configure.ac index 745cc2c5c20e..5e340d7abbd4 100644 --- a/configure.ac +++ b/configure.ac @@ -572,18 +572,18 @@ AH_VERBATIM([HAVE_NATIVE], [/* Define to 1 each of the following for which a native (ie. CPU specific) implementation of the corresponding routine exists. */ #undef HAVE_NATIVE_chacha_core -#undef HAVE_NATIVE_ecc_192_modp -#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 -#undef HAVE_NATIVE_ecc_384_redc +#undef HAVE_NATIVE_ecc_curve25519_modp #undef HAVE_NATIVE_ecc_curve448_modp -#undef HAVE_NATIVE_ecc_521_modp -#undef HAVE_NATIVE_ecc_521_redc +#undef HAVE_NATIVE_ecc_secp192r1_modp +#undef HAVE_NATIVE_ecc_secp192r1_redc +#undef HAVE_NATIVE_ecc_secp224r1_modp +#undef HAVE_NATIVE_ecc_secp224r1_redc +#undef HAVE_NATIVE_ecc_secp256r1_modp +#undef HAVE_NATIVE_ecc_secp256r1_redc +#undef HAVE_NATIVE_ecc_secp384r1_modp +#undef HAVE_NATIVE_ecc_secp384r1_redc +#undef HAVE_NATIVE_ecc_secp521r1_modp +#undef HAVE_NATIVE_ecc_secp521r1_redc #undef HAVE_NATIVE_gcm_hash8 #undef HAVE_NATIVE_salsa20_core #undef HAVE_NATIVE_sha1_compress diff --git a/ecc-curve25519.c b/ecc-curve25519.c index 1045db7092ae..2d3cd498ccab 100644 --- a/ecc-curve25519.c +++ b/ecc-curve25519.c @@ -46,11 +46,11 @@ #define PHIGH_BITS (GMP_NUMB_BITS * ECC_LIMB_SIZE - 255) -#if HAVE_NATIVE_ecc_25519_modp +#if HAVE_NATIVE_ecc_curve25519_modp -#define ecc_25519_modp _nettle_ecc_25519_modp +#define ecc_curve25519_modp _nettle_ecc_curve25519_modp void -ecc_25519_modp (const struct ecc_modulo *m, mp_limb_t *rp); +ecc_curve25519_modp (const struct ecc_modulo *m, mp_limb_t *rp); #else #if PHIGH_BITS == 0 @@ -58,7 +58,7 @@ ecc_25519_modp (const struct ecc_modulo *m, mp_limb_t *rp); #endif static void -ecc_25519_modp(const struct ecc_modulo *m UNUSED, mp_limb_t *rp) +ecc_curve25519_modp(const struct ecc_modulo *m UNUSED, mp_limb_t *rp) { mp_limb_t hi, cy; @@ -69,7 +69,7 @@ ecc_25519_modp(const struct ecc_modulo *m UNUSED, mp_limb_t *rp) rp[ECC_LIMB_SIZE-1] = (hi & (GMP_NUMB_MASK >> PHIGH_BITS)) + sec_add_1 (rp, rp, ECC_LIMB_SIZE - 1, 19 * cy); } -#endif /* HAVE_NATIVE_ecc_25519_modp */ +#endif /* HAVE_NATIVE_ecc_curve25519_modp */ #define QHIGH_BITS (GMP_NUMB_BITS * ECC_LIMB_SIZE - 252) @@ -78,7 +78,7 @@ ecc_25519_modp(const struct ecc_modulo *m UNUSED, mp_limb_t *rp) #endif static void -ecc_25519_modq (const struct ecc_modulo *q, mp_limb_t *rp) +ecc_curve25519_modq (const struct ecc_modulo *q, mp_limb_t *rp) { mp_size_t n; mp_limb_t cy; @@ -180,7 +180,7 @@ ecc_mod_pow_252m3 (const struct ecc_modulo *m, /* Needs 5*ECC_LIMB_SIZE scratch space. */ #define ECC_25519_INV_ITCH (5*ECC_LIMB_SIZE) -static void ecc_25519_inv (const struct ecc_modulo *p, +static void ecc_curve25519_inv (const struct ecc_modulo *p, mp_limb_t *rp, const mp_limb_t *ap, mp_limb_t *scratch) { @@ -203,7 +203,7 @@ static void ecc_25519_inv (const struct ecc_modulo *p, /* First, do a canonical reduction, then check if zero */ static int -ecc_25519_zero_p (const struct ecc_modulo *p, mp_limb_t *xp) +ecc_curve25519_zero_p (const struct ecc_modulo *p, mp_limb_t *xp) { mp_limb_t cy; mp_limb_t w; @@ -239,7 +239,7 @@ ecc_25519_zero_p (const struct ecc_modulo *p, mp_limb_t *xp) #define ECC_25519_SQRT_ITCH (9*ECC_LIMB_SIZE) static int -ecc_25519_sqrt(const struct ecc_modulo *p, mp_limb_t *rp, +ecc_curve25519_sqrt(const struct ecc_modulo *p, mp_limb_t *rp, const mp_limb_t *up, const mp_limb_t *vp, mp_limb_t *scratch) { @@ -271,9 +271,9 @@ ecc_25519_sqrt(const struct ecc_modulo *p, mp_limb_t *rp, ecc_mod_sqr (p, x2, rp); ecc_mod_mul (p, vx2, x2, vp); ecc_mod_add (p, t0, vx2, up); - neg = ecc_25519_zero_p (p, t0); + neg = ecc_curve25519_zero_p (p, t0); ecc_mod_sub (p, t0, up, vx2); - pos = ecc_25519_zero_p (p, t0); + pos = ecc_curve25519_zero_p (p, t0); ecc_mod_mul (p, t0, rp, ecc_sqrt_z); cnd_copy (neg, rp, t0, ECC_LIMB_SIZE); @@ -306,10 +306,10 @@ const struct ecc_curve _nettle_curve25519 = NULL, ecc_pp1h, - ecc_25519_modp, - ecc_25519_modp, - ecc_25519_inv, - ecc_25519_sqrt, + ecc_curve25519_modp, + ecc_curve25519_modp, + ecc_curve25519_inv, + ecc_curve25519_sqrt, }, { 253, @@ -325,8 +325,8 @@ const struct ecc_curve _nettle_curve25519 = NULL, ecc_qp1h, - ecc_25519_modq, - ecc_25519_modq, + ecc_curve25519_modq, + ecc_curve25519_modq, ecc_mod_inv, NULL, }, diff --git a/ecc-curve448.c b/ecc-curve448.c index e1318ca4f01d..4a534689546d 100644 --- a/ecc-curve448.c +++ b/ecc-curve448.c @@ -46,12 +46,12 @@ #include "ecc-curve448.h" #if HAVE_NATIVE_ecc_curve448_modp -#define ecc_448_modp _nettle_ecc_curve448_modp +#define ecc_curve448_modp _nettle_ecc_curve448_modp void -ecc_448_modp (const struct ecc_modulo *m, mp_limb_t *rp); +ecc_curve448_modp (const struct ecc_modulo *m, mp_limb_t *rp); #elif GMP_NUMB_BITS == 64 static void -ecc_448_modp(const struct ecc_modulo *m, mp_limb_t *rp) +ecc_curve448_modp(const struct ecc_modulo *m, mp_limb_t *rp) { /* Let B = 2^64, b = 2^32 = sqrt(B). p = B^7 - b B^3 - 1 ==> B^7 = b B^3 + 1 @@ -95,7 +95,7 @@ ecc_448_modp(const struct ecc_modulo *m, mp_limb_t *rp) assert (c7 == 0); } #else -#define ecc_448_modp ecc_mod +#define ecc_curve448_modp ecc_mod #endif /* Needs 2*ecc->size limbs at rp, and 2*ecc->size additional limbs of @@ -167,7 +167,7 @@ ecc_mod_pow_446m224m1 (const struct ecc_modulo *p, /* Needs 6*ECC_LIMB_SIZE scratch space. */ #define ECC_448_INV_ITCH (6*ECC_LIMB_SIZE) -static void ecc_448_inv (const struct ecc_modulo *p, +static void ecc_curve448_inv (const struct ecc_modulo *p, mp_limb_t *rp, const mp_limb_t *ap, mp_limb_t *scratch) { @@ -184,7 +184,7 @@ static void ecc_448_inv (const struct ecc_modulo *p, /* First, do a canonical reduction, then check if zero */ static int -ecc_448_zero_p (const struct ecc_modulo *p, mp_limb_t *xp) +ecc_curve448_zero_p (const struct ecc_modulo *p, mp_limb_t *xp) { mp_limb_t cy; mp_limb_t w; @@ -210,7 +210,7 @@ ecc_448_zero_p (const struct ecc_modulo *p, mp_limb_t *xp) #define ECC_448_SQRT_ITCH (10*ECC_LIMB_SIZE) static int -ecc_448_sqrt(const struct ecc_modulo *p, mp_limb_t *rp, +ecc_curve448_sqrt(const struct ecc_modulo *p, mp_limb_t *rp, const mp_limb_t *up, const mp_limb_t *vp, mp_limb_t *scratch) { @@ -243,7 +243,7 @@ ecc_448_sqrt(const struct ecc_modulo *p, mp_limb_t *rp, ecc_mod_mul (p, vx2, x2, vp); ecc_mod_sub (p, t0, vx2, up); - return ecc_448_zero_p (p, t0); + return ecc_curve448_zero_p (p, t0); #undef u3v #undef u5v3 @@ -274,10 +274,10 @@ const struct ecc_curve _nettle_curve448 = NULL, ecc_pp1h, - ecc_448_modp, - ecc_448_modp, - ecc_448_inv, - ecc_448_sqrt, + ecc_curve448_modp, + ecc_curve448_modp, + ecc_curve448_inv, + ecc_curve448_sqrt, }, { 446, diff --git a/ecc-secp192r1.c b/ecc-secp192r1.c index 15f5f1fa4c04..094074d73ed7 100644 --- a/ecc-secp192r1.c +++ b/ecc-secp192r1.c @@ -48,18 +48,18 @@ #include "ecc-secp192r1.h" -#if HAVE_NATIVE_ecc_192_modp +#if HAVE_NATIVE_ecc_secp192r1_modp -#define ecc_192_modp _nettle_ecc_192_modp +#define ecc_secp192r1_modp _nettle_ecc_secp192r1_modp void -ecc_192_modp (const struct ecc_modulo *m, mp_limb_t *rp); +ecc_secp192r1_modp (const struct ecc_modulo *m, mp_limb_t *rp); /* Use that p = 2^{192} - 2^64 - 1, to eliminate 128 bits at a time. */ #elif GMP_NUMB_BITS == 32 /* p is 6 limbs, p = B^6 - B^2 - 1 */ static void -ecc_192_modp (const struct ecc_modulo *m UNUSED, mp_limb_t *rp) +ecc_secp192r1_modp (const struct ecc_modulo *m UNUSED, mp_limb_t *rp) { mp_limb_t cy; @@ -84,7 +84,7 @@ ecc_192_modp (const struct ecc_modulo *m UNUSED, mp_limb_t *rp) #elif GMP_NUMB_BITS == 64 /* p is 3 limbs, p = B^3 - B - 1 */ static void -ecc_192_modp (const struct ecc_modulo *m UNUSED, mp_limb_t *rp) +ecc_secp192r1_modp (const struct ecc_modulo *m UNUSED, mp_limb_t *rp) { mp_limb_t cy; @@ -107,7 +107,7 @@ ecc_192_modp (const struct ecc_modulo *m UNUSED, mp_limb_t *rp) } #else -#define ecc_192_modp ecc_mod +#define ecc_secp192r1_modp ecc_mod #endif const struct ecc_curve _nettle_secp_192r1 = @@ -126,8 +126,8 @@ const struct ecc_curve _nettle_secp_192r1 = ecc_redc_ppm1, ecc_pp1h, - ecc_192_modp, - ecc_192_modp, + ecc_secp192r1_modp, + ecc_secp192r1_modp, ecc_mod_inv, NULL, }, diff --git a/ecc-secp224r1.c b/ecc-secp224r1.c index 28b938fa3282..e6b43fa61f42 100644 --- a/ecc-secp224r1.c +++ b/ecc-secp224r1.c @@ -40,24 +40,24 @@ #include "ecc.h" #include "ecc-internal.h" -#if HAVE_NATIVE_ecc_224_modp +#if HAVE_NATIVE_ecc_secp224r1_modp #define USE_REDC 0 -#define ecc_224_modp _nettle_ecc_224_modp +#define ecc_secp224r1_modp _nettle_ecc_secp224r1_modp void -ecc_224_modp (const struct ecc_modulo *m, mp_limb_t *rp); +ecc_secp224r1_modp (const struct ecc_modulo *m, mp_limb_t *rp); #else #define USE_REDC (ECC_REDC_SIZE != 0) -#define ecc_224_modp ecc_mod +#define ecc_secp224r1_modp ecc_mod #endif #include "ecc-secp224r1.h" #if ECC_REDC_SIZE < 0 -# define ecc_224_redc ecc_pm1_redc +# define ecc_secp224r1_redc ecc_pm1_redc #elif ECC_REDC_SIZE == 0 -# define ecc_224_redc NULL +# define ecc_secp224r1_redc NULL #else # error Configuration error #endif @@ -78,8 +78,8 @@ const struct ecc_curve _nettle_secp_224r1 = ecc_redc_ppm1, ecc_pp1h, - ecc_224_modp, - USE_REDC ? ecc_224_redc : ecc_224_modp, + ecc_secp224r1_modp, + USE_REDC ? ecc_secp224r1_redc : ecc_secp224r1_modp, ecc_mod_inv, NULL, }, diff --git a/ecc-secp256r1.c b/ecc-secp256r1.c index ed463edf7729..72b337db4560 100644 --- a/ecc-secp256r1.c +++ b/ecc-secp256r1.c @@ -42,7 +42,7 @@ #include "ecc.h" #include "ecc-internal.h" -#if HAVE_NATIVE_ecc_256_redc +#if HAVE_NATIVE_ecc_secp256r1_redc # define USE_REDC 1 #else # define USE_REDC (ECC_REDC_SIZE != 0) @@ -50,27 +50,27 @@ #include "ecc-secp256r1.h" -#if HAVE_NATIVE_ecc_256_redc -# define ecc_256_redc _nettle_ecc_256_redc +#if HAVE_NATIVE_ecc_secp256r1_redc +# define ecc_secp256r1_redc _nettle_ecc_secp256r1_redc void -ecc_256_redc (const struct ecc_modulo *p, mp_limb_t *rp); -#else /* !HAVE_NATIVE_ecc_256_redc */ +ecc_secp256r1_redc (const struct ecc_modulo *p, mp_limb_t *rp); +#else /* !HAVE_NATIVE_ecc_secp256r1_redc */ # if ECC_REDC_SIZE > 0 -# define ecc_256_redc ecc_pp1_redc +# define ecc_secp256r1_redc ecc_pp1_redc # elif ECC_REDC_SIZE == 0 -# define ecc_256_redc NULL +# define ecc_secp256r1_redc NULL # else # error Configuration error # endif -#endif /* !HAVE_NATIVE_ecc_256_redc */ +#endif /* !HAVE_NATIVE_ecc_secp256r1_redc */ #if ECC_BMODP_SIZE < ECC_LIMB_SIZE -#define ecc_256_modp ecc_mod -#define ecc_256_modq ecc_mod +#define ecc_secp256r1_modp ecc_mod +#define ecc_secp256r1_modq ecc_mod #elif GMP_NUMB_BITS == 64 static void -ecc_256_modp (const struct ecc_modulo *p, mp_limb_t *rp) +ecc_secp256r1_modp (const struct ecc_modulo *p, mp_limb_t *rp) { mp_limb_t u1, u0; mp_size_t n; @@ -146,7 +146,7 @@ ecc_256_modp (const struct ecc_modulo *p, mp_limb_t *rp) } static void -ecc_256_modq (const struct ecc_modulo *q, mp_limb_t *rp) +ecc_secp256r1_modq (const struct ecc_modulo *q, mp_limb_t *rp) { mp_limb_t u2, u1, u0; mp_size_t n; @@ -255,8 +255,8 @@ const struct ecc_curve _nettle_secp_256r1 = ecc_redc_ppm1, ecc_pp1h, - ecc_256_modp, - USE_REDC ? ecc_256_redc : ecc_256_modp, + ecc_secp256r1_modp, + USE_REDC ? ecc_secp256r1_redc : ecc_secp256r1_modp, ecc_mod_inv, NULL, }, @@ -274,8 +274,8 @@ const struct ecc_curve _nettle_secp_256r1 = NULL, ecc_qp1h, - ecc_256_modq, - ecc_256_modq, + ecc_secp256r1_modq, + ecc_secp256r1_modq, ecc_mod_inv, NULL, }, diff --git a/ecc-secp384r1.c b/ecc-secp384r1.c index 32f75fb618ba..c4a75564bf58 100644 --- a/ecc-secp384r1.c +++ b/ecc-secp384r1.c @@ -46,10 +46,10 @@ #include "ecc-secp384r1.h" -#if HAVE_NATIVE_ecc_384_modp -#define ecc_384_modp _nettle_ecc_384_modp +#if HAVE_NATIVE_ecc_secp384r1_modp +#define ecc_secp384r1_modp _nettle_ecc_secp384r1_modp void -ecc_384_modp (const struct ecc_modulo *m, mp_limb_t *rp); +ecc_secp384r1_modp (const struct ecc_modulo *m, mp_limb_t *rp); #elif GMP_NUMB_BITS == 32 /* Use that 2^{384} = 2^{128} + 2^{96} - 2^{32} + 1, and eliminate 256 @@ -62,7 +62,7 @@ ecc_384_modp (const struct ecc_modulo *m, mp_limb_t *rp); almost 8 at a time. Do only 7, to avoid additional carry propagation, followed by 5. */ static void -ecc_384_modp (const struct ecc_modulo *p, mp_limb_t *rp) +ecc_secp384r1_modp (const struct ecc_modulo *p, mp_limb_t *rp) { mp_limb_t cy, bw; @@ -106,7 +106,7 @@ ecc_384_modp (const struct ecc_modulo *p, mp_limb_t *rp) /* p is 6 limbs, and B^6 - p = B^2 + 2^32 (B - 1) + 1. Eliminate 3 (almost 4) limbs at a time. */ static void -ecc_384_modp (const struct ecc_modulo *p, mp_limb_t *rp) +ecc_secp384r1_modp (const struct ecc_modulo *p, mp_limb_t *rp) { mp_limb_t tp[6]; mp_limb_t cy; @@ -144,7 +144,7 @@ ecc_384_modp (const struct ecc_modulo *p, mp_limb_t *rp) assert (cy == 0); } #else -#define ecc_384_modp ecc_mod +#define ecc_secp384r1_modp ecc_mod #endif const struct ecc_curve _nettle_secp_384r1 = @@ -163,8 +163,8 @@ const struct ecc_curve _nettle_secp_384r1 = ecc_redc_ppm1, ecc_pp1h, - ecc_384_modp, - ecc_384_modp, + ecc_secp384r1_modp, + ecc_secp384r1_modp, ecc_mod_inv, NULL, }, diff --git a/ecc-secp521r1.c b/ecc-secp521r1.c index d952d77e444e..74688008959b 100644 --- a/ecc-secp521r1.c +++ b/ecc-secp521r1.c @@ -44,10 +44,10 @@ #include "ecc-secp521r1.h" -#if HAVE_NATIVE_ecc_521_modp -#define ecc_521_modp _nettle_ecc_521_modp +#if HAVE_NATIVE_ecc_secp521r1_modp +#define ecc_secp521r1_modp _nettle_ecc_secp521r1_modp void -ecc_521_modp (const struct ecc_modulo *m, mp_limb_t *rp); +ecc_secp521r1_modp (const struct ecc_modulo *m, mp_limb_t *rp); #else @@ -57,7 +57,7 @@ ecc_521_modp (const struct ecc_modulo *m, mp_limb_t *rp); /* Result may be *slightly* larger than 2^521 */ static void -ecc_521_modp (const struct ecc_modulo *m UNUSED, mp_limb_t *rp) +ecc_secp521r1_modp (const struct ecc_modulo *m UNUSED, mp_limb_t *rp) { /* FIXME: Should use mpn_addlsh_n_ip1 */ mp_limb_t hi; @@ -91,8 +91,8 @@ const struct ecc_curve _nettle_secp_521r1 = ecc_redc_ppm1, ecc_pp1h, - ecc_521_modp, - ecc_521_modp, + ecc_secp521r1_modp, + ecc_secp521r1_modp, ecc_mod_inv, NULL, }, diff --git a/eddsa-sign.c b/eddsa-sign.c index 13ae47995e74..2754d20eb932 100644 --- a/eddsa-sign.c +++ b/eddsa-sign.c @@ -87,7 +87,7 @@ _eddsa_sign (const struct ecc_curve *ecc, ecc_modq_mul (ecc, sp, hp, k2); ecc_modq_add (ecc, sp, sp, rp); /* FIXME: Can be plain add */ - /* FIXME: Special code duplicated in ecc_25519_modq and ecc_eh_to_a. + /* FIXME: Special code duplicated in ecc_curve25519_modq and ecc_eh_to_a. Define a suitable method? */ { unsigned shift; diff --git a/x86_64/ecc-curve25519-modp.asm b/x86_64/ecc-curve25519-modp.asm index 0374db12ab44..44dce6df8789 100644 --- a/x86_64/ecc-curve25519-modp.asm +++ b/x86_64/ecc-curve25519-modp.asm @@ -41,7 +41,7 @@ define(<T0>, <%r10>) define(<T1>, <%r11>) define(<M>, <%rbx>) -PROLOGUE(_nettle_ecc_25519_modp) +PROLOGUE(_nettle_ecc_curve25519_modp) W64_ENTRY(2, 0) push %rbx @@ -91,4 +91,4 @@ PROLOGUE(_nettle_ecc_25519_modp) pop %rbx W64_EXIT(2, 0) ret -EPILOGUE(_nettle_ecc_25519_modp) +EPILOGUE(_nettle_ecc_curve25519_modp) diff --git a/x86_64/ecc-secp192r1-modp.asm b/x86_64/ecc-secp192r1-modp.asm index ad8dca7186e4..3a008130c1bb 100644 --- a/x86_64/ecc-secp192r1-modp.asm +++ b/x86_64/ecc-secp192r1-modp.asm @@ -41,10 +41,10 @@ define(<H>, <%r9>) define(<C1>, <%r10>) define(<C2>, <%r11>) - C ecc_192_modp (const struct ecc_modulo *m, mp_limb_t *rp) + C ecc_secp192r1_modp (const struct ecc_modulo *m, mp_limb_t *rp) .text ALIGN(16) -PROLOGUE(_nettle_ecc_192_modp) +PROLOGUE(_nettle_ecc_secp192r1_modp) W64_ENTRY(2, 0) mov 16(RP), T2 mov 24(RP), T3 @@ -85,4 +85,4 @@ PROLOGUE(_nettle_ecc_192_modp) W64_EXIT(2, 0) ret -EPILOGUE(_nettle_ecc_192_modp) +EPILOGUE(_nettle_ecc_secp192r1_modp) diff --git a/x86_64/ecc-secp224r1-modp.asm b/x86_64/ecc-secp224r1-modp.asm index e44b5418e5dd..dfa85a8d6f3f 100644 --- a/x86_64/ecc-secp224r1-modp.asm +++ b/x86_64/ecc-secp224r1-modp.asm @@ -44,8 +44,8 @@ define(<F0>, <%r9>) define(<F1>, <%r10>) define(<F2>, <%r11>) - C ecc_224_modp (const struct ecc_modulo *m, mp_limb_t *rp) -PROLOGUE(_nettle_ecc_224_modp) + C ecc_secp224r1_modp (const struct ecc_modulo *m, mp_limb_t *rp) +PROLOGUE(_nettle_ecc_secp224r1_modp) W64_ENTRY(2, 0) mov 48(RP), H0 mov 56(RP), H1 @@ -128,4 +128,4 @@ PROLOGUE(_nettle_ecc_224_modp) W64_EXIT(2, 0) ret -EPILOGUE(_nettle_ecc_224_modp) +EPILOGUE(_nettle_ecc_secp224r1_modp) diff --git a/x86_64/ecc-secp256r1-redc.asm b/x86_64/ecc-secp256r1-redc.asm index 533a1766d4bc..67da065b27f4 100644 --- a/x86_64/ecc-secp256r1-redc.asm +++ b/x86_64/ecc-secp256r1-redc.asm @@ -58,7 +58,7 @@ define(<FOLD>, < sbb $1, F2 sbb <$>0, F3 >) -PROLOGUE(_nettle_ecc_256_redc) +PROLOGUE(_nettle_ecc_secp256r1_redc) W64_ENTRY(2, 0) C save all registers that need to be saved push %rbx @@ -126,4 +126,4 @@ PROLOGUE(_nettle_ecc_256_redc) pop %rbx W64_EXIT(2, 0) ret -EPILOGUE(_nettle_ecc_256_redc) +EPILOGUE(_nettle_ecc_secp256r1_redc) diff --git a/x86_64/ecc-secp384r1-modp.asm b/x86_64/ecc-secp384r1-modp.asm index 13f469b164e4..9bfa0618d33e 100644 --- a/x86_64/ecc-secp384r1-modp.asm +++ b/x86_64/ecc-secp384r1-modp.asm @@ -51,7 +51,7 @@ define(<C0>, H5) C Overlap define(<TMP>, RP) C Overlap -PROLOGUE(_nettle_ecc_384_modp) +PROLOGUE(_nettle_ecc_secp384r1_modp) W64_ENTRY(2, 0) push %rbx @@ -231,4 +231,4 @@ PROLOGUE(_nettle_ecc_384_modp) W64_EXIT(2, 0) ret -EPILOGUE(_nettle_ecc_384_modp) +EPILOGUE(_nettle_ecc_secp384r1_modp) diff --git a/x86_64/ecc-secp521r1-modp.asm b/x86_64/ecc-secp521r1-modp.asm index 6f4f7d90714d..a6840a60faec 100644 --- a/x86_64/ecc-secp521r1-modp.asm +++ b/x86_64/ecc-secp521r1-modp.asm @@ -48,7 +48,7 @@ define(<U9>, <%r11>) define(<T0>, <%r12>) define(<T1>, <%r13>) -PROLOGUE(_nettle_ecc_521_modp) +PROLOGUE(_nettle_ecc_secp521r1_modp) W64_ENTRY(2, 0) push %rbx push %rbp @@ -155,4 +155,4 @@ PROLOGUE(_nettle_ecc_521_modp) pop %rbx W64_EXIT(2, 0) ret -EPILOGUE(_nettle_ecc_521_modp) +EPILOGUE(_nettle_ecc_secp521r1_modp) -- 2.24.0 _______________________________________________ nettle-bugs mailing list nettle-bugs@lists.lysator.liu.se http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs