2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00

[trac936] always fail on secret_len == 0

This commit is contained in:
Jelte Jansen
2011-05-18 21:10:06 +02:00
parent 71eb80242f
commit 89e3ffaa1f

View File

@@ -88,13 +88,11 @@ public:
secret_len); secret_len);
hmac_->set_key(hashed_key.begin(), hashed_key.size()); hmac_->set_key(hashed_key.begin(), hashed_key.size());
} else { } else {
// Apparently 1.9 considers 0 a valid secret length. // Botan 1.8 considers len 0 a bad key. 1.9 does not,
// We do not. // but we won't accept it anyway, and fail early
#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,0)
if (secret_len == 0) { if (secret_len == 0) {
isc_throw(BadKey, "Bad HMAC secret length: 0"); isc_throw(BadKey, "Bad HMAC secret length: 0");
} }
#endif
hmac_->set_key(static_cast<const Botan::byte*>(secret), hmac_->set_key(static_cast<const Botan::byte*>(secret),
secret_len); secret_len);
} }