diff options
author | lloyd <[email protected]> | 2010-10-12 20:05:14 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-10-12 20:05:14 +0000 |
commit | b29e17a4ea70bcabb7d8eeb441bb70fd0c87b185 (patch) | |
tree | c297f0245d3a604fe4dea849979b84c3b4e709f9 | |
parent | 9abeb56f7d355b8ff86cbb465ba1e0a08257ec12 (diff) |
Use size_t in SCAN_Name
-rw-r--r-- | src/engine/core_engine/lookup_block.cpp | 8 | ||||
-rw-r--r-- | src/engine/core_engine/lookup_hash.cpp | 6 | ||||
-rw-r--r-- | src/engine/core_engine/lookup_stream.cpp | 2 | ||||
-rw-r--r-- | src/engine/openssl/ossl_arc4.cpp | 2 | ||||
-rw-r--r-- | src/engine/openssl/ossl_bc.cpp | 2 | ||||
-rw-r--r-- | src/libstate/get_enc.cpp | 2 | ||||
-rw-r--r-- | src/libstate/scan_name.cpp | 32 | ||||
-rw-r--r-- | src/libstate/scan_name.h | 12 |
8 files changed, 33 insertions, 33 deletions
diff --git a/src/engine/core_engine/lookup_block.cpp b/src/engine/core_engine/lookup_block.cpp index 52967fade..cbfaf2972 100644 --- a/src/engine/core_engine/lookup_block.cpp +++ b/src/engine/core_engine/lookup_block.cpp @@ -170,7 +170,7 @@ BlockCipher* Core_Engine::find_block_cipher(const SCAN_Name& request, #if defined(BOTAN_HAS_MISTY1) if(request.algo_name() == "MISTY1") - return new MISTY1(request.arg_as_u32bit(0, 8)); + return new MISTY1(request.arg_as_integer(0, 8)); #endif #if defined(BOTAN_HAS_NOEKEON) @@ -185,7 +185,7 @@ BlockCipher* Core_Engine::find_block_cipher(const SCAN_Name& request, #if defined(BOTAN_HAS_RC5) if(request.algo_name() == "RC5") - return new RC5(request.arg_as_u32bit(0, 12)); + return new RC5(request.arg_as_integer(0, 12)); #endif #if defined(BOTAN_HAS_RC6) @@ -195,7 +195,7 @@ BlockCipher* Core_Engine::find_block_cipher(const SCAN_Name& request, #if defined(BOTAN_HAS_SAFER) if(request.algo_name() == "SAFER-SK") - return new SAFER_SK(request.arg_as_u32bit(0, 10)); + return new SAFER_SK(request.arg_as_integer(0, 10)); #endif #if defined(BOTAN_HAS_SEED) @@ -257,7 +257,7 @@ BlockCipher* Core_Engine::find_block_cipher(const SCAN_Name& request, #if defined(BOTAN_HAS_LION) if(request.algo_name() == "Lion" && request.arg_count_between(2, 3)) { - const u32bit block_size = request.arg_as_u32bit(2, 1024); + const u32bit block_size = request.arg_as_integer(2, 1024); const HashFunction* hash = af.prototype_hash_function(request.arg(0)); diff --git a/src/engine/core_engine/lookup_hash.cpp b/src/engine/core_engine/lookup_hash.cpp index 02c049d86..e80c1db64 100644 --- a/src/engine/core_engine/lookup_hash.cpp +++ b/src/engine/core_engine/lookup_hash.cpp @@ -170,13 +170,13 @@ HashFunction* Core_Engine::find_hash(const SCAN_Name& request, #if defined(BOTAN_HAS_TIGER) if(request.algo_name() == "Tiger") - return new Tiger(request.arg_as_u32bit(0, 24), // hash output - request.arg_as_u32bit(1, 3)); // # passes + return new Tiger(request.arg_as_integer(0, 24), // hash output + request.arg_as_integer(1, 3)); // # passes #endif #if defined(BOTAN_HAS_SKEIN_512) if(request.algo_name() == "Skein-512") - return new Skein_512(request.arg_as_u32bit(0, 512), + return new Skein_512(request.arg_as_integer(0, 512), request.arg(1, "")); #endif diff --git a/src/engine/core_engine/lookup_stream.cpp b/src/engine/core_engine/lookup_stream.cpp index 52ca4fb8d..5b4859c1a 100644 --- a/src/engine/core_engine/lookup_stream.cpp +++ b/src/engine/core_engine/lookup_stream.cpp @@ -35,7 +35,7 @@ Core_Engine::find_stream_cipher(const SCAN_Name& request, { #if defined(BOTAN_HAS_ARC4) if(request.algo_name() == "ARC4") - return new ARC4(request.arg_as_u32bit(0, 0)); + return new ARC4(request.arg_as_integer(0, 0)); if(request.algo_name() == "RC4_drop") return new ARC4(768); #endif diff --git a/src/engine/openssl/ossl_arc4.cpp b/src/engine/openssl/ossl_arc4.cpp index d76bce349..78217a760 100644 --- a/src/engine/openssl/ossl_arc4.cpp +++ b/src/engine/openssl/ossl_arc4.cpp @@ -72,7 +72,7 @@ OpenSSL_Engine::find_stream_cipher(const SCAN_Name& request, Algorithm_Factory&) const { if(request.algo_name() == "ARC4") - return new ARC4_OpenSSL(request.arg_as_u32bit(0, 0)); + return new ARC4_OpenSSL(request.arg_as_integer(0, 0)); if(request.algo_name() == "RC4_drop") return new ARC4_OpenSSL(768); diff --git a/src/engine/openssl/ossl_bc.cpp b/src/engine/openssl/ossl_bc.cpp index d1365d038..9dc1159a0 100644 --- a/src/engine/openssl/ossl_bc.cpp +++ b/src/engine/openssl/ossl_bc.cpp @@ -213,7 +213,7 @@ OpenSSL_Engine::find_block_cipher(const SCAN_Name& request, #if !defined(OPENSSL_NO_RC5) if(request.algo_name() == "RC5") - if(request.arg_as_u32bit(0, 12) == 12) + if(request.arg_as_integer(0, 12) == 12) return new EVP_BlockCipher(EVP_rc5_32_12_16_ecb(), "RC5(12)", 1, 32, 1); #endif diff --git a/src/libstate/get_enc.cpp b/src/libstate/get_enc.cpp index 1176061c2..d4ca99535 100644 --- a/src/libstate/get_enc.cpp +++ b/src/libstate/get_enc.cpp @@ -161,7 +161,7 @@ EMSA* get_emsa(const std::string& algo_spec) if(request.arg_count() == 3) return new EMSA4(af.make_hash_function(request.arg(0)), - request.arg_as_u32bit(2, 0)); + request.arg_as_integer(2, 0)); } #endif diff --git a/src/libstate/scan_name.cpp b/src/libstate/scan_name.cpp index 7c2e4b28d..a17dc4ad0 100644 --- a/src/libstate/scan_name.cpp +++ b/src/libstate/scan_name.cpp @@ -16,14 +16,14 @@ namespace Botan { namespace { std::string make_arg( - const std::vector<std::pair<u32bit, std::string> >& name, u32bit start) + const std::vector<std::pair<size_t, std::string> >& name, size_t start) { std::string output = name[start].second; - u32bit level = name[start].first; + size_t level = name[start].first; - u32bit paren_depth = 0; + size_t paren_depth = 0; - for(u32bit i = start + 1; i != name.size(); ++i) + for(size_t i = start + 1; i != name.size(); ++i) { if(name[i].first <= name[start].first) break; @@ -48,14 +48,14 @@ std::string make_arg( level = name[i].first; } - for(u32bit i = 0; i != paren_depth; ++i) + for(size_t i = 0; i != paren_depth; ++i) output += ')'; return output; } -std::pair<u32bit, std::string> -deref_aliases(const std::pair<u32bit, std::string>& in) +std::pair<size_t, std::string> +deref_aliases(const std::pair<size_t, std::string>& in) { return std::make_pair(in.first, global_state().deref_alias(in.second)); @@ -67,15 +67,15 @@ SCAN_Name::SCAN_Name(std::string algo_spec) { orig_algo_spec = algo_spec; - std::vector<std::pair<u32bit, std::string> > name; - u32bit level = 0; - std::pair<u32bit, std::string> accum = std::make_pair(level, ""); + std::vector<std::pair<size_t, std::string> > name; + size_t level = 0; + std::pair<size_t, std::string> accum = std::make_pair(level, ""); std::string decoding_error = "Bad SCAN name '" + algo_spec + "': "; algo_spec = global_state().deref_alias(algo_spec); - for(u32bit i = 0; i != algo_spec.size(); ++i) + for(size_t i = 0; i != algo_spec.size(); ++i) { char c = algo_spec[i]; @@ -116,7 +116,7 @@ SCAN_Name::SCAN_Name(std::string algo_spec) bool in_modes = false; - for(u32bit i = 1; i != name.size(); ++i) + for(size_t i = 1; i != name.size(); ++i) { if(name[i].first == 0) { @@ -137,7 +137,7 @@ std::string SCAN_Name::algo_name_and_args() const if(arg_count()) { out += '('; - for(u32bit i = 0; i != arg_count(); ++i) + for(size_t i = 0; i != arg_count(); ++i) { out += arg(i); if(i != arg_count() - 1) @@ -150,21 +150,21 @@ std::string SCAN_Name::algo_name_and_args() const return out; } -std::string SCAN_Name::arg(u32bit i) const +std::string SCAN_Name::arg(size_t i) const { if(i >= arg_count()) throw std::range_error("SCAN_Name::argument - i out of range"); return args[i]; } -std::string SCAN_Name::arg(u32bit i, const std::string& def_value) const +std::string SCAN_Name::arg(size_t i, const std::string& def_value) const { if(i >= arg_count()) return def_value; return args[i]; } -u32bit SCAN_Name::arg_as_u32bit(u32bit i, u32bit def_value) const +size_t SCAN_Name::arg_as_integer(size_t i, size_t def_value) const { if(i >= arg_count()) return def_value; diff --git a/src/libstate/scan_name.h b/src/libstate/scan_name.h index 3d11d54f6..0d30dc44c 100644 --- a/src/libstate/scan_name.h +++ b/src/libstate/scan_name.h @@ -45,35 +45,35 @@ class BOTAN_DLL SCAN_Name /** * @return number of arguments */ - u32bit arg_count() const { return args.size(); } + size_t arg_count() const { return args.size(); } /** * @param lower is the lower bound * @param upper is the upper bound * @return if the number of arguments is between lower and upper */ - bool arg_count_between(u32bit lower, u32bit upper) const + bool arg_count_between(size_t lower, size_t upper) const { return ((arg_count() >= lower) && (arg_count() <= upper)); } /** * @param i which argument * @return ith argument */ - std::string arg(u32bit i) const; + std::string arg(size_t i) const; /** * @param i which argument * @param def_value the default value * @return ith argument or the default value */ - std::string arg(u32bit i, const std::string& def_value) const; + std::string arg(size_t i, const std::string& def_value) const; /** * @param i which argument * @param def_value the default value - * @return ith argument as a u32bit, or the default value + * @return ith argument as an integer, or the default value */ - u32bit arg_as_u32bit(u32bit i, u32bit def_value) const; + size_t arg_as_integer(size_t i, size_t def_value) const; /** * @return cipher mode (if any) |