diff --git a/libs/srtp/crypto/cipher/aes_icm.c b/libs/srtp/crypto/cipher/aes_icm.c index 1f9bcbd97c..ff330ffd81 100644 --- a/libs/srtp/crypto/cipher/aes_icm.c +++ b/libs/srtp/crypto/cipher/aes_icm.c @@ -49,6 +49,9 @@ #include "aes_icm.h" #include "alloc.h" +#ifdef _MSC_VER +#pragma warning(disable:4100) +#endif debug_module_t mod_aes_icm = { 0, /* debugging is off by default */ @@ -378,7 +381,7 @@ aes_icm_encrypt_ismacryp(aes_icm_ctx_t *c, for (i=0; i < (bytes_to_encr/sizeof(v128_t)); i++) { /* fill buffer with new keystream */ - aes_icm_advance_ismacryp(c, forIsmacryp); + aes_icm_advance_ismacryp(c, (uint8_t)forIsmacryp); /* * add keystream into the data buffer (this would be a lot faster @@ -426,7 +429,7 @@ aes_icm_encrypt_ismacryp(aes_icm_ctx_t *c, if ((bytes_to_encr & 0xf) != 0) { /* fill buffer with new keystream */ - aes_icm_advance_ismacryp(c, forIsmacryp); + aes_icm_advance_ismacryp(c, (uint8_t)forIsmacryp); for (i=0; i < (bytes_to_encr & 0xf); i++) *buf++ ^= c->keystream_buffer.v8[i]; diff --git a/libs/srtp/crypto/cipher/cipher.c b/libs/srtp/crypto/cipher/cipher.c index 27da651c72..f465ec6c5a 100644 --- a/libs/srtp/crypto/cipher/cipher.c +++ b/libs/srtp/crypto/cipher/cipher.c @@ -155,7 +155,7 @@ cipher_type_test(const cipher_type_t *ct, const cipher_test_case_t *test_data) { test_case->ciphertext_length_octets)); /* compare the resulting ciphertext with that in the test case */ - if (len != test_case->ciphertext_length_octets) + if (len != (unsigned int)test_case->ciphertext_length_octets) return err_status_algo_fail; status = err_status_ok; for (i=0; i < test_case->ciphertext_length_octets; i++) @@ -222,7 +222,7 @@ cipher_type_test(const cipher_type_t *ct, const cipher_test_case_t *test_data) { test_case->plaintext_length_octets)); /* compare the resulting plaintext with that in the test case */ - if (len != test_case->plaintext_length_octets) + if (len != (unsigned int)test_case->plaintext_length_octets) return err_status_algo_fail; status = err_status_ok; for (i=0; i < test_case->plaintext_length_octets; i++) @@ -344,7 +344,7 @@ cipher_type_test(const cipher_type_t *ct, const cipher_test_case_t *test_data) { octet_string_hex_string(buffer, length)); /* compare the resulting plaintext with the original one */ - if (length != plaintext_len) + if (length != (unsigned int)plaintext_len) return err_status_algo_fail; status = err_status_ok; for (i=0; i < plaintext_len; i++) diff --git a/libs/srtp/crypto/cipher/null_cipher.c b/libs/srtp/crypto/cipher/null_cipher.c index 724f4df3a8..d99a0e85af 100644 --- a/libs/srtp/crypto/cipher/null_cipher.c +++ b/libs/srtp/crypto/cipher/null_cipher.c @@ -48,6 +48,10 @@ #include "null_cipher.h" #include "alloc.h" +#ifdef _MSC_VER +#pragma warning(disable:4100) +#endif + /* the null_cipher uses the cipher debug module */ extern debug_module_t mod_cipher; diff --git a/libs/srtp/crypto/kernel/crypto_kernel.c b/libs/srtp/crypto/kernel/crypto_kernel.c index 0e969bc860..90c4a3073a 100644 --- a/libs/srtp/crypto/kernel/crypto_kernel.c +++ b/libs/srtp/crypto/kernel/crypto_kernel.c @@ -300,7 +300,7 @@ crypto_kernel_shutdown() { static inline err_status_t crypto_kernel_do_load_cipher_type(cipher_type_t *new_ct, cipher_type_id_t id, int replace) { - kernel_cipher_type_t *ctype, *new_ctype; + kernel_cipher_type_t *ctype, *new_ctype = 0; err_status_t status; /* defensive coding */ @@ -370,7 +370,7 @@ crypto_kernel_replace_cipher_type(cipher_type_t *new_ct, cipher_type_id_t id) { err_status_t crypto_kernel_do_load_auth_type(auth_type_t *new_at, auth_type_id_t id, int replace) { - kernel_auth_type_t *atype, *new_atype; + kernel_auth_type_t *atype, *new_atype = 0; err_status_t status; /* defensive coding */ diff --git a/libs/srtp/crypto/kernel/err.c b/libs/srtp/crypto/kernel/err.c index 4a3a8589e9..6b00e7b877 100644 --- a/libs/srtp/crypto/kernel/err.c +++ b/libs/srtp/crypto/kernel/err.c @@ -50,6 +50,9 @@ # endif #endif +#ifdef _MSC_VER +#pragma warning(disable:4100) +#endif /* err_level reflects the level of errors that are reported */ diff --git a/libs/srtp/crypto/math/datatypes.c b/libs/srtp/crypto/math/datatypes.c index 21c0dc0782..c329eb122b 100644 --- a/libs/srtp/crypto/math/datatypes.c +++ b/libs/srtp/crypto/math/datatypes.c @@ -152,7 +152,9 @@ hex_char_to_nibble(uint8_t c) { default: return -1; /* this flags an error */ } /* NOTREACHED */ +#ifndef WIN32 return -1; /* this keeps compilers from complaining */ +#endif } int @@ -179,7 +181,7 @@ hex_string_to_octet_string(char *raw, char *hex, int len) { tmp = hex_char_to_nibble(hex[0]); if (tmp == -1) return hex_len; - x = (tmp << 4); + x = (uint8_t)(tmp << 4); hex_len++; tmp = hex_char_to_nibble(hex[1]); if (tmp == -1) @@ -704,7 +706,7 @@ base64_string_to_octet_string(char *raw, char *base64, int len) { tmp = base64_char_to_sextet(base64[0]); if (tmp == -1) return base64_len; - x = (tmp << 6); + x = (uint8_t)(tmp << 6); base64_len++; tmp = base64_char_to_sextet(base64[1]); if (tmp == -1) diff --git a/libs/srtp/crypto/math/stat.c b/libs/srtp/crypto/math/stat.c index 5e46c209e3..a744f91f88 100644 --- a/libs/srtp/crypto/math/stat.c +++ b/libs/srtp/crypto/math/stat.c @@ -24,7 +24,7 @@ debug_module_t mod_stat = { err_status_t stat_test_monobit(uint8_t *data) { uint8_t *data_end = data + STAT_TEST_DATA_LEN; - uint16_t ones_count; + int ones_count; ones_count = 0; while (data < data_end) { diff --git a/libs/srtp/crypto/replay/rdbx.c b/libs/srtp/crypto/replay/rdbx.c index 54671cab0c..f13e334bf8 100644 --- a/libs/srtp/crypto/replay/rdbx.c +++ b/libs/srtp/crypto/replay/rdbx.c @@ -292,7 +292,7 @@ rdbx_add_index(rdbx_t *rdbx, int delta) { if (delta > 0) { /* shift forward by delta */ - index_advance(&rdbx->index, delta); + index_advance(&rdbx->index, (sequence_number_t)delta); bitvector_left_shift(&rdbx->bitmask, delta); bitvector_set_bit(&rdbx->bitmask, bitvector_get_length(&rdbx->bitmask) - 1); } else { diff --git a/libs/srtp/crypto/replay/ut_sim.c b/libs/srtp/crypto/replay/ut_sim.c index 43c411e46b..465e8c85ca 100644 --- a/libs/srtp/crypto/replay/ut_sim.c +++ b/libs/srtp/crypto/replay/ut_sim.c @@ -47,6 +47,9 @@ #include "ut_sim.h" +#ifdef _MSC_VER +#pragma warning(disable:4100) +#endif int ut_compar(const void *a, const void *b) { diff --git a/libs/srtp/srtp/srtp.c b/libs/srtp/srtp/srtp.c index 163d0d1f3f..a1f1fc8327 100644 --- a/libs/srtp/srtp/srtp.c +++ b/libs/srtp/srtp/srtp.c @@ -838,7 +838,7 @@ srtp_stream_init(srtp_stream_ctx_t *srtp, * estimate the packet index using the start of the replay window * and the sequence number from the header */ - delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq)); + delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs((uint16_t)hdr->seq)); status = rdbx_check(&stream->rtp_rdbx, delta); if (status) { if (status != err_status_replay_fail || !stream->allow_repeat_tx) @@ -999,7 +999,7 @@ srtp_unprotect(srtp_ctx_t *ctx, void *srtp_hdr, int *pkt_octet_len) { est = (xtd_seq_num_t) make64(0,ntohs(hdr->seq)); delta = low32(est); #else - est = (xtd_seq_num_t) ntohs(hdr->seq); + est = (xtd_seq_num_t) ntohs((uint16_t)hdr->seq); delta = (int)est; #endif } else { @@ -1013,7 +1013,7 @@ srtp_unprotect(srtp_ctx_t *ctx, void *srtp_hdr, int *pkt_octet_len) { } else { /* estimate packet index from seq. num. in header */ - delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs(hdr->seq)); + delta = rdbx_estimate_index(&stream->rtp_rdbx, &est, ntohs((uint16_t)hdr->seq)); /* check replay database */ status = rdbx_check(&stream->rtp_rdbx, delta);