Chromium Code Reviews| Index: crypto/hmac_openssl.cc |
| diff --git a/crypto/hmac_openssl.cc b/crypto/hmac_openssl.cc |
| index f7010c81bc651a562996b788645352b6cb2a3e1b..2f9218387092c15fe76df9b67d86359c674de042 100644 |
| --- a/crypto/hmac_openssl.cc |
| +++ b/crypto/hmac_openssl.cc |
| @@ -31,6 +31,12 @@ bool HMAC::Init(const unsigned char* key, size_t key_length) { |
| DCHECK(plat_->key.empty()); |
| plat_->key.assign(key, key + key_length); |
| + if (key_length == 0) { |
| + // Special-case: if the key is empty, use a key with one zero byte. OpenSSL |
| + // does not like NULL keys, but keys are padded with zeros, so they're |
| + // equivalent. |
|
wtc
2014/04/09 21:30:58
It would be nice to note what a NULL key means to
davidben
2014/04/09 21:44:29
Done.
|
| + plat_->key.push_back(0); |
| + } |
| return true; |
| } |