Chromium Code Reviews| Index: crypto/hmac_openssl.cc |
| diff --git a/crypto/hmac_openssl.cc b/crypto/hmac_openssl.cc |
| index 92eea19d780270cde6fa593986ed2015e9687f85..6cbd1b2b2ff1a8fe0c356f61fc98cbf7879a5f76 100644 |
| --- a/crypto/hmac_openssl.cc |
| +++ b/crypto/hmac_openssl.cc |
| @@ -32,11 +32,8 @@ bool HMAC::Init(const unsigned char* key, size_t key_length) { |
| plat_->key.assign(key, key + key_length); |
| if (key_length == 0) { |
|
davidben
2015/03/04 19:40:59
Hrm. This seems to conflict with the documentation
|
| - // Special-case: if the key is empty, use a key with one zero |
| - // byte. OpenSSL's HMAC function breaks when passed a NULL key. (It calls |
| - // HMAC_Init_ex which treats a NULL key as having already been initialized |
| - // with a key previously.) HMAC pads keys with zeros, so this key is |
| - // equivalent. |
| + // HMAC::Sign() assumes that plat_->key is not empty. |
| + // HMAC pads keys with zeros, so this key is equivalent. |
|
davidben
2015/03/04 19:40:59
Hrm. This seems to only be relevant for the DCHECK
|
| plat_->key.push_back(0); |
| } |
| return true; |