mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 04:04:39 +02:00
tiddy up 25519
This commit is contained in:
@@ -1601,13 +1601,8 @@ void bench_ecc25519KeyGen(void)
|
|||||||
{
|
{
|
||||||
ecc25519_key genKey;
|
ecc25519_key genKey;
|
||||||
double start, total, each, milliEach;
|
double start, total, each, milliEach;
|
||||||
int i, ret;
|
int i;
|
||||||
|
|
||||||
ret = wc_InitRng(&rng);
|
|
||||||
if (ret < 0) {
|
|
||||||
printf("InitRNG failed\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* 256 bit */
|
/* 256 bit */
|
||||||
start = current_time(1);
|
start = current_time(1);
|
||||||
|
|
||||||
@@ -1636,12 +1631,6 @@ void bench_ecc25519KeyAgree(void)
|
|||||||
wc_ecc25519_init(&genKey);
|
wc_ecc25519_init(&genKey);
|
||||||
wc_ecc25519_init(&genKey2);
|
wc_ecc25519_init(&genKey2);
|
||||||
|
|
||||||
ret = wc_InitRng(&rng);
|
|
||||||
if (ret < 0) {
|
|
||||||
printf("InitRNG failed\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = wc_ecc25519_make_key(&rng, 32, &genKey);
|
ret = wc_ecc25519_make_key(&rng, 32, &genKey);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
printf("ecc25519_make_key failed\n");
|
printf("ecc25519_make_key failed\n");
|
||||||
|
@@ -17,10 +17,10 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 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
|
#ifdef HAVE_CONFIG_H
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@@ -17,10 +17,10 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 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
|
#ifdef HAVE_ECC25519
|
||||||
|
|
||||||
|
@@ -5068,6 +5068,10 @@ int ecc25519_test(void)
|
|||||||
wc_ecc25519_free(&userB);
|
wc_ecc25519_free(&userB);
|
||||||
wc_ecc25519_free(&userA);
|
wc_ecc25519_free(&userA);
|
||||||
|
|
||||||
|
#if defined(HAVE_HASHDRBG) || defined(NO_RC4)
|
||||||
|
wc_FreeRng(&rng);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_ECC25519 */
|
#endif /* HAVE_ECC25519 */
|
||||||
|
@@ -19,6 +19,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 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
|
#ifdef HAVE_ECC25519
|
||||||
#ifndef WOLF_CRYPT_ECC25519_FE_H
|
#ifndef WOLF_CRYPT_ECC25519_FE_H
|
||||||
#define WOLF_CRYPT_ECC25519_FE_H
|
#define WOLF_CRYPT_ECC25519_FE_H
|
||||||
|
@@ -17,10 +17,10 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 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(tmp0,x3,z3);
|
||||||
fe_sub(tmp1,x2,z2);
|
fe_sub(tmp1,x2,z2);
|
||||||
fe_add(x2,x2,z2);
|
fe_add(x2,x2,z2);
|
||||||
|
@@ -17,10 +17,10 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 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(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_sq(t1,t0); for (i = 1;i < 2;++i) fe_sq(t1,t1);
|
||||||
fe_mul(t1,z,t1);
|
fe_mul(t1,z,t1);
|
||||||
|
@@ -16,6 +16,8 @@ nobase_include_HEADERS+= \
|
|||||||
wolfssl/wolfcrypt/ecc.h \
|
wolfssl/wolfcrypt/ecc.h \
|
||||||
wolfssl/wolfcrypt/ecc25519.h \
|
wolfssl/wolfcrypt/ecc25519.h \
|
||||||
wolfssl/wolfcrypt/ecc25519_fe.h \
|
wolfssl/wolfcrypt/ecc25519_fe.h \
|
||||||
|
wolfssl/wolfcrypt/ecc25519_pow225521.h \
|
||||||
|
wolfssl/wolfcrypt/ecc25519_montgomery.h \
|
||||||
wolfssl/wolfcrypt/error-crypt.h \
|
wolfssl/wolfcrypt/error-crypt.h \
|
||||||
wolfssl/wolfcrypt/fips_test.h \
|
wolfssl/wolfcrypt/fips_test.h \
|
||||||
wolfssl/wolfcrypt/hc128.h \
|
wolfssl/wolfcrypt/hc128.h \
|
||||||
|
Reference in New Issue
Block a user