forked from wolfSSL/wolfssl
Fix for SP init and free with HAVE_WOLF_BIGINT
. Fix for sp_free macro typo. Fix to expose mp_init_copy
with ECC disabled because its used by mp_test
.
This commit is contained in:
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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) || \
|
||||
|
Reference in New Issue
Block a user