BIND 10 master, updated. 0346449357648e45f5b68f792cbf6dc914b16d9c Merge branch 'trac936'
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed May 18 19:15:27 UTC 2011
The branch, master has been updated
via 0346449357648e45f5b68f792cbf6dc914b16d9c (commit)
via 89e3ffaa1fb56bcc76f626a64afcc25e506d8b54 (commit)
via 71eb80242fd144bddc06c98b3bdaa91341a65f26 (commit)
via 77def12e8d0d957d9fe587816b27b6df4f88ce90 (commit)
via b50e03318eeb6464f7143eb524eb7b8ed2a5d02a (commit)
from fc97ca7de4ecd731aa6e470a7c68f5b26cbda7b0 (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 0346449357648e45f5b68f792cbf6dc914b16d9c
Merge: fc97ca7de4ecd731aa6e470a7c68f5b26cbda7b0 89e3ffaa1fb56bcc76f626a64afcc25e506d8b54
Author: Jelte Jansen <jelte at isc.org>
Date: Wed May 18 21:11:43 2011 +0200
Merge branch 'trac936'
-----------------------------------------------------------------------
Summary of changes:
src/lib/cryptolink/crypto_hmac.cc | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/cryptolink/crypto_hmac.cc b/src/lib/cryptolink/crypto_hmac.cc
index d20c85b..9aa9d24 100644
--- a/src/lib/cryptolink/crypto_hmac.cc
+++ b/src/lib/cryptolink/crypto_hmac.cc
@@ -17,6 +17,7 @@
#include <boost/scoped_ptr.hpp>
+#include <botan/version.h>
#include <botan/botan.h>
#include <botan/hmac.h>
#include <botan/hash.h>
@@ -70,12 +71,28 @@ public:
// If the key length is larger than the block size, we hash the
// key itself first.
try {
- if (secret_len > hash->HASH_BLOCK_SIZE) {
+ // use a temp var so we don't have blocks spanning
+ // preprocessor directives
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,0)
+ size_t block_length = hash->hash_block_size();
+#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,8,0)
+ size_t block_length = hash->HASH_BLOCK_SIZE;
+#else
+#error "Unsupported Botan version (need 1.8 or higher)"
+ // added to suppress irrelevant compiler errors
+ size_t block_length = 0;
+#endif
+ if (secret_len > block_length) {
Botan::SecureVector<Botan::byte> hashed_key =
hash->process(static_cast<const Botan::byte*>(secret),
secret_len);
hmac_->set_key(hashed_key.begin(), hashed_key.size());
} else {
+ // Botan 1.8 considers len 0 a bad key. 1.9 does not,
+ // but we won't accept it anyway, and fail early
+ if (secret_len == 0) {
+ isc_throw(BadKey, "Bad HMAC secret length: 0");
+ }
hmac_->set_key(static_cast<const Botan::byte*>(secret),
secret_len);
}
@@ -89,7 +106,15 @@ public:
~HMACImpl() { }
size_t getOutputLength() const {
+#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,0)
+ return (hmac_->output_length());
+#elif BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,8,0)
return (hmac_->OUTPUT_LENGTH);
+#else
+#error "Unsupported Botan version (need 1.8 or higher)"
+ // added to suppress irrelevant compiler errors
+ return 0;
+#endif
}
void update(const void* data, const size_t len) {
More information about the bind10-changes
mailing list