diff options
author | lloyd <[email protected]> | 2010-12-13 22:12:41 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-12-13 22:12:41 +0000 |
commit | 165b6777241bdff9650d9c024792f4f549949a41 (patch) | |
tree | ff35d146a9bce1b492886ad1e00f1fa91c1a5afe | |
parent | aa8a0c19ec2156864d16bfe4b82fce4f2203c08d (diff) |
More VC warning fixes
-rw-r--r-- | checks/bench.cpp | 4 | ||||
-rw-r--r-- | checks/pk_bench.cpp | 20 | ||||
-rw-r--r-- | checks/validate.cpp | 8 | ||||
-rw-r--r-- | src/libstate/global_state.cpp | 2 | ||||
-rw-r--r-- | src/stream/turing/turing.cpp | 2 |
5 files changed, 18 insertions, 18 deletions
diff --git a/checks/bench.cpp b/checks/bench.cpp index d43efd10a..e9eb92199 100644 --- a/checks/bench.cpp +++ b/checks/bench.cpp @@ -209,8 +209,8 @@ bool bench_algo(const std::string& algo, return false; } - u32bit cipher_keylen = proto_cipher->maximum_keylength(); - u32bit cipher_ivlen = proto_cipher->block_size(); + size_t cipher_keylen = proto_cipher->maximum_keylength(); + const size_t cipher_ivlen = proto_cipher->block_size(); if(algo_parts[1] == "XTS") cipher_keylen *= 2; // hack! diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp index 2eb87dfeb..3597257a4 100644 --- a/checks/pk_bench.cpp +++ b/checks/pk_bench.cpp @@ -307,9 +307,9 @@ void benchmark_ecdsa(RandomNumberGenerator& rng, { EC_Domain_Params params(OIDS::lookup(ec_domains[j])); - u32bit pbits = params.get_curve().get_p().bits(); + const size_t pbits = params.get_curve().get_p().bits(); - u32bit hashbits = pbits; + size_t hashbits = pbits; if(hashbits <= 192) hashbits = 160; @@ -356,9 +356,9 @@ void benchmark_gost_3410(RandomNumberGenerator& rng, { EC_Domain_Params params(OIDS::lookup(ec_domains[j])); - u32bit pbits = params.get_curve().get_p().bits(); + size_t pbits = params.get_curve().get_p().bits(); - u32bit hashbits = pbits; + size_t hashbits = pbits; if(hashbits <= 192) hashbits = 160; @@ -405,7 +405,7 @@ void benchmark_ecdh(RandomNumberGenerator& rng, { EC_Domain_Params params(OIDS::lookup(ec_domains[j])); - u32bit pbits = params.get_curve().get_p().bits(); + size_t pbits = params.get_curve().get_p().bits(); Timer keygen_timer("keygen"); Timer kex_timer("key exchange"); @@ -425,7 +425,7 @@ void benchmark_ecdh(RandomNumberGenerator& rng, SymmetricKey secret1, secret2; - for(u32bit i = 0; i != 1000; ++i) + for(size_t i = 0; i != 1000; ++i) { if(kex_timer.seconds() > seconds) break; @@ -466,8 +466,8 @@ void benchmark_dsa_nr(RandomNumberGenerator& rng, for(size_t j = 0; domains[j]; j++) { - u32bit pbits = to_u32bit(split_on(domains[j], '/')[2]); - u32bit qbits = (pbits <= 1024) ? 160 : 256; + size_t pbits = to_u32bit(split_on(domains[j], '/')[2]); + size_t qbits = (pbits <= 1024) ? 160 : 256; const std::string padding = "EMSA1(SHA-" + to_string(qbits) + ")"; @@ -535,7 +535,7 @@ void benchmark_dh(RandomNumberGenerator& rng, SymmetricKey secret1, secret2; - for(u32bit i = 0; i != 1000; ++i) + for(size_t i = 0; i != 1000; ++i) { if(kex_timer.seconds() > seconds) break; @@ -637,7 +637,7 @@ void benchmark_elg(RandomNumberGenerator& rng, for(size_t j = 0; domains[j]; j++) { - u32bit pbits = to_u32bit(split_on(domains[j], '/')[2]); + size_t pbits = to_u32bit(split_on(domains[j], '/')[2]); const std::string padding = "EME1(SHA-1)"; diff --git a/checks/validate.cpp b/checks/validate.cpp index 3c7aeeb22..dd23eadc3 100644 --- a/checks/validate.cpp +++ b/checks/validate.cpp @@ -349,7 +349,7 @@ bool failed_test(const std::string& algo, const byte* data_ptr = &data[0]; // this can help catch errors with buffering, etc - u32bit len = data.size(); + size_t len = data.size(); pipe.start_msg(); while(len) { @@ -390,8 +390,8 @@ bool failed_test(const std::string& algo, if(pipe.remaining()) { /* Test peeking at an offset in Pipe/SecureQueue */ - u32bit offset = random_word(rng, pipe.remaining() - 1); - u32bit length = random_word(rng, pipe.remaining() - offset); + size_t offset = random_word(rng, pipe.remaining() - 1); + size_t length = random_word(rng, pipe.remaining() - offset); Botan::SecureVector<byte> peekbuf(length); pipe.peek(&peekbuf[0], peekbuf.size(), offset); @@ -400,7 +400,7 @@ bool failed_test(const std::string& algo, bool OK = true; - for(u32bit j = offset; j != offset+length; j++) + for(size_t j = offset; j != offset+length; j++) if(static_cast<byte>(output[j]) != peekbuf[j-offset]) OK = false; diff --git a/src/libstate/global_state.cpp b/src/libstate/global_state.cpp index 00b71039f..43c935ca3 100644 --- a/src/libstate/global_state.cpp +++ b/src/libstate/global_state.cpp @@ -83,7 +83,7 @@ Library_State* swap_global_state(Library_State* new_state) */ bool global_state_exists() { - return (global_lib_state); + return (global_lib_state != 0); } } diff --git a/src/stream/turing/turing.cpp b/src/stream/turing/turing.cpp index 619ef6682..697c660ed 100644 --- a/src/stream/turing/turing.cpp +++ b/src/stream/turing/turing.cpp @@ -247,7 +247,7 @@ void Turing::key_schedule(const byte key[], size_t length) PHT(K); - for(size_t i = 0; i != 256; ++i) + for(u32bit i = 0; i != 256; ++i) { u32bit W0 = 0, C0 = i; u32bit W1 = 0, C1 = i; |