windows compiler warnings

This commit is contained in:
Jeff Lenk 2013-04-01 17:09:37 -05:00
parent 511b2fc49a
commit d627f7c23d
10 changed files with 29 additions and 14 deletions

View File

@ -49,6 +49,9 @@
#include "aes_icm.h" #include "aes_icm.h"
#include "alloc.h" #include "alloc.h"
#ifdef _MSC_VER
#pragma warning(disable:4100)
#endif
debug_module_t mod_aes_icm = { debug_module_t mod_aes_icm = {
0, /* debugging is off by default */ 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++) { for (i=0; i < (bytes_to_encr/sizeof(v128_t)); i++) {
/* fill buffer with new keystream */ /* 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 * 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) { if ((bytes_to_encr & 0xf) != 0) {
/* fill buffer with new keystream */ /* 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++) for (i=0; i < (bytes_to_encr & 0xf); i++)
*buf++ ^= c->keystream_buffer.v8[i]; *buf++ ^= c->keystream_buffer.v8[i];

View File

@ -155,7 +155,7 @@ cipher_type_test(const cipher_type_t *ct, const cipher_test_case_t *test_data) {
test_case->ciphertext_length_octets)); test_case->ciphertext_length_octets));
/* compare the resulting ciphertext with that in the test case */ /* 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; return err_status_algo_fail;
status = err_status_ok; status = err_status_ok;
for (i=0; i < test_case->ciphertext_length_octets; i++) 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)); test_case->plaintext_length_octets));
/* compare the resulting plaintext with that in the test case */ /* 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; return err_status_algo_fail;
status = err_status_ok; status = err_status_ok;
for (i=0; i < test_case->plaintext_length_octets; i++) 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)); octet_string_hex_string(buffer, length));
/* compare the resulting plaintext with the original one */ /* compare the resulting plaintext with the original one */
if (length != plaintext_len) if (length != (unsigned int)plaintext_len)
return err_status_algo_fail; return err_status_algo_fail;
status = err_status_ok; status = err_status_ok;
for (i=0; i < plaintext_len; i++) for (i=0; i < plaintext_len; i++)

View File

@ -48,6 +48,10 @@
#include "null_cipher.h" #include "null_cipher.h"
#include "alloc.h" #include "alloc.h"
#ifdef _MSC_VER
#pragma warning(disable:4100)
#endif
/* the null_cipher uses the cipher debug module */ /* the null_cipher uses the cipher debug module */
extern debug_module_t mod_cipher; extern debug_module_t mod_cipher;

View File

@ -300,7 +300,7 @@ crypto_kernel_shutdown() {
static inline err_status_t static inline err_status_t
crypto_kernel_do_load_cipher_type(cipher_type_t *new_ct, cipher_type_id_t id, crypto_kernel_do_load_cipher_type(cipher_type_t *new_ct, cipher_type_id_t id,
int replace) { int replace) {
kernel_cipher_type_t *ctype, *new_ctype; kernel_cipher_type_t *ctype, *new_ctype = 0;
err_status_t status; err_status_t status;
/* defensive coding */ /* defensive coding */
@ -370,7 +370,7 @@ crypto_kernel_replace_cipher_type(cipher_type_t *new_ct, cipher_type_id_t id) {
err_status_t err_status_t
crypto_kernel_do_load_auth_type(auth_type_t *new_at, auth_type_id_t id, crypto_kernel_do_load_auth_type(auth_type_t *new_at, auth_type_id_t id,
int replace) { int replace) {
kernel_auth_type_t *atype, *new_atype; kernel_auth_type_t *atype, *new_atype = 0;
err_status_t status; err_status_t status;
/* defensive coding */ /* defensive coding */

View File

@ -50,6 +50,9 @@
# endif # endif
#endif #endif
#ifdef _MSC_VER
#pragma warning(disable:4100)
#endif
/* err_level reflects the level of errors that are reported */ /* err_level reflects the level of errors that are reported */

View File

@ -152,7 +152,9 @@ hex_char_to_nibble(uint8_t c) {
default: return -1; /* this flags an error */ default: return -1; /* this flags an error */
} }
/* NOTREACHED */ /* NOTREACHED */
#ifndef WIN32
return -1; /* this keeps compilers from complaining */ return -1; /* this keeps compilers from complaining */
#endif
} }
int int
@ -179,7 +181,7 @@ hex_string_to_octet_string(char *raw, char *hex, int len) {
tmp = hex_char_to_nibble(hex[0]); tmp = hex_char_to_nibble(hex[0]);
if (tmp == -1) if (tmp == -1)
return hex_len; return hex_len;
x = (tmp << 4); x = (uint8_t)(tmp << 4);
hex_len++; hex_len++;
tmp = hex_char_to_nibble(hex[1]); tmp = hex_char_to_nibble(hex[1]);
if (tmp == -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]); tmp = base64_char_to_sextet(base64[0]);
if (tmp == -1) if (tmp == -1)
return base64_len; return base64_len;
x = (tmp << 6); x = (uint8_t)(tmp << 6);
base64_len++; base64_len++;
tmp = base64_char_to_sextet(base64[1]); tmp = base64_char_to_sextet(base64[1]);
if (tmp == -1) if (tmp == -1)

View File

@ -24,7 +24,7 @@ debug_module_t mod_stat = {
err_status_t err_status_t
stat_test_monobit(uint8_t *data) { stat_test_monobit(uint8_t *data) {
uint8_t *data_end = data + STAT_TEST_DATA_LEN; uint8_t *data_end = data + STAT_TEST_DATA_LEN;
uint16_t ones_count; int ones_count;
ones_count = 0; ones_count = 0;
while (data < data_end) { while (data < data_end) {

View File

@ -292,7 +292,7 @@ rdbx_add_index(rdbx_t *rdbx, int delta) {
if (delta > 0) { if (delta > 0) {
/* shift forward by delta */ /* shift forward by delta */
index_advance(&rdbx->index, delta); index_advance(&rdbx->index, (sequence_number_t)delta);
bitvector_left_shift(&rdbx->bitmask, delta); bitvector_left_shift(&rdbx->bitmask, delta);
bitvector_set_bit(&rdbx->bitmask, bitvector_get_length(&rdbx->bitmask) - 1); bitvector_set_bit(&rdbx->bitmask, bitvector_get_length(&rdbx->bitmask) - 1);
} else { } else {

View File

@ -47,6 +47,9 @@
#include "ut_sim.h" #include "ut_sim.h"
#ifdef _MSC_VER
#pragma warning(disable:4100)
#endif
int int
ut_compar(const void *a, const void *b) { ut_compar(const void *a, const void *b) {

View File

@ -838,7 +838,7 @@ srtp_stream_init(srtp_stream_ctx_t *srtp,
* estimate the packet index using the start of the replay window * estimate the packet index using the start of the replay window
* and the sequence number from the header * 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); status = rdbx_check(&stream->rtp_rdbx, delta);
if (status) { if (status) {
if (status != err_status_replay_fail || !stream->allow_repeat_tx) 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)); est = (xtd_seq_num_t) make64(0,ntohs(hdr->seq));
delta = low32(est); delta = low32(est);
#else #else
est = (xtd_seq_num_t) ntohs(hdr->seq); est = (xtd_seq_num_t) ntohs((uint16_t)hdr->seq);
delta = (int)est; delta = (int)est;
#endif #endif
} else { } else {
@ -1013,7 +1013,7 @@ srtp_unprotect(srtp_ctx_t *ctx, void *srtp_hdr, int *pkt_octet_len) {
} else { } else {
/* estimate packet index from seq. num. in header */ /* 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 */ /* check replay database */
status = rdbx_check(&stream->rtp_rdbx, delta); status = rdbx_check(&stream->rtp_rdbx, delta);