Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Unified Diff: net/ssl/ssl_private_key_test_util.cc

Issue 2575683003: Fix SignWithOpenSSL in SSLPrivateKey tests. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_private_key_test_util.cc
diff --git a/net/ssl/ssl_private_key_test_util.cc b/net/ssl/ssl_private_key_test_util.cc
index 0e60cbcbf9e59d4a4b85c4f1161ae5265d44e335..ddeaca7cd31bece76de285f79320449316f0fd6e 100644
--- a/net/ssl/ssl_private_key_test_util.cc
+++ b/net/ssl/ssl_private_key_test_util.cc
@@ -117,12 +117,12 @@ bool SignWithOpenSSL(const EVP_MD* md,
const base::StringPiece& digest,
EVP_PKEY* key,
std::string* result) {
- size_t sig_len;
+ size_t sig_len = EVP_PKEY_size(key);
bssl::UniquePtr<EVP_PKEY_CTX> ctx(EVP_PKEY_CTX_new(key, nullptr));
if (!ctx || !EVP_PKEY_sign_init(ctx.get()) ||
!EVP_PKEY_CTX_set_signature_md(ctx.get(), md) ||
- !EVP_PKEY_sign(ctx.get(), OpenSSLWriteInto(result, EVP_PKEY_size(key)),
- &sig_len, reinterpret_cast<const uint8_t*>(digest.data()),
+ !EVP_PKEY_sign(ctx.get(), OpenSSLWriteInto(result, sig_len), &sig_len,
+ reinterpret_cast<const uint8_t*>(digest.data()),
digest.size())) {
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698