]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3908] Addressed comments (no code change)
authorFrancis Dupont <fdupont@isc.org>
Sat, 22 Oct 2016 09:29:54 +0000 (11:29 +0200)
committerFrancis Dupont <fdupont@isc.org>
Sat, 22 Oct 2016 09:29:54 +0000 (11:29 +0200)
src/lib/cryptolink/botan_hmac.cc
src/lib/cryptolink/crypto_hash.h
src/lib/cryptolink/crypto_hmac.h
src/lib/cryptolink/openssl_hmac.cc

index ce90e9ff3a07f04ff72ea7cb8d54521938710b92..27281f0cbc4f97800efb3cb17ffb34fd8cd77aa8 100644 (file)
@@ -180,9 +180,9 @@ public:
     ///
     /// See @ref isc::cryptolink::HMAC::verify() for details.
     bool verify(const void* sig, size_t len) {
-        /// @todo Botan's verify_mac checks if len matches the output_length,
-        /// which causes it to fail for truncated signatures, so we do
-        /// the check ourselves
+        // Botan's verify_mac checks if len matches the output_length,
+        // which causes it to fail for truncated signatures, so we do
+        // the check ourselves
         try {
             size_t size = getOutputLength();
             if (len < 10 || len < size / 2) {
@@ -194,6 +194,8 @@ public:
             if (digest_.empty()) {
                 digest_ = hmac_->final();
             }
+            // digest_.size() == size by construction
+            // if you are not convinced, add an assert()
             return (Botan::same_mem(&digest_[0],
                                     static_cast<const unsigned char*>(sig),
                                     len));
index 58d4cc4d454d6bfddca5de1e688c962f52711821..e674694632e4ce67c8e7004dc775daf170fa8a87 100644 (file)
@@ -51,6 +51,8 @@ public:
     ~Hash();
 
     /// \brief Returns the HashAlgorithm of the object
+    ///
+    /// \return hash algorithm
     HashAlgorithm getHashAlgorithm() const;
 
     /// \brief Returns the output size of the digest
index fdd78d33d4a4784bc00b7b4c8005969d3089ed78..48b0ef156fd8efd675781573d7efd1b7a3d46091 100644 (file)
@@ -61,6 +61,8 @@ public:
     ~HMAC();
 
     /// \brief Returns the HashAlgorithm of the object
+    ///
+    /// \return hash algorithm
     HashAlgorithm getHashAlgorithm() const;
 
     /// \brief Returns the output size of the digest
@@ -126,7 +128,9 @@ public:
     /// \param sig The signature to verify
     /// \param len The length of the signature. If this is smaller
     ///            than the output length of the algorithm,
-    ///            only len bytes will be checked
+    ///            only len bytes will be checked. If this is
+    ///            larger than the output length of the algorithm,
+    ///            only output size bytes will be checked
     /// \return true if the signature is correct, false otherwise
     ///
     /// \note verify() does not destroy its context so it can be
index 6d6a12967241a136a530741d66f6aa194632916d..57ed066a75a3082433e533c403cc9d2a8b7c40bb 100644 (file)
@@ -163,6 +163,8 @@ public:
         if (len > size) {
             len = size;
         }
+        // digest.size() == size by construction
+        // if you are not convinced, add an assert()
         return (digest.same(sig, len));
     }