diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index d5cccd9ab..86a2179e4 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -1601,13 +1601,8 @@ void bench_ecc25519KeyGen(void) { ecc25519_key genKey; double start, total, each, milliEach; - int i, ret; + int i; - ret = wc_InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } /* 256 bit */ start = current_time(1); @@ -1636,12 +1631,6 @@ void bench_ecc25519KeyAgree(void) wc_ecc25519_init(&genKey); wc_ecc25519_init(&genKey2); - ret = wc_InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - ret = wc_ecc25519_make_key(&rng, 32, &genKey); if (ret != 0) { printf("ecc25519_make_key failed\n"); diff --git a/wolfcrypt/src/ecc25519.c b/wolfcrypt/src/ecc25519.c index 8e7dc2e0d..0c3a34c87 100644 --- a/wolfcrypt/src/ecc25519.c +++ b/wolfcrypt/src/ecc25519.c @@ -17,10 +17,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * From Daniel J Bernstein's curve25519 ref10 work. */ + /* Based On Daniel J Bernstein's curve25519 Public Domain ref10 work. */ + #ifdef HAVE_CONFIG_H #include diff --git a/wolfcrypt/src/ecc25519_fe.c b/wolfcrypt/src/ecc25519_fe.c index 9ced36bca..c0479d779 100644 --- a/wolfcrypt/src/ecc25519_fe.c +++ b/wolfcrypt/src/ecc25519_fe.c @@ -17,10 +17,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * From Daniel J Bernstein's curve25519 ref10 work. */ + /* Based On Daniel J Bernstein's curve25519 Public Domain ref10 work. */ + #ifdef HAVE_ECC25519 diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 595950e69..43e2c7744 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -5068,6 +5068,10 @@ int ecc25519_test(void) wc_ecc25519_free(&userB); wc_ecc25519_free(&userA); +#if defined(HAVE_HASHDRBG) || defined(NO_RC4) + wc_FreeRng(&rng); +#endif + return 0; } #endif /* HAVE_ECC25519 */ diff --git a/wolfssl/wolfcrypt/ecc25519_fe.h b/wolfssl/wolfcrypt/ecc25519_fe.h index c27d9e7c7..8e7f65cc7 100644 --- a/wolfssl/wolfcrypt/ecc25519_fe.h +++ b/wolfssl/wolfcrypt/ecc25519_fe.h @@ -19,6 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + /* Based On Daniel J Bernstein's curve25519 Public Domain ref10 work. */ + #ifdef HAVE_ECC25519 #ifndef WOLF_CRYPT_ECC25519_FE_H #define WOLF_CRYPT_ECC25519_FE_H diff --git a/wolfssl/wolfcrypt/ecc25519_montgomery.h b/wolfssl/wolfcrypt/ecc25519_montgomery.h index d949f3ff1..4d1e37ca2 100644 --- a/wolfssl/wolfcrypt/ecc25519_montgomery.h +++ b/wolfssl/wolfcrypt/ecc25519_montgomery.h @@ -17,10 +17,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * From Daniel J Bernstein's curve25519 ref10 work. */ + /* Based On Daniel J Bernstein's curve25519 Public Domain ref10 work. */ + fe_sub(tmp0,x3,z3); fe_sub(tmp1,x2,z2); fe_add(x2,x2,z2); diff --git a/wolfssl/wolfcrypt/ecc25519_pow225521.h b/wolfssl/wolfcrypt/ecc25519_pow225521.h index 1082ee6bf..2c2ca5b60 100644 --- a/wolfssl/wolfcrypt/ecc25519_pow225521.h +++ b/wolfssl/wolfcrypt/ecc25519_pow225521.h @@ -17,10 +17,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * From Daniel J Bernstein's curve25519 ref10 work. */ + /* Based On Daniel J Bernstein's curve25519 Public Domain ref10 work. */ + fe_sq(t0,z); for (i = 1;i < 1;++i) fe_sq(t0,t0); fe_sq(t1,t0); for (i = 1;i < 2;++i) fe_sq(t1,t1); fe_mul(t1,z,t1); diff --git a/wolfssl/wolfcrypt/include.am b/wolfssl/wolfcrypt/include.am index 1e7209d99..c05f0a46a 100644 --- a/wolfssl/wolfcrypt/include.am +++ b/wolfssl/wolfcrypt/include.am @@ -16,6 +16,8 @@ nobase_include_HEADERS+= \ wolfssl/wolfcrypt/ecc.h \ wolfssl/wolfcrypt/ecc25519.h \ wolfssl/wolfcrypt/ecc25519_fe.h \ + wolfssl/wolfcrypt/ecc25519_pow225521.h \ + wolfssl/wolfcrypt/ecc25519_montgomery.h \ wolfssl/wolfcrypt/error-crypt.h \ wolfssl/wolfcrypt/fips_test.h \ wolfssl/wolfcrypt/hc128.h \