diff options
-rw-r--r-- | src/block/aes_intel/aes_intel.cpp | 24 | ||||
-rw-r--r-- | src/block/aes_intel/aes_intel.h | 12 | ||||
-rw-r--r-- | src/block/serpent_ia32/serp_ia32.cpp | 10 | ||||
-rw-r--r-- | src/block/serpent_ia32/serp_ia32.h | 4 | ||||
-rw-r--r-- | src/hash/gost_3411/gost_3411.h | 2 | ||||
-rw-r--r-- | src/libstate/init.cpp | 10 | ||||
-rw-r--r-- | src/libstate/libstate.cpp | 6 | ||||
-rw-r--r-- | src/mac/mac.cpp | 10 | ||||
-rw-r--r-- | src/mac/mac.h | 2 |
9 files changed, 40 insertions, 40 deletions
diff --git a/src/block/aes_intel/aes_intel.cpp b/src/block/aes_intel/aes_intel.cpp index c52f3fcd3..d03767e72 100644 --- a/src/block/aes_intel/aes_intel.cpp +++ b/src/block/aes_intel/aes_intel.cpp @@ -103,7 +103,7 @@ __m128i aes_256_key_expansion(__m128i key, __m128i key2) /* * AES-128 Encryption */ -void AES_128_Intel::encrypt_n(const byte in[], byte out[], u32bit blocks) const +void AES_128_Intel::encrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = (const __m128i*)in; __m128i* out_mm = (__m128i*)out; @@ -155,7 +155,7 @@ void AES_128_Intel::encrypt_n(const byte in[], byte out[], u32bit blocks) const out_mm += 4; } - for(u32bit i = 0; i != blocks; ++i) + for(size_t i = 0; i != blocks; ++i) { __m128i B = _mm_loadu_si128(in_mm + i); @@ -179,7 +179,7 @@ void AES_128_Intel::encrypt_n(const byte in[], byte out[], u32bit blocks) const /* * AES-128 Decryption */ -void AES_128_Intel::decrypt_n(const byte in[], byte out[], u32bit blocks) const +void AES_128_Intel::decrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = (const __m128i*)in; __m128i* out_mm = (__m128i*)out; @@ -231,7 +231,7 @@ void AES_128_Intel::decrypt_n(const byte in[], byte out[], u32bit blocks) const out_mm += 4; } - for(u32bit i = 0; i != blocks; ++i) + for(size_t i = 0; i != blocks; ++i) { __m128i B = _mm_loadu_si128(in_mm + i); @@ -313,7 +313,7 @@ void AES_128_Intel::clear() /* * AES-192 Encryption */ -void AES_192_Intel::encrypt_n(const byte in[], byte out[], u32bit blocks) const +void AES_192_Intel::encrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = (const __m128i*)in; __m128i* out_mm = (__m128i*)out; @@ -369,7 +369,7 @@ void AES_192_Intel::encrypt_n(const byte in[], byte out[], u32bit blocks) const out_mm += 4; } - for(u32bit i = 0; i != blocks; ++i) + for(size_t i = 0; i != blocks; ++i) { __m128i B = _mm_loadu_si128(in_mm + i); @@ -395,7 +395,7 @@ void AES_192_Intel::encrypt_n(const byte in[], byte out[], u32bit blocks) const /* * AES-192 Decryption */ -void AES_192_Intel::decrypt_n(const byte in[], byte out[], u32bit blocks) const +void AES_192_Intel::decrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = (const __m128i*)in; __m128i* out_mm = (__m128i*)out; @@ -451,7 +451,7 @@ void AES_192_Intel::decrypt_n(const byte in[], byte out[], u32bit blocks) const out_mm += 4; } - for(u32bit i = 0; i != blocks; ++i) + for(size_t i = 0; i != blocks; ++i) { __m128i B = _mm_loadu_si128(in_mm + i); @@ -529,7 +529,7 @@ void AES_192_Intel::clear() /* * AES-256 Encryption */ -void AES_256_Intel::encrypt_n(const byte in[], byte out[], u32bit blocks) const +void AES_256_Intel::encrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = (const __m128i*)in; __m128i* out_mm = (__m128i*)out; @@ -589,7 +589,7 @@ void AES_256_Intel::encrypt_n(const byte in[], byte out[], u32bit blocks) const out_mm += 4; } - for(u32bit i = 0; i != blocks; ++i) + for(size_t i = 0; i != blocks; ++i) { __m128i B = _mm_loadu_si128(in_mm + i); @@ -617,7 +617,7 @@ void AES_256_Intel::encrypt_n(const byte in[], byte out[], u32bit blocks) const /* * AES-256 Decryption */ -void AES_256_Intel::decrypt_n(const byte in[], byte out[], u32bit blocks) const +void AES_256_Intel::decrypt_n(const byte in[], byte out[], size_t blocks) const { const __m128i* in_mm = (const __m128i*)in; __m128i* out_mm = (__m128i*)out; @@ -677,7 +677,7 @@ void AES_256_Intel::decrypt_n(const byte in[], byte out[], u32bit blocks) const out_mm += 4; } - for(u32bit i = 0; i != blocks; ++i) + for(size_t i = 0; i != blocks; ++i) { __m128i B = _mm_loadu_si128(in_mm + i); diff --git a/src/block/aes_intel/aes_intel.h b/src/block/aes_intel/aes_intel.h index 34ffcf9c6..43e8f2f0e 100644 --- a/src/block/aes_intel/aes_intel.h +++ b/src/block/aes_intel/aes_intel.h @@ -20,8 +20,8 @@ class BOTAN_DLL AES_128_Intel : public BlockCipher public: size_t parallelism() const { return 4; } - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void encrypt_n(const byte in[], byte out[], size_t blocks) const; + void decrypt_n(const byte in[], byte out[], size_t blocks) const; void clear(); std::string name() const { return "AES-128"; } @@ -42,8 +42,8 @@ class BOTAN_DLL AES_192_Intel : public BlockCipher public: size_t parallelism() const { return 4; } - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void encrypt_n(const byte in[], byte out[], size_t blocks) const; + void decrypt_n(const byte in[], byte out[], size_t blocks) const; void clear(); std::string name() const { return "AES-192"; } @@ -64,8 +64,8 @@ class BOTAN_DLL AES_256_Intel : public BlockCipher public: size_t parallelism() const { return 4; } - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void encrypt_n(const byte in[], byte out[], size_t blocks) const; + void decrypt_n(const byte in[], byte out[], size_t blocks) const; void clear(); std::string name() const { return "AES-256"; } diff --git a/src/block/serpent_ia32/serp_ia32.cpp b/src/block/serpent_ia32/serp_ia32.cpp index e969f5235..28a605d12 100644 --- a/src/block/serpent_ia32/serp_ia32.cpp +++ b/src/block/serpent_ia32/serp_ia32.cpp @@ -46,7 +46,7 @@ void botan_serpent_ia32_key_schedule(u32bit ks[140]); */ void Serpent_IA32::encrypt_n(const byte in[], byte out[], u32bit blocks) const { - for(u32bit i = 0; i != blocks; ++i) + for(size_t i = 0; i != blocks; ++i) { botan_serpent_ia32_encrypt(in, out, this->get_round_keys()); in += BLOCK_SIZE; @@ -57,9 +57,9 @@ void Serpent_IA32::encrypt_n(const byte in[], byte out[], u32bit blocks) const /* * Serpent Decryption */ -void Serpent_IA32::decrypt_n(const byte in[], byte out[], u32bit blocks) const +void Serpent_IA32::decrypt_n(const byte in[], byte out[], size_t blocks) const { - for(u32bit i = 0; i != blocks; ++i) + for(size_t i = 0; i != blocks; ++i) { botan_serpent_ia32_decrypt(in, out, this->get_round_keys()); in += BLOCK_SIZE; @@ -73,8 +73,8 @@ void Serpent_IA32::decrypt_n(const byte in[], byte out[], u32bit blocks) const void Serpent_IA32::key_schedule(const byte key[], u32bit length) { SecureVector<u32bit> W(140); - for(u32bit j = 0; j != length / 4; ++j) - W[j] = load_le<u32bit>(key, j); + for(size_t i = 0; i != length / 4; ++i) + W[i] = load_le<u32bit>(key, i); W[length / 4] |= u32bit(1) << ((length%4)*8); botan_serpent_ia32_key_schedule(W); diff --git a/src/block/serpent_ia32/serp_ia32.h b/src/block/serpent_ia32/serp_ia32.h index 229a2042b..cd103c130 100644 --- a/src/block/serpent_ia32/serp_ia32.h +++ b/src/block/serpent_ia32/serp_ia32.h @@ -18,8 +18,8 @@ namespace Botan { class BOTAN_DLL Serpent_IA32 : public Serpent { public: - void encrypt_n(const byte in[], byte out[], u32bit blocks) const; - void decrypt_n(const byte in[], byte out[], u32bit blocks) const; + void encrypt_n(const byte in[], byte out[], size_t blocks) const; + void decrypt_n(const byte in[], byte out[], size_t blocks) const; BlockCipher* clone() const { return new Serpent_IA32; } private: diff --git a/src/hash/gost_3411/gost_3411.h b/src/hash/gost_3411/gost_3411.h index 693b900d2..1e9f3189d 100644 --- a/src/hash/gost_3411/gost_3411.h +++ b/src/hash/gost_3411/gost_3411.h @@ -32,8 +32,8 @@ class BOTAN_DLL GOST_34_11 : public HashFunction GOST_28147_89 cipher; SecureVector<byte> buffer, sum, hash; + size_t position; u64bit count; - u32bit position; }; } diff --git a/src/libstate/init.cpp b/src/libstate/init.cpp index e2139f42e..7cdc615bd 100644 --- a/src/libstate/init.cpp +++ b/src/libstate/init.cpp @@ -20,21 +20,21 @@ void LibraryInitializer::initialize(const std::string& arg_string) bool thread_safe = false; const std::vector<std::string> arg_list = split_on(arg_string, ' '); - for(u32bit j = 0; j != arg_list.size(); ++j) + for(size_t i = 0; i != arg_list.size(); ++i) { - if(arg_list[j].size() == 0) + if(arg_list[i].size() == 0) continue; std::string name, value; - if(arg_list[j].find('=') == std::string::npos) + if(arg_list[i].find('=') == std::string::npos) { - name = arg_list[j]; + name = arg_list[i]; value = "true"; } else { - std::vector<std::string> name_and_value = split_on(arg_list[j], '='); + std::vector<std::string> name_and_value = split_on(arg_list[i], '='); name = name_and_value[0]; value = name_and_value[1]; } diff --git a/src/libstate/libstate.cpp b/src/libstate/libstate.cpp index a20fc76c6..d086c5cde 100644 --- a/src/libstate/libstate.cpp +++ b/src/libstate/libstate.cpp @@ -288,10 +288,10 @@ Library_State::~Library_State() cached_default_allocator = 0; - for(u32bit j = 0; j != allocators.size(); ++j) + for(size_t i = 0; i != allocators.size(); ++i) { - allocators[j]->destroy(); - delete allocators[j]; + allocators[i]->destroy(); + delete allocators[i]; } delete global_rng_lock; diff --git a/src/mac/mac.cpp b/src/mac/mac.cpp index cb89e872a..2ef4ab64c 100644 --- a/src/mac/mac.cpp +++ b/src/mac/mac.cpp @@ -6,21 +6,21 @@ */ #include <botan/mac.h> +#include <botan/mem_ops.h> namespace Botan { /* * Default (deterministic) MAC verification operation */ -bool MessageAuthenticationCode::verify_mac(const byte mac[], u32bit length) +bool MessageAuthenticationCode::verify_mac(const byte mac[], size_t length) { SecureVector<byte> our_mac = final(); + if(our_mac.size() != length) return false; - for(u32bit j = 0; j != length; ++j) - if(mac[j] != our_mac[j]) - return false; - return true; + + return same_mem(&our_mac[0], &mac[0], length); } } diff --git a/src/mac/mac.h b/src/mac/mac.h index 4518d91ad..1350c7d7a 100644 --- a/src/mac/mac.h +++ b/src/mac/mac.h @@ -27,7 +27,7 @@ class BOTAN_DLL MessageAuthenticationCode : public BufferedComputation, * @param length the length of param in * @return true if the MAC is valid, false otherwise */ - virtual bool verify_mac(const byte in[], u32bit length); + virtual bool verify_mac(const byte in[], size_t length); /** * Get a new object representing the same algorithm as *this |