From 3998cd72286ec754433ff9a7bde7f3ebadb1bdaf Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 25 Nov 2017 18:00:19 +0100 Subject: [PATCH] destatic fe25519_pow22523() --- .../crypto_core/curve25519/core_curve25519.c | 55 ------------------- .../crypto_core/ed25519/ref10/ed25519_ref10.c | 2 +- .../include/sodium/private/ed25519_ref10.h | 1 + 3 files changed, 2 insertions(+), 56 deletions(-) diff --git a/src/libsodium/crypto_core/curve25519/core_curve25519.c b/src/libsodium/crypto_core/curve25519/core_curve25519.c index 40a3cca4..9e00ebb3 100644 --- a/src/libsodium/crypto_core/curve25519/core_curve25519.c +++ b/src/libsodium/crypto_core/curve25519/core_curve25519.c @@ -66,61 +66,6 @@ has_small_order(const unsigned char s[32]) return (int) ((k >> 8) & 1); } -static void -fe25519_pow22523(fe25519 out, const fe25519 z) -{ - fe25519 t0; - fe25519 t1; - fe25519 t2; - int i; - - fe25519_sq(t0, z); - fe25519_sq(t1, t0); - fe25519_sq(t1, t1); - fe25519_mul(t1, z, t1); - fe25519_mul(t0, t0, t1); - fe25519_sq(t0, t0); - fe25519_mul(t0, t1, t0); - fe25519_sq(t1, t0); - for (i = 1; i < 5; ++i) { - fe25519_sq(t1, t1); - } - fe25519_mul(t0, t1, t0); - fe25519_sq(t1, t0); - for (i = 1; i < 10; ++i) { - fe25519_sq(t1, t1); - } - fe25519_mul(t1, t1, t0); - fe25519_sq(t2, t1); - for (i = 1; i < 20; ++i) { - fe25519_sq(t2, t2); - } - fe25519_mul(t1, t2, t1); - fe25519_sq(t1, t1); - for (i = 1; i < 10; ++i) { - fe25519_sq(t1, t1); - } - fe25519_mul(t0, t1, t0); - fe25519_sq(t1, t0); - for (i = 1; i < 50; ++i) { - fe25519_sq(t1, t1); - } - fe25519_mul(t1, t1, t0); - fe25519_sq(t2, t1); - for (i = 1; i < 100; ++i) { - fe25519_sq(t2, t2); - } - fe25519_mul(t1, t2, t1); - fe25519_sq(t1, t1); - for (i = 1; i < 50; ++i) { - fe25519_sq(t1, t1); - } - fe25519_mul(t0, t1, t0); - fe25519_sq(t0, t0); - fe25519_sq(t0, t0); - fe25519_mul(out, t0, z); -} - static int is_on_main_subgroup(const fe25519 x1) { diff --git a/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c b/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c index 84eed89a..b745cec4 100644 --- a/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c +++ b/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c @@ -108,7 +108,7 @@ fe25519_invert(fe25519 out, const fe25519 z) fe25519_mul(out, t1, t0); } -static void +void fe25519_pow22523(fe25519 out, const fe25519 z) { fe25519 t0; diff --git a/src/libsodium/include/sodium/private/ed25519_ref10.h b/src/libsodium/include/sodium/private/ed25519_ref10.h index 42fcd981..713b6550 100644 --- a/src/libsodium/include/sodium/private/ed25519_ref10.h +++ b/src/libsodium/include/sodium/private/ed25519_ref10.h @@ -17,6 +17,7 @@ typedef int32_t fe25519[10]; void fe25519_invert(fe25519 out, const fe25519 z); void fe25519_frombytes(fe25519 h, const unsigned char *s); +void fe25519_pow22523(fe25519 out, const fe25519 z); void fe25519_tobytes(unsigned char *s, const fe25519 h); #ifdef HAVE_TI_MODE