提交 d627f7c2 authored 作者: Jeff Lenk's avatar Jeff Lenk

windows compiler warnings

上级 511b2fc4
......@@ -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];
......
......@@ -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++)
......
......@@ -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;
......
......@@ -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 */
......
......@@ -50,6 +50,9 @@
# endif
#endif
#ifdef _MSC_VER
#pragma warning(disable:4100)
#endif
/* err_level reflects the level of errors that are reported */
......
......@@ -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)
......
......@@ -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) {
......
......@@ -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 {
......
......@@ -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) {
......
......@@ -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);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论