Browse Source

Merge branch 'trac781' of ssh://bind10.isc.org/var/bind10/git/bind10 into trac781

Jelte Jansen 14 years ago
parent
commit
145a617319

+ 1 - 1
src/lib/cryptolink/crypto_hmac.cc

@@ -102,7 +102,7 @@ public:
     void sign(isc::dns::OutputBuffer& result, size_t len) {
         try {
             Botan::SecureVector<Botan::byte> b_result(hmac_->final());
-    
+
             if (len == 0 || len > b_result.size()) {
                 len = b_result.size();
             }

+ 7 - 6
src/lib/cryptolink/cryptolink.cc

@@ -28,7 +28,7 @@ namespace cryptolink {
 // For Botan, we use the CryptoLink class object in RAII style
 class CryptoLinkImpl {
 private:
-    Botan::LibraryInitializer _botan_init;
+    Botan::LibraryInitializer botan_init_;
 };
 
 CryptoLink::~CryptoLink() {
@@ -37,11 +37,11 @@ CryptoLink::~CryptoLink() {
 
 CryptoLink&
 CryptoLink::getCryptoLink() {
-    CryptoLink &c = getCryptoLinkInternal();
-    if (!c.impl_) {
+    CryptoLink& c = getCryptoLinkInternal();
+    if (c.impl_ == NULL) {
         c.initialize();
     }
-    return c;
+    return (c);
 }
 
 CryptoLink&
@@ -53,7 +53,7 @@ CryptoLink::getCryptoLinkInternal() {
 void
 CryptoLink::initialize() {
     CryptoLink& c = getCryptoLinkInternal();
-    if (!c.impl_) {
+    if (c.impl_ == NULL) {
         try {
             c.impl_ = new CryptoLinkImpl();
         } catch (const Botan::Exception& ex) {
@@ -64,7 +64,8 @@ CryptoLink::initialize() {
 
 HMAC*
 CryptoLink::createHMAC(const void* secret, size_t secret_len,
-                   const HMAC::HashAlgorithm hash_algorithm) {
+                       const HMAC::HashAlgorithm hash_algorithm)
+{
     return (new HMAC(secret, secret_len, hash_algorithm));
 }
 

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

@@ -153,7 +153,7 @@ private:
 
     // To prevent people constructing their own, we make the constructor
     // private too.
-    CryptoLink() : impl_(NULL) {};
+    CryptoLink() : impl_(NULL) {}
     ~CryptoLink();
 
     CryptoLinkImpl* impl_;

+ 6 - 7
src/lib/cryptolink/tests/crypto_unittests.cc

@@ -107,7 +107,7 @@ namespace {
         // whether verification fails then
         hmac_sig.writeUint8At(~hmac_sig[0], 0);
         EXPECT_FALSE(hmac_verify->verify(hmac_sig.getData(),
-                                        hmac_sig.getLength()));
+                                         hmac_sig.getLength()));
     }
 
     void doHMACTestVector(const std::string& data,
@@ -428,7 +428,7 @@ namespace {
             CryptoLink::getCryptoLink().createHMAC("asdf", 4, alg));
         hmac_sign->update("asdf", 4);
         const std::vector<uint8_t> sig = hmac_sign->sign(len);
-        return sig.size();
+        return (sig.size());
     }
 
     size_t
@@ -438,12 +438,11 @@ namespace {
         hmac_sign->update("asdf", 4);
         OutputBuffer sig(0);
         hmac_sign->sign(sig, len);
-        return sig.getLength();
+        return (sig.getLength());
     }
 }
 
-TEST(CryptoLinkTest, HMACSigLengthArgument)
-{
+TEST(CryptoLinkTest, HMACSigLengthArgument) {
     std::vector<uint8_t> sig;
 
     EXPECT_EQ(16, sigVectorLength(HMAC::MD5, 0));
@@ -507,7 +506,7 @@ TEST(CryptoLinkTest, BadKey) {
 }
 
 TEST(CryptoLinkTest, Singleton) {
-    CryptoLink& c1 = CryptoLink::getCryptoLink();
-    CryptoLink& c2 = CryptoLink::getCryptoLink();
+    const CryptoLink& c1 = CryptoLink::getCryptoLink();
+    const CryptoLink& c2 = CryptoLink::getCryptoLink();
     ASSERT_EQ(&c1, &c2);
 }