| Index: net/ssl/openssl_platform_key_win.cc
|
| diff --git a/net/ssl/openssl_platform_key_win.cc b/net/ssl/openssl_platform_key_win.cc
|
| index 4a399fb20d03e100eedc4ae4ee18ea385be40ae2..9033c6e8e4b3d99929846258c29926ced129d2a1 100644
|
| --- a/net/ssl/openssl_platform_key_win.cc
|
| +++ b/net/ssl/openssl_platform_key_win.cc
|
| @@ -317,7 +317,20 @@ int RsaMethodSign(int hash_nid,
|
| OpenSSLPutNetError(FROM_HERE, ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED);
|
| return 0;
|
| }
|
| - DWORD signature_len = RSA_size(rsa);
|
| + // Determine the output length.
|
| + DWORD signature_len = 0;
|
| + if (!CryptSignHash(hash.get(), ex_data->key->dwKeySpec, nullptr, 0, nullptr,
|
| + &signature_len)) {
|
| + PLOG(ERROR) << "CryptSignHash failed";
|
| + OpenSSLPutNetError(FROM_HERE, ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED);
|
| + return 0;
|
| + }
|
| + if (signature_len == 0 || signature_len > RSA_size(rsa)) {
|
| + LOG(ERROR) << "Bad signature length";
|
| + OpenSSLPutNetError(FROM_HERE, ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED);
|
| + return 0;
|
| + }
|
| + // Sign the hash.
|
| if (!CryptSignHash(hash.get(), ex_data->key->dwKeySpec, nullptr, 0, out,
|
| &signature_len)) {
|
| PLOG(ERROR) << "CryptSignHash failed";
|
|
|