Parcourir la source

[trac781] some mostly editorial cleanups: remove redudant whites, catch
exception by reference, indentation fixes.

JINMEI Tatuya il y a 14 ans
Parent
commit
231b299118
3 fichiers modifiés avec 11 ajouts et 10 suppressions
  1. 9 8
      src/lib/crypto/crypto.cc
  2. 1 1
      src/lib/crypto/crypto.h
  3. 1 1
      src/lib/dns/tsigkey.cc

+ 9 - 8
src/lib/crypto/crypto.cc

@@ -33,13 +33,14 @@ using namespace std;
 using namespace isc::dns;
 
 namespace {
-Botan::HashFunction* getHash(const Name& hash_name) {
+Botan::HashFunction*
+getHash(const Name& hash_name) {
     if (hash_name == TSIGKey::HMACMD5_NAME()) {
-        return Botan::get_hash("MD5");
+        return (Botan::get_hash("MD5"));
     } else if (hash_name == TSIGKey::HMACSHA1_NAME()) {
-        return Botan::get_hash("SHA-1");
+        return (Botan::get_hash("SHA-1"));
     } else if (hash_name == TSIGKey::HMACSHA256_NAME()) {
-        return Botan::get_hash("SHA-256");
+        return (Botan::get_hash("SHA-256"));
     } else {
         isc_throw(isc::crypto::UnsupportedAlgorithm,
                   "Unknown Hash type " + hash_name.toText());
@@ -73,9 +74,9 @@ public:
                 hmac_->set_key(hashed_key.begin(), hashed_key.size());
             } else {
                 hmac_->set_key(static_cast<const Botan::byte*>(key.getSecret()),
-                             key.getSecretLength());
+                               key.getSecretLength());
             }
-        } catch (Botan::Invalid_Key_Length ikl) {
+        } catch (const Botan::Invalid_Key_Length& ikl) {
             isc_throw(BadKey, ikl.what());
         }
     }
@@ -90,11 +91,11 @@ public:
     void sign(isc::dns::OutputBuffer& result) const {
         // And generate the mac
         Botan::SecureVector<Botan::byte> b_result(hmac_->final());
-    
+
         // write mac to result
         result.writeData(b_result.begin(), b_result.size());
     }
-    
+
     bool verify(const void* sig, const size_t len) const {
         return (hmac_->verify_mac(static_cast<const Botan::byte*>(sig), len));
     }

+ 1 - 1
src/lib/crypto/crypto.h

@@ -66,7 +66,7 @@ public:
     /// Notes: if the key is longer than the block size of its
     /// algorithm, the constructor will run it through the hash
     /// algorithm, and use the digest as a key for this HMAC operation
-    /// 
+    ///
     /// \param key The key to use
     explicit HMAC(const isc::dns::TSIGKey& key);
 

+ 1 - 1
src/lib/dns/tsigkey.cc

@@ -99,7 +99,7 @@ TSIGKey::TSIGKey(const std::string& str) : impl_(NULL) {
 
         impl_ = new TSIGKeyImpl(key_name, algo_name, secret_b,
                                 secret.size());
-    } catch (Exception e) {
+    } catch (const Exception& e) {
         // 'reduce' the several types of exceptions name parsing and
         // Base64 decoding can throw to just the InvalidParameter
         isc_throw(InvalidParameter, e.what());