diff --git a/wolfcrypt/src/sp_int.c b/wolfcrypt/src/sp_int.c index 072801135..b8eb2e339 100644 --- a/wolfcrypt/src/sp_int.c +++ b/wolfcrypt/src/sp_int.c @@ -104,7 +104,9 @@ int sp_init(sp_int* a) { a->used = 0; a->size = SP_INT_DIGITS; - +#ifdef HAVE_WOLF_BIGINT + wc_bigint_init(&a->raw); +#endif return MP_OKAY; } @@ -125,26 +127,44 @@ int sp_init_multi(sp_int* a, sp_int* b, sp_int* c, sp_int* d, sp_int* e, if (a != NULL) { a->used = 0; a->size = SP_INT_DIGITS; + #ifdef HAVE_WOLF_BIGINT + wc_bigint_init(&a->raw); + #endif } if (b != NULL) { b->used = 0; b->size = SP_INT_DIGITS; + #ifdef HAVE_WOLF_BIGINT + wc_bigint_init(&b->raw); + #endif } if (c != NULL) { c->used = 0; c->size = SP_INT_DIGITS; + #ifdef HAVE_WOLF_BIGINT + wc_bigint_init(&c->raw); + #endif } if (d != NULL) { d->used = 0; d->size = SP_INT_DIGITS; + #ifdef HAVE_WOLF_BIGINT + wc_bigint_init(&d->raw); + #endif } if (e != NULL) { e->used = 0; e->size = SP_INT_DIGITS; + #ifdef HAVE_WOLF_BIGINT + wc_bigint_init(&e->raw); + #endif } if (f != NULL) { f->used = 0; f->size = SP_INT_DIGITS; + #ifdef HAVE_WOLF_BIGINT + wc_bigint_init(&f->raw); + #endif } return MP_OKAY; diff --git a/wolfcrypt/src/tfm.c b/wolfcrypt/src/tfm.c index 22e5dea6b..50994c628 100644 --- a/wolfcrypt/src/tfm.c +++ b/wolfcrypt/src/tfm.c @@ -4300,6 +4300,12 @@ void fp_copy(fp_int *a, fp_int *b) } } +int mp_init_copy(fp_int * a, fp_int * b) +{ + fp_init_copy(a, b); + return MP_OKAY; +} + void fp_init_copy(fp_int *a, fp_int* b) { if (a != b) { @@ -5392,13 +5398,6 @@ int mp_div_2_mod_ct(mp_int *a, mp_int *b, mp_int *c) return fp_div_2_mod_ct(a, b, c); } - -int mp_init_copy(fp_int * a, fp_int * b) -{ - fp_init_copy(a, b); - return MP_OKAY; -} - #ifdef HAVE_COMP_KEY int mp_cnt_lsb(fp_int* a) diff --git a/wolfssl/wolfcrypt/sp_int.h b/wolfssl/wolfcrypt/sp_int.h index f616b2471..db8fd4433 100644 --- a/wolfssl/wolfcrypt/sp_int.h +++ b/wolfssl/wolfcrypt/sp_int.h @@ -251,7 +251,7 @@ MP_API int sp_mul_d(sp_int* a, sp_int_digit n, sp_int* r); #define CheckFastMathSettings() 1 -#define mp_free(a) sp_free +#define mp_free sp_free #define mp_isodd sp_isodd #define mp_iseven sp_iseven diff --git a/wolfssl/wolfcrypt/tfm.h b/wolfssl/wolfcrypt/tfm.h index ae216fa3f..fd112a3cb 100644 --- a/wolfssl/wolfcrypt/tfm.h +++ b/wolfssl/wolfcrypt/tfm.h @@ -738,6 +738,7 @@ int fp_sqr_comba64(fp_int *a, fp_int *b); #define mp_tohex(M, S) mp_toradix((M), (S), MP_RADIX_HEX) MP_API int mp_init (mp_int * a); +MP_API int mp_init_copy(fp_int * a, fp_int * b); MP_API void mp_clear (mp_int * a); MP_API void mp_free (mp_int * a); MP_API void mp_forcezero (mp_int * a); @@ -808,7 +809,6 @@ MP_API int mp_radix_size (mp_int * a, int radix, int *size); MP_API int mp_montgomery_setup(fp_int *a, fp_digit *rho); MP_API int mp_div_2(fp_int * a, fp_int * b); MP_API int mp_div_2_mod_ct(mp_int *a, mp_int *b, mp_int *c); - MP_API int mp_init_copy(fp_int * a, fp_int * b); #endif #if defined(HAVE_ECC) || !defined(NO_RSA) || !defined(NO_DSA) || \