BIND 10 trac781, updated. c374a5c5a329a307346be02d5b884ab57e1cb8c1 [trac781] make sig args for verify() also raw data
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Apr 14 09:40:38 UTC 2011
The branch, trac781 has been updated
via c374a5c5a329a307346be02d5b884ab57e1cb8c1 (commit)
from cd3ce64ac0ac3e82ba905f3eea77f1040b7e69b8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c374a5c5a329a307346be02d5b884ab57e1cb8c1
Author: Jelte Jansen <jelte at isc.org>
Date: Thu Apr 14 11:40:20 2011 +0200
[trac781] make sig args for verify() also raw data
-----------------------------------------------------------------------
Summary of changes:
src/lib/crypto/crypto.cc | 4 ++--
src/lib/crypto/crypto.h | 3 ++-
src/lib/crypto/tests/crypto_unittests.cc | 9 ++++++---
3 files changed, 10 insertions(+), 6 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/crypto/crypto.cc b/src/lib/crypto/crypto.cc
index 0729d3b..f0ebea7 100644
--- a/src/lib/crypto/crypto.cc
+++ b/src/lib/crypto/crypto.cc
@@ -138,11 +138,11 @@ signHMAC(const void* data, size_t data_len, TSIGKey key,
bool
verifyHMAC(const void* data, size_t data_len, TSIGKey key,
- const isc::dns::OutputBuffer& result)
+ const void* sig, size_t sig_len)
{
HMAC hmac(key);
hmac.update(data, data_len);
- return (hmac.verify(result.getData(), result.getLength()));
+ return (hmac.verify(sig, sig_len));
}
} // namespace crypto
diff --git a/src/lib/crypto/crypto.h b/src/lib/crypto/crypto.h
index 3558543..53f1605 100644
--- a/src/lib/crypto/crypto.h
+++ b/src/lib/crypto/crypto.h
@@ -138,7 +138,8 @@ void signHMAC(const void* data,
bool verifyHMAC(const void* data,
size_t data_len,
isc::dns::TSIGKey key,
- const isc::dns::OutputBuffer& mac);
+ const void* sig,
+ size_t sig_len);
} // namespace crypto
} // namespace isc
diff --git a/src/lib/crypto/tests/crypto_unittests.cc b/src/lib/crypto/tests/crypto_unittests.cc
index 9ba3510..057622f 100644
--- a/src/lib/crypto/tests/crypto_unittests.cc
+++ b/src/lib/crypto/tests/crypto_unittests.cc
@@ -49,13 +49,15 @@ namespace {
// Check whether we can verify it ourselves
EXPECT_TRUE(verifyHMAC(data_buf.getData(), data_buf.getLength(),
- key, hmac_sig));
+ key, hmac_sig.getData(),
+ hmac_sig.getLength()));
// Change the sig by flipping the first octet, and check
// whether verification fails then
hmac_sig.writeUint8At(~hmac_sig[0], 0);
EXPECT_FALSE(verifyHMAC(data_buf.getData(), data_buf.getLength(),
- key, hmac_sig));
+ key, hmac_sig.getData(),
+ hmac_sig.getLength()));
}
}
@@ -291,5 +293,6 @@ TEST(CryptoTest, BadKey) {
EXPECT_THROW(signHMAC(data_buf.getData(), data_buf.getLength(),
bad_key, hmac_sig), BadKey);
EXPECT_THROW(verifyHMAC(data_buf.getData(), data_buf.getLength(),
- bad_key, hmac_sig), BadKey);
+ bad_key, hmac_sig.getData(),
+ hmac_sig.getLength()), BadKey);
}
More information about the bind10-changes
mailing list