From b18fdea2ce1e83b72d03145c23c87b59f5732a59 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Wed, 14 Feb 2018 11:09:20 +1000 Subject: [PATCH] Fixes from code review --- wolfcrypt/src/ecc.c | 4 ++-- wolfcrypt/src/sp_int.c | 4 ++-- wolfssl/wolfcrypt/sp_int.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 3f81ecf8a..56db84c10 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -5785,6 +5785,7 @@ int wc_ecc_sig_size(ecc_key* key) #ifndef WOLFSSL_SP_MATH + /** Our FP cache */ typedef struct { ecc_point* g; /* cached COPY of base point */ @@ -5802,7 +5803,6 @@ static THREAD_LS_T fp_cache_t fp_cache[FP_ENTRIES]; static volatile int initMutex = 0; /* prevent multiple mutex inits */ static wolfSSL_Mutex ecc_fp_lock; #endif /* HAVE_THREAD_LS */ -#endif /* WOLFSSL_SP_MATH */ /* simple table to help direct the generation of the LUT */ static const struct { @@ -6334,7 +6334,7 @@ static const struct { #endif }; -#ifndef WOLFSSL_SP_MATH + /* find a hole and free as required, return -1 if no hole found */ static int find_hole(void) { diff --git a/wolfcrypt/src/sp_int.c b/wolfcrypt/src/sp_int.c index 3b5b3b236..24898160e 100644 --- a/wolfcrypt/src/sp_int.c +++ b/wolfcrypt/src/sp_int.c @@ -276,7 +276,7 @@ int sp_leading_bit(sp_int* a) d = a->dp[a->used - 1]; while (d > (sp_int_digit)0xff) d >>= 8; - bit = d >> 7; + bit = (int)(d >> 7); } return bit; @@ -465,7 +465,7 @@ int sp_add(sp_int* a, sp_int* b, sp_int* r) c = r->dp[i] == 0; } r->dp[i] = c; - a->used = i + c; + a->used = (int)(i + c); return MP_OKAY; } diff --git a/wolfssl/wolfcrypt/sp_int.h b/wolfssl/wolfcrypt/sp_int.h index bf3dd8ae6..6924bf982 100644 --- a/wolfssl/wolfcrypt/sp_int.h +++ b/wolfssl/wolfcrypt/sp_int.h @@ -91,7 +91,7 @@ typedef struct sp_int { WOLFSSL_LOCAL int sp_init(sp_int* a); -WOLFSSL_LOCAL int sp_init_multi(sp_int* a, sp_int* b, sp_int* c, sp_int* d, +WOLFSSL_API int sp_init_multi(sp_int* a, sp_int* b, sp_int* c, sp_int* d, sp_int* e, sp_int* f); WOLFSSL_LOCAL void sp_clear(sp_int* a); WOLFSSL_LOCAL int sp_unsigned_bin_size(sp_int* a);