Merge pull request #223 from cconlon/vswarnings

fix Visual Studio warnings
pull/230/head
toddouska 2015-12-28 11:55:13 -08:00
commit c3df8af997
3 changed files with 27 additions and 20 deletions

View File

@ -10088,12 +10088,14 @@ static void PickHashSigAlgo(WOLFSSL* ssl,
{
int i;
/* add in the extensions length */
c16toa(HELLO_EXT_LEN + ssl->suites->hashSigAlgoSz, output + idx);
c16toa((word16)(HELLO_EXT_LEN + ssl->suites->hashSigAlgoSz),
output + idx);
idx += 2;
c16toa(HELLO_EXT_SIG_ALGO, output + idx);
idx += 2;
c16toa(HELLO_EXT_SIGALGO_SZ+ssl->suites->hashSigAlgoSz, output+idx);
c16toa((word16)(HELLO_EXT_SIGALGO_SZ + ssl->suites->hashSigAlgoSz),
output+idx);
idx += 2;
c16toa(ssl->suites->hashSigAlgoSz, output + idx);
idx += 2;
@ -14886,8 +14888,8 @@ int DoSessionTicket(WOLFSSL* ssl,
&& ssl->version.minor != DTLSv1_2_MINOR && pv.minor != DTLS_MINOR
&& pv.minor != DTLSv1_2_MINOR)) {
byte haveRSA = 0;
byte havePSK = 0;
word16 haveRSA = 0;
word16 havePSK = 0;
if (!ssl->options.downgrade) {
WOLFSSL_MSG("Client trying to connect with lesser version");

View File

@ -468,8 +468,8 @@ int wolfSSL_GetObjectSize(void)
int wolfSSL_SetTmpDH(WOLFSSL* ssl, const unsigned char* p, int pSz,
const unsigned char* g, int gSz)
{
byte havePSK = 0;
byte haveRSA = 1;
word16 havePSK = 0;
word16 haveRSA = 1;
WOLFSSL_ENTER("wolfSSL_SetTmpDH");
if (ssl == NULL || p == NULL || g == NULL) return BAD_FUNC_ARG;
@ -1983,8 +1983,8 @@ int wolfSSL_SetMinVersion(WOLFSSL* ssl, int version)
int wolfSSL_SetVersion(WOLFSSL* ssl, int version)
{
byte haveRSA = 1;
byte havePSK = 0;
word16 haveRSA = 1;
word16 havePSK = 0;
WOLFSSL_ENTER("wolfSSL_SetVersion");
@ -5971,8 +5971,8 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl,
int wolfSSL_accept(WOLFSSL* ssl)
{
byte havePSK = 0;
byte haveAnon = 0;
word16 havePSK = 0;
word16 haveAnon = 0;
WOLFSSL_ENTER("SSL_accept()");
#ifdef HAVE_ERRNO_H
@ -7494,8 +7494,8 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
void wolfSSL_set_accept_state(WOLFSSL* ssl)
{
byte haveRSA = 1;
byte havePSK = 0;
word16 haveRSA = 1;
word16 havePSK = 0;
WOLFSSL_ENTER("SSL_set_accept_state");
ssl->options.side = WOLFSSL_SERVER_END;
@ -11768,7 +11768,12 @@ int wolfSSL_BN_is_bit_set(const WOLFSSL_BIGNUM* bn, int n)
return SSL_FAILURE;
}
return mp_is_bit_set((mp_int*)bn->internal, n);
if (n > DIGIT_BIT) {
WOLFSSL_MSG("input bit count too large");
return SSL_FAILURE;
}
return mp_is_bit_set((mp_int*)bn->internal, (mp_digit)n);
}
/* return code compliant with OpenSSL :

View File

@ -665,7 +665,7 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c)
rr = (*tmpc >> shift) & mask;
/* shift the current word and OR in the carry */
*tmpc = ((*tmpc << d) | r) & MP_MASK;
*tmpc = (mp_digit)(((*tmpc << d) | r) & MP_MASK);
++tmpc;
/* set the carry to the carry bits of the current word */
@ -1262,7 +1262,7 @@ int mp_cmp_d(mp_int * a, mp_digit b)
void mp_set (mp_int * a, mp_digit b)
{
mp_zero (a);
a->dp[0] = b & MP_MASK;
a->dp[0] = (mp_digit)(b & MP_MASK);
a->used = (a->dp[0] != 0) ? 1 : 0;
}
@ -2089,7 +2089,7 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho)
/* rho = -1/m mod b */
/* TAO, switched mp_word casts to mp_digit to shut up compiler */
*rho = (((mp_digit)1 << ((mp_digit) DIGIT_BIT)) - x) & MP_MASK;
*rho = (mp_digit)((((mp_digit)1 << ((mp_digit) DIGIT_BIT)) - x) & MP_MASK);
return MP_OKAY;
}
@ -2719,7 +2719,7 @@ int mp_mul_2(mp_int * a, mp_int * b)
rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1));
/* now shift up this digit, add in the carry [from the previous] */
*tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK;
*tmpb++ = (mp_digit)(((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK);
/* copy the carry that would be from the source
* digit into the next iteration
@ -2929,7 +2929,7 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b)
mp_digit *tmpb;
tmpb = b->dp;
for (ix = 0; ix < pa; ix++) {
*tmpb++ = W[ix] & MP_MASK;
*tmpb++ = (mp_digit)(W[ix] & MP_MASK);
}
/* clear unused digits [that existed in the old copy of c] */
@ -3018,7 +3018,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
}
/* store term */
W[ix] = ((mp_digit)_W) & MP_MASK;
W[ix] = (mp_digit)(((mp_digit)_W) & MP_MASK);
/* make next carry */
_W = _W >> ((mp_word)DIGIT_BIT);
@ -3741,7 +3741,7 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
}
/* store term */
W[ix] = ((mp_digit)_W) & MP_MASK;
W[ix] = (mp_digit)(((mp_digit)_W) & MP_MASK);
/* make next carry */
_W = _W >> ((mp_word)DIGIT_BIT);