diff --git a/libs/srtp/crypto/cipher/aes_icm.c b/libs/srtp/crypto/cipher/aes_icm.c index 8e1646f324..4c01c437da 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 */ @@ -367,7 +370,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 @@ -415,7 +418,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 e697a59c13..761918bf5b 100644 --- a/libs/srtp/crypto/cipher/cipher.c +++ b/libs/srtp/crypto/cipher/cipher.c @@ -155,7 +155,7 @@ cipher_type_self_test(const cipher_type_t *ct) { test_case->ciphertext_length_octets)); /* compare the resulting ciphertext with that in the test case */ - if (len != test_case->ciphertext_length_octets) + if ((int)len != 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_self_test(const cipher_type_t *ct) { test_case->plaintext_length_octets)); /* compare the resulting plaintext with that in the test case */ - if (len != test_case->plaintext_length_octets) + if ((int)len != 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_self_test(const cipher_type_t *ct) { octet_string_hex_string(buffer, length)); /* compare the resulting plaintext with the original one */ - if (length != plaintext_len) + if ((int)length != 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 812d679f4f..988f6a56af 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/hash/null_auth.c b/libs/srtp/crypto/hash/null_auth.c index 77e37da70d..1d8c556310 100644 --- a/libs/srtp/crypto/hash/null_auth.c +++ b/libs/srtp/crypto/hash/null_auth.c @@ -48,6 +48,10 @@ #include "null_auth.h" #include "alloc.h" +#ifdef _MSC_VER +#pragma warning(disable:4100) +#endif + /* null_auth uses the auth debug module */ extern debug_module_t mod_auth; diff --git a/libs/srtp/crypto/kernel/err.c b/libs/srtp/crypto/kernel/err.c index e64719c346..f68a629975 100644 --- a/libs/srtp/crypto/kernel/err.c +++ b/libs/srtp/crypto/kernel/err.c @@ -42,6 +42,10 @@ * */ +#ifdef _MSC_VER +#pragma warning(disable:4100) +#endif + #include "err.h" #ifdef ERR_REPORTING_SYSLOG diff --git a/libs/srtp/crypto/math/datatypes.c b/libs/srtp/crypto/math/datatypes.c index 1b5989b7fa..58c7502176 100644 --- a/libs/srtp/crypto/math/datatypes.c +++ b/libs/srtp/crypto/math/datatypes.c @@ -149,10 +149,9 @@ hex_char_to_nibble(uint8_t c) { case ('E'): return 0xe; case ('f'): return 0xf; case ('F'): return 0xf; - default: return -1; /* this flags an error */ } - /* NOTREACHED */ - return -1; /* this keeps compilers from complaining */ + /* this flags an error */ + return -1; } int @@ -179,7 +178,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) @@ -564,8 +563,6 @@ base64_char_to_sextet(uint8_t c) { return 63; case '=': return 64; - default: - return -1; } return -1; } @@ -586,7 +583,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 bf1604c533..6f94a0c6e6 100644 --- a/libs/srtp/crypto/math/stat.c +++ b/libs/srtp/crypto/math/stat.c @@ -28,7 +28,7 @@ stat_test_monobit(uint8_t *data) { ones_count = 0; while (data < data_end) { - ones_count += octet_get_weight(*data); + ones_count = (uint16_t)(ones_count + octet_get_weight(*data)); data++; } diff --git a/libs/srtp/crypto/replay/rdbx.c b/libs/srtp/crypto/replay/rdbx.c index 75ca70f457..dcdb138510 100644 --- a/libs/srtp/crypto/replay/rdbx.c +++ b/libs/srtp/crypto/replay/rdbx.c @@ -229,7 +229,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); v128_left_shift(&rdbx->bitmask, delta); v128_set_bit(&rdbx->bitmask, 127); } else { diff --git a/libs/srtp/crypto/replay/ut_sim.c b/libs/srtp/crypto/replay/ut_sim.c index 18ec4fe440..15258c76ab 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/crypto/rng/rand_source.c b/libs/srtp/crypto/rng/rand_source.c index 48e2a6e079..aee16c03e8 100644 --- a/libs/srtp/crypto/rng/rand_source.c +++ b/libs/srtp/crypto/rng/rand_source.c @@ -97,7 +97,7 @@ rand_source_get_octet_string(void *dest, uint32_t len) { /* rand() returns 0-32767 (ugh) */ /* Is this a good enough way to get random bytes? It is if it passes FIPS-140... */ - *dst++ = val & 0xff; + *dst++ = (uint8_t)(val & 0xff); len--; } #endif diff --git a/libs/srtp/include/srtp.h b/libs/srtp/include/srtp.h index 0242744597..7ff861ea4e 100644 --- a/libs/srtp/include/srtp.h +++ b/libs/srtp/include/srtp.h @@ -52,6 +52,7 @@ extern "C" { #ifdef _MSC_VER #pragma pack(4) +#pragma warning(disable:4214) #endif #include "crypto_kernel.h" diff --git a/libs/srtp/libsrtp.vcproj b/libs/srtp/libsrtp.vcproj index b27c823a6f..71bec43a92 100644 --- a/libs/srtp/libsrtp.vcproj +++ b/libs/srtp/libsrtp.vcproj @@ -52,7 +52,8 @@ RuntimeLibrary="3" StructMemberAlignment="0" UsePrecompiledHeader="0" - WarningLevel="3" + WarningLevel="4" + WarnAsError="true" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" /> @@ -119,7 +120,8 @@ RuntimeLibrary="2" StructMemberAlignment="0" UsePrecompiledHeader="0" - WarningLevel="3" + WarningLevel="4" + WarnAsError="true" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" /> @@ -189,7 +191,8 @@ RuntimeLibrary="3" StructMemberAlignment="0" UsePrecompiledHeader="0" - WarningLevel="3" + WarningLevel="4" + WarnAsError="true" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" /> @@ -271,7 +274,8 @@ RuntimeLibrary="2" StructMemberAlignment="0" UsePrecompiledHeader="0" - WarningLevel="3" + WarningLevel="4" + WarnAsError="true" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" />