diff options
author | lloyd <[email protected]> | 2010-12-13 22:06:59 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-12-13 22:06:59 +0000 |
commit | aa8a0c19ec2156864d16bfe4b82fce4f2203c08d (patch) | |
tree | c6de672209e59214c91f29a702339c35d518c459 | |
parent | d73929a5ec894625e7e4cb82c1a22bea4a0e7a26 (diff) |
Avoid more VC warnings
-rw-r--r-- | checks/block.cpp | 4 | ||||
-rw-r--r-- | src/block/aes/aes.cpp | 2 | ||||
-rw-r--r-- | src/hash/gost_3411/gost_3411.cpp | 2 | ||||
-rw-r--r-- | src/hash/keccak/keccak.cpp | 7 | ||||
-rw-r--r-- | src/hash/md2/md2.cpp | 3 | ||||
-rw-r--r-- | src/math/numbertheory/point_gfp.cpp | 4 |
6 files changed, 13 insertions, 9 deletions
diff --git a/checks/block.cpp b/checks/block.cpp index dc3350ce3..5d275615e 100644 --- a/checks/block.cpp +++ b/checks/block.cpp @@ -54,10 +54,10 @@ class ECB_Encryption_ErrorCheck : public Filter } private: - const u32bit BLOCKSIZE; + const size_t BLOCKSIZE; BlockCipher* cipher; SecureVector<byte> buffer; - u32bit position; + size_t position; HashFunction* input_hash, *decrypt_hash; }; diff --git a/src/block/aes/aes.cpp b/src/block/aes/aes.cpp index b19699dbc..d510a4a24 100644 --- a/src/block/aes/aes.cpp +++ b/src/block/aes/aes.cpp @@ -616,7 +616,7 @@ void aes_key_schedule(const byte key[], size_t length, 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000 }; - const u32bit rounds = (length / 4) + 6; + const size_t rounds = (length / 4) + 6; SecureVector<u32bit> XEK(length + 32), XDK(length + 32); diff --git a/src/hash/gost_3411/gost_3411.cpp b/src/hash/gost_3411/gost_3411.cpp index 075f26889..c0f39da47 100644 --- a/src/hash/gost_3411/gost_3411.cpp +++ b/src/hash/gost_3411/gost_3411.cpp @@ -71,7 +71,7 @@ void GOST_34_11::compress_n(const byte input[], size_t blocks) { for(size_t i = 0; i != blocks; ++i) { - for(size_t j = 0, carry = 0; j != 32; ++j) + for(u16bit j = 0, carry = 0; j != 32; ++j) { u16bit s = sum[j] + input[32*i+j] + carry; carry = get_byte(0, s); diff --git a/src/hash/keccak/keccak.cpp b/src/hash/keccak/keccak.cpp index 37fdc0d86..841c8875d 100644 --- a/src/hash/keccak/keccak.cpp +++ b/src/hash/keccak/keccak.cpp @@ -104,7 +104,7 @@ void keccak_f_1600(u64bit A[25]) Keccak_1600::Keccak_1600(size_t output_bits) : output_bits(output_bits), bitrate(1600 - 2*output_bits), - diversifier(output_bits / 8), + diversifier(static_cast<byte>(output_bits / 8)), S(25), S_pos(0) { @@ -179,7 +179,10 @@ void Keccak_1600::add_data(const byte input[], size_t length) void Keccak_1600::final_result(byte output[]) { - const byte padding[4] = { 0x01, diversifier, bitrate / 8, 0x01 }; + const byte padding[4] = { 0x01, + diversifier, + static_cast<byte>(bitrate / 8), + 0x01 }; add_data(padding, sizeof(padding)); diff --git a/src/hash/md2/md2.cpp b/src/hash/md2/md2.cpp index 195c0843e..761528dc6 100644 --- a/src/hash/md2/md2.cpp +++ b/src/hash/md2/md2.cpp @@ -52,7 +52,8 @@ void MD2::hash(const byte input[]) T = X[k+4] ^= SBOX[T]; T = X[k+5] ^= SBOX[T]; T = X[k+6] ^= SBOX[T]; T = X[k+7] ^= SBOX[T]; } - T += i; + + T += static_cast<byte>(i); } T = checksum[15]; diff --git a/src/math/numbertheory/point_gfp.cpp b/src/math/numbertheory/point_gfp.cpp index 5e42e37a5..fab731d29 100644 --- a/src/math/numbertheory/point_gfp.cpp +++ b/src/math/numbertheory/point_gfp.cpp @@ -486,7 +486,7 @@ SecureVector<byte> EC2OSP(const PointGFp& point, byte format) else if(format == PointGFp::COMPRESSED) { SecureVector<byte> result; - result.push_back(0x02 | y.get_bit(0)); + result.push_back(0x02 | static_cast<byte>(y.get_bit(0))); result += bX; @@ -495,7 +495,7 @@ SecureVector<byte> EC2OSP(const PointGFp& point, byte format) else if(format == PointGFp::HYBRID) { SecureVector<byte> result; - result.push_back(0x06 | y.get_bit(0)); + result.push_back(0x06 | static_cast<byte>(y.get_bit(0))); result += bX; result += bY; |