diff options
author | lloyd <[email protected]> | 2008-11-10 23:03:35 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-10 23:03:35 +0000 |
commit | f947cfbd1523f2bd1930fccbd4a5586f633661ed (patch) | |
tree | 966e71638c8d40a63e0a11c4b2fc921810db2111 /src | |
parent | c975e9017032bcbce0d5beffd7fc89fa1b3210a0 (diff) |
Shorten SCAN_Name's argument arg in function names
Diffstat (limited to 'src')
-rw-r--r-- | src/libstate/engine/def_engine/lookup_block.cpp | 14 | ||||
-rw-r--r-- | src/libstate/engine/def_engine/lookup_hash.cpp | 6 | ||||
-rw-r--r-- | src/libstate/engine/def_engine/lookup_mac.cpp | 8 | ||||
-rw-r--r-- | src/libstate/engine/def_engine/lookup_stream.cpp | 2 | ||||
-rw-r--r-- | src/libstate/get_enc.cpp | 34 | ||||
-rw-r--r-- | src/pbe/get_pbe.cpp | 8 | ||||
-rw-r--r-- | src/utils/scan_name.cpp | 4 | ||||
-rw-r--r-- | src/utils/scan_name.h | 4 |
8 files changed, 40 insertions, 40 deletions
diff --git a/src/libstate/engine/def_engine/lookup_block.cpp b/src/libstate/engine/def_engine/lookup_block.cpp index ce981ae0c..3503433e8 100644 --- a/src/libstate/engine/def_engine/lookup_block.cpp +++ b/src/libstate/engine/def_engine/lookup_block.cpp @@ -165,7 +165,7 @@ Default_Engine::find_block_cipher(const SCAN_Name& request, #if defined(BOTAN_HAS_MISTY1) if(request.algo_name() == "MISTY1") - return new MISTY1(request.argument_as_u32bit(0, 8)); + return new MISTY1(request.arg_as_u32bit(0, 8)); #endif #if defined(BOTAN_HAS_NOEKEON) @@ -180,7 +180,7 @@ Default_Engine::find_block_cipher(const SCAN_Name& request, #if defined(BOTAN_HAS_RC5) if(request.algo_name() == "RC5") - return new RC5(request.argument_as_u32bit(0, 12)); + return new RC5(request.arg_as_u32bit(0, 12)); #endif #if defined(BOTAN_HAS_RC6) @@ -190,7 +190,7 @@ Default_Engine::find_block_cipher(const SCAN_Name& request, #if defined(BOTAN_HAS_SAFER) if(request.algo_name() == "SAFER-SK") - return new SAFER_SK(request.argument_as_u32bit(0, 10)); + return new SAFER_SK(request.arg_as_u32bit(0, 10)); #endif #if defined(BOTAN_HAS_SEED) @@ -232,7 +232,7 @@ Default_Engine::find_block_cipher(const SCAN_Name& request, if(request.algo_name() == "Luby-Rackoff" && request.arg_count() == 1) { const HashFunction* hash = - af.make_hash_function(request.argument(0)); + af.make_hash_function(request.arg(0)); if(hash) return new LubyRackoff(hash->clone()); @@ -242,13 +242,13 @@ Default_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.argument_as_u32bit(2, 1024); + const u32bit block_size = request.arg_as_u32bit(2, 1024); const HashFunction* hash = - af.prototype_hash_function(request.argument(0)); + af.prototype_hash_function(request.arg(0)); const StreamCipher* stream_cipher = - af.prototype_stream_cipher(request.argument(1)); + af.prototype_stream_cipher(request.arg(1)); if(!hash || !stream_cipher) return 0; diff --git a/src/libstate/engine/def_engine/lookup_hash.cpp b/src/libstate/engine/def_engine/lookup_hash.cpp index 0bfa08e3b..da782fc0a 100644 --- a/src/libstate/engine/def_engine/lookup_hash.cpp +++ b/src/libstate/engine/def_engine/lookup_hash.cpp @@ -146,8 +146,8 @@ Default_Engine::find_hash(const SCAN_Name& request, #if defined(BOTAN_HAS_TIGER) if(request.algo_name() == "Tiger") - return new Tiger(request.argument_as_u32bit(0, 24), // hash output - request.argument_as_u32bit(1, 3)); // # passes + return new Tiger(request.arg_as_u32bit(0, 24), // hash output + request.arg_as_u32bit(1, 3)); // # passes #endif #if defined(BOTAN_HAS_WHIRLPOOL) @@ -166,7 +166,7 @@ Default_Engine::find_hash(const SCAN_Name& request, */ for(size_t i = 0; i != request.arg_count(); ++i) { - SCAN_Name hash_request(request.argument(i), + SCAN_Name hash_request(request.arg(i), request.providers_string()); const HashFunction* hash = af.prototype_hash_function(hash_request); diff --git a/src/libstate/engine/def_engine/lookup_mac.cpp b/src/libstate/engine/def_engine/lookup_mac.cpp index 0e826e864..ae44bbe3d 100644 --- a/src/libstate/engine/def_engine/lookup_mac.cpp +++ b/src/libstate/engine/def_engine/lookup_mac.cpp @@ -39,22 +39,22 @@ Default_Engine::find_mac(const SCAN_Name& request, #if defined(BOTAN_HAS_CBC_MAC) if(request.algo_name() == "CBC-MAC" && request.arg_count() == 1) - return new CBC_MAC(af.make_block_cipher(request.argument(0))); + return new CBC_MAC(af.make_block_cipher(request.arg(0))); #endif #if defined(BOTAN_HAS_CMAC) if(request.algo_name() == "CMAC" && request.arg_count() == 1) - return new CMAC(af.make_block_cipher(request.argument(0))); + return new CMAC(af.make_block_cipher(request.arg(0))); #endif #if defined(BOTAN_HAS_HMAC) if(request.algo_name() == "HMAC" && request.arg_count() == 1) - return new HMAC(af.make_hash_function(request.argument(0))); + return new HMAC(af.make_hash_function(request.arg(0))); #endif #if defined(BOTAN_HAS_SSL3_MAC) if(request.algo_name() == "SSL3-MAC" && request.arg_count() == 1) - return new SSL3_MAC(af.make_hash_function(request.argument(0))); + return new SSL3_MAC(af.make_hash_function(request.arg(0))); #endif #if defined(BOTAN_HAS_ANSI_X919_MAC) diff --git a/src/libstate/engine/def_engine/lookup_stream.cpp b/src/libstate/engine/def_engine/lookup_stream.cpp index 87ae6c62a..e7f1ff41d 100644 --- a/src/libstate/engine/def_engine/lookup_stream.cpp +++ b/src/libstate/engine/def_engine/lookup_stream.cpp @@ -33,7 +33,7 @@ Default_Engine::find_stream_cipher(const SCAN_Name& request, { #if defined(BOTAN_HAS_ARC4) if(request.algo_name() == "ARC4") - return new ARC4(request.argument_as_u32bit(0, 0)); + return new ARC4(request.arg_as_u32bit(0, 0)); if(request.algo_name() == "RC4_drop") return new ARC4(768); #endif diff --git a/src/libstate/get_enc.cpp b/src/libstate/get_enc.cpp index f2398e318..63da7518b 100644 --- a/src/libstate/get_enc.cpp +++ b/src/libstate/get_enc.cpp @@ -87,17 +87,17 @@ S2K* get_s2k(const std::string& algo_spec) #if defined(BOTAN_HAS_PBKDF1) if(request.algo_name() == "PBKDF1" && request.arg_count() == 1) - return new PKCS5_PBKDF1(get_hash(request.argument(0))); + return new PKCS5_PBKDF1(get_hash(request.arg(0))); #endif #if defined(BOTAN_HAS_PBKDF2) if(request.algo_name() == "PBKDF2" && request.arg_count() == 1) - return new PKCS5_PBKDF2(new HMAC(get_hash(request.argument(0)))); + return new PKCS5_PBKDF2(new HMAC(get_hash(request.arg(0)))); #endif #if defined(BOTAN_HAS_PGPS2K) if(request.algo_name() == "OpenPGP-S2K" && request.arg_count() == 1) - return new OpenPGP_S2K(get_hash(request.argument(0))); + return new OpenPGP_S2K(get_hash(request.arg(0))); #endif throw Algorithm_Not_Found(algo_spec); @@ -117,22 +117,22 @@ EMSA* get_emsa(const std::string& algo_spec) #if defined(BOTAN_HAS_EMSA1) if(request.algo_name() == "EMSA1" && request.arg_count() == 1) - return new EMSA1(get_hash(request.argument(0))); + return new EMSA1(get_hash(request.arg(0))); #endif #if defined(BOTAN_HAS_EMSA1_BSI) if(request.algo_name() == "EMSA1_BSI" && request.arg_count() == 1) - return new EMSA1_BSI(get_hash(request.argument(0))); + return new EMSA1_BSI(get_hash(request.arg(0))); #endif #if defined(BOTAN_HAS_EMSA2) if(request.algo_name() == "EMSA2" && request.arg_count() == 1) - return new EMSA2(get_hash(request.argument(0))); + return new EMSA2(get_hash(request.arg(0))); #endif #if defined(BOTAN_HAS_EMSA3) if(request.algo_name() == "EMSA3" && request.arg_count() == 1) - return new EMSA3(get_hash(request.argument(0))); + return new EMSA3(get_hash(request.arg(0))); #endif #if defined(BOTAN_HAS_EMSA4) @@ -140,14 +140,14 @@ EMSA* get_emsa(const std::string& algo_spec) { // 3 args: Hash, MGF, salt size (MGF is hardcoded MGF1 in Botan) if(request.arg_count() == 1) - return new EMSA4(get_hash(request.argument(0))); + return new EMSA4(get_hash(request.arg(0))); - if(request.arg_count() == 2 && request.argument(1) != "MGF1") - return new EMSA4(get_hash(request.argument(0))); + if(request.arg_count() == 2 && request.arg(1) != "MGF1") + return new EMSA4(get_hash(request.arg(0))); if(request.arg_count() == 3) - return new EMSA4(get_hash(request.argument(0)), - request.argument_as_u32bit(2, 0)); + return new EMSA4(get_hash(request.arg(0)), + request.arg_as_u32bit(2, 0)); } #endif @@ -170,9 +170,9 @@ EME* get_eme(const std::string& algo_spec) if(request.algo_name() == "EME1" && request.arg_count_between(1, 2)) { if(request.arg_count() == 1 || - (request.arg_count() == 2 && request.argument(1) == "MGF1")) + (request.arg_count() == 2 && request.arg(1) == "MGF1")) { - return new EME1(get_hash(request.argument(0))); + return new EME1(get_hash(request.arg(0))); } } #endif @@ -189,17 +189,17 @@ KDF* get_kdf(const std::string& algo_spec) #if defined(BOTAN_HAS_KDF1) if(request.algo_name() == "KDF1" && request.arg_count() == 1) - return new KDF1(get_hash(request.argument(0))); + return new KDF1(get_hash(request.arg(0))); #endif #if defined(BOTAN_HAS_KDF2) if(request.algo_name() == "KDF2" && request.arg_count() == 1) - return new KDF2(get_hash(request.argument(0))); + return new KDF2(get_hash(request.arg(0))); #endif #if defined(BOTAN_HAS_X942_PRF) if(request.algo_name() == "X9.42-PRF" && request.arg_count() == 1) - return new X942_PRF(request.argument(0)); + return new X942_PRF(request.arg(0)); #endif #if defined(BOTAN_HAS_TLS_V10_PRF) diff --git a/src/pbe/get_pbe.cpp b/src/pbe/get_pbe.cpp index 34f60e241..103e64a0c 100644 --- a/src/pbe/get_pbe.cpp +++ b/src/pbe/get_pbe.cpp @@ -28,8 +28,8 @@ PBE* get_pbe(const std::string& pbe_name) throw Invalid_Algorithm_Name(pbe_name); const std::string pbe = request.algo_name(); - const std::string digest = request.argument(0); - const std::string cipher = request.argument(1); + const std::string digest = request.arg(0); + const std::string cipher = request.arg(1); #if defined(BOTAN_HAS_PBE_PKCS_V15) if(pbe == "PBE-PKCS5v15") @@ -57,8 +57,8 @@ PBE* get_pbe(const OID& pbe_oid, DataSource& params) if(request.arg_count() != 2) throw Invalid_Algorithm_Name(pbe_oid.as_string()); - const std::string digest = request.argument(0); - const std::string cipher = request.argument(1); + const std::string digest = request.arg(0); + const std::string cipher = request.arg(1); PBE* pbe = new PBE_PKCS5v15(digest, cipher, DECRYPTION); pbe->decode_params(params); diff --git a/src/utils/scan_name.cpp b/src/utils/scan_name.cpp index f0df99bde..7855f3ec3 100644 --- a/src/utils/scan_name.cpp +++ b/src/utils/scan_name.cpp @@ -71,14 +71,14 @@ bool SCAN_Name::provider_allowed(const std::string& provider) const return (providers.find(provider) != providers.end()); } -std::string SCAN_Name::argument(u32bit i) const +std::string SCAN_Name::arg(u32bit i) const { if(i > arg_count()) throw std::range_error("SCAN_Name::argument"); return name[i+1]; } -u32bit SCAN_Name::argument_as_u32bit(u32bit i, u32bit def_value) const +u32bit SCAN_Name::arg_as_u32bit(u32bit i, u32bit def_value) const { if(i >= arg_count()) return def_value; diff --git a/src/utils/scan_name.h b/src/utils/scan_name.h index a463c6adc..15fa09f48 100644 --- a/src/utils/scan_name.h +++ b/src/utils/scan_name.h @@ -53,13 +53,13 @@ class SCAN_Name @param i which argument @return the ith argument */ - std::string argument(u32bit i) const; + std::string arg(u32bit i) const; /** @param i which argument @return the ith argument as a u32bit, or a default value */ - u32bit argument_as_u32bit(u32bit i, u32bit def_value) const; + u32bit arg_as_u32bit(u32bit i, u32bit def_value) const; std::string as_string() const { return orig_algo_spec; } std::string providers_string() const { return orig_providers; } |