Chromium Code Reviews| Index: content/child/webcrypto/openssl/hmac_openssl.cc |
| diff --git a/content/child/webcrypto/openssl/hmac_openssl.cc b/content/child/webcrypto/openssl/hmac_openssl.cc |
| index 0872390d457a129fea36030889405ae4dbab9271..c380b37756965f8bbdec724c570f51c593f9fcf6 100644 |
| --- a/content/child/webcrypto/openssl/hmac_openssl.cc |
| +++ b/content/child/webcrypto/openssl/hmac_openssl.cc |
| @@ -38,13 +38,9 @@ Status SignHmac(const std::vector<uint8_t>& raw_key, |
| return Status::ErrorUnsupported(); |
| unsigned int hmac_expected_length = EVP_MD_size(digest_algorithm); |
| - // OpenSSL wierdness here. |
| - // First, HMAC() needs a void* for the key data, so make one up front as a |
| - // cosmetic to avoid a cast. Second, OpenSSL does not like a NULL key, |
| - // which will result if the raw_key vector is empty; an entirely valid |
| - // case. Handle this specific case by pointing to a fresh array. |
| - const unsigned char null_key[] = {0}; |
| - const void* const raw_key_voidp = raw_key.size() ? &raw_key[0] : null_key; |
| + // HMAC() needs a void* for the key data, so make one up front as a |
| + // cosmetic to avoid a cast. |
| + const void* const raw_key_voidp = raw_key.empty() ? NULL : &raw_key[0]; |
|
davidben
2015/03/04 19:40:59
vector_as_array?
|
| buffer->resize(hmac_expected_length); |
| crypto::ScopedOpenSSLSafeSizeBuffer<EVP_MAX_MD_SIZE> hmac_result( |