From 5c96be4d19503d3abe6135a8dd4af1f7e30cbed7 Mon Sep 17 00:00:00 2001 From: toddouska Date: Thu, 12 Nov 2015 15:14:00 -0800 Subject: [PATCH] fix idea conversion warnings --- src/ssl.c | 5 +++-- wolfcrypt/src/idea.c | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index bf94d35a7..85407b815 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -8532,8 +8532,9 @@ int wolfSSL_set_compression(WOLFSSL* ssl) if (enc == 0 || enc == 1) ctx->enc = enc ? 1 : 0; if (key) { - ret = wc_IdeaSetKey(&ctx->cipher.idea, key, ctx->keyLen, iv, - ctx->enc ? IDEA_ENCRYPTION : IDEA_DECRYPTION); + ret = wc_IdeaSetKey(&ctx->cipher.idea, key, (word16)ctx->keyLen, + iv, ctx->enc ? IDEA_ENCRYPTION : + IDEA_DECRYPTION); if (ret != 0) return ret; } diff --git a/wolfcrypt/src/idea.c b/wolfcrypt/src/idea.c index 37df7d62b..712949698 100644 --- a/wolfcrypt/src/idea.c +++ b/wolfcrypt/src/idea.c @@ -211,17 +211,17 @@ void wc_IdeaCipher(Idea *idea, byte* out, const byte* in) x[3] = idea_mult(x[3], idea->skey[skey_idx++]); 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 = idea_mult(t1, idea->skey[skey_idx++]); + t1 = idea_mult((word16)t1, idea->skey[skey_idx++]); t2 = (t1 + t2) & IDEA_MASK; x[0] ^= t1; x[3] ^= t2; t2 ^= x[1]; - x[1] = x[2] ^ t1; - x[2] = t2; + x[1] = x[2] ^ (word16)t1; + x[2] = (word16)t2; } x[0] = idea_mult(x[0], idea->skey[skey_idx++]);