fix idea conversion warnings

This commit is contained in:
toddouska
2015-11-12 15:14:00 -08:00
parent 806a2748bf
commit 5c96be4d19
2 changed files with 7 additions and 6 deletions

View File

@ -8532,8 +8532,9 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
if (enc == 0 || enc == 1) if (enc == 0 || enc == 1)
ctx->enc = enc ? 1 : 0; ctx->enc = enc ? 1 : 0;
if (key) { if (key) {
ret = wc_IdeaSetKey(&ctx->cipher.idea, key, ctx->keyLen, iv, ret = wc_IdeaSetKey(&ctx->cipher.idea, key, (word16)ctx->keyLen,
ctx->enc ? IDEA_ENCRYPTION : IDEA_DECRYPTION); iv, ctx->enc ? IDEA_ENCRYPTION :
IDEA_DECRYPTION);
if (ret != 0) if (ret != 0)
return ret; return ret;
} }

View File

@ -211,17 +211,17 @@ void wc_IdeaCipher(Idea *idea, byte* out, const byte* in)
x[3] = idea_mult(x[3], idea->skey[skey_idx++]); x[3] = idea_mult(x[3], idea->skey[skey_idx++]);
t2 = x[0] ^ x[2]; t2 = x[0] ^ x[2];
t2 = idea_mult(t2, idea->skey[skey_idx++]); t2 = idea_mult((word16)t2, idea->skey[skey_idx++]);
t1 = (t2 + (x[1] ^ x[3])) & IDEA_MASK; t1 = (t2 + (x[1] ^ x[3])) & IDEA_MASK;
t1 = idea_mult(t1, idea->skey[skey_idx++]); t1 = idea_mult((word16)t1, idea->skey[skey_idx++]);
t2 = (t1 + t2) & IDEA_MASK; t2 = (t1 + t2) & IDEA_MASK;
x[0] ^= t1; x[0] ^= t1;
x[3] ^= t2; x[3] ^= t2;
t2 ^= x[1]; t2 ^= x[1];
x[1] = x[2] ^ t1; x[1] = x[2] ^ (word16)t1;
x[2] = t2; x[2] = (word16)t2;
} }
x[0] = idea_mult(x[0], idea->skey[skey_idx++]); x[0] = idea_mult(x[0], idea->skey[skey_idx++]);