Browse Source

[trac910] clarified an internal method name with some more comments as
suggested in review.

JINMEI Tatuya 13 years ago
parent
commit
f52ff51938
2 changed files with 10 additions and 8 deletions
  1. 6 4
      src/lib/dns/tsig.cc
  2. 4 4
      src/lib/dns/tsig.h

+ 6 - 4
src/lib/dns/tsig.cc

@@ -109,8 +109,10 @@ struct TSIGContext::TSIGContextImpl {
 
     // A shortcut method to create an HMAC object for sign/verify.  If one
     // has been successfully created in the constructor, return it; otherwise
-    // create a new one and return it.
-    HMACPtr getHMAC() {
+    // create a new one and return it.  In the former case, the ownership is
+    // transferred to the caller; the stored HMAC will be reset after the
+    // call.
+    HMACPtr createHMAC() {
         if (hmac_) {
             HMACPtr ret = HMACPtr();
             ret.swap(hmac_);
@@ -353,7 +355,7 @@ TSIGContext::sign(const uint16_t qid, const void* const data,
         return (tsig);
     }
 
-    HMACPtr hmac(impl_->getHMAC());
+    HMACPtr hmac(impl_->createHMAC());
 
     // If the context has previous MAC (either the Request MAC or its own
     // previous MAC), digest it.
@@ -479,7 +481,7 @@ TSIGContext::verify(const TSIGRecord* const record, const void* const data,
         return (impl_->postVerifyUpdate(error, NULL, 0));
     }
 
-    HMACPtr hmac(impl_->getHMAC());
+    HMACPtr hmac(impl_->createHMAC());
 
     // If the context has previous MAC (either the Request MAC or its own
     // previous MAC), digest it.

+ 4 - 4
src/lib/dns/tsig.h

@@ -355,7 +355,7 @@ public:
 
     /// Return the expected length of TSIG RR after \c sign()
     ///
-    /// This method returns the length of the TSIG RR based that would be
+    /// This method returns the length of the TSIG RR that would be
     /// produced as a result of \c sign() with the state of the context
     /// at the time of the call.  The expected length can be decided
     /// from the key and the algorithm (which determines the MAC size if
@@ -363,9 +363,9 @@ public:
     /// related error has been identified, the MAC will be excluded; if
     /// a time error has occurred, the TSIG will include "other data".
     ///
-    /// This method is provided mainly for the convenient of the Message class,
-    /// which needs to know the expected TSIG length in rendering a signed
-    /// DNS message so that it can handle truncated messages with TSIG
+    /// This method is provided mainly for the convenience of the Message
+    /// class, which needs to know the expected TSIG length in rendering a
+    /// signed DNS message so that it can handle truncated messages with TSIG
     /// correctly.  Normal applications wouldn't need this method.  The Python
     /// binding for this method won't be provided for the same reason.
     ///