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

Unified Diff: net/quic/test_tools/crypto_test_utils_openssl.cc

Issue 395933003: Fix TestChannelIDKey ASan failure under OpenSSL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months 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/quic/test_tools/crypto_test_utils_openssl.cc
diff --git a/net/quic/test_tools/crypto_test_utils_openssl.cc b/net/quic/test_tools/crypto_test_utils_openssl.cc
index a6a164b0155e3ed947c4be6af48d6c5e455abf99..f998193596bf5e00a72e983097f0a0e7a0a69cb4 100644
--- a/net/quic/test_tools/crypto_test_utils_openssl.cc
+++ b/net/quic/test_tools/crypto_test_utils_openssl.cc
@@ -32,28 +32,26 @@ class TestChannelIDKey : public ChannelIDKey {
virtual bool Sign(StringPiece signed_data,
string* out_signature) const OVERRIDE {
- EVP_MD_CTX md_ctx;
- EVP_MD_CTX_init(&md_ctx);
- crypto::ScopedEVP_MD_CTX md_ctx_cleanup(&md_ctx);
-
- if (EVP_DigestSignInit(&md_ctx, NULL, EVP_sha256(), NULL,
+ crypto::ScopedEVP_MD_CTX md_ctx(EVP_MD_CTX_create());
+ if (!md_ctx ||
+ EVP_DigestSignInit(md_ctx.get(), NULL, EVP_sha256(), NULL,
ecdsa_key_.get()) != 1) {
return false;
}
- EVP_DigestUpdate(&md_ctx, ChannelIDVerifier::kContextStr,
+ EVP_DigestUpdate(md_ctx.get(), ChannelIDVerifier::kContextStr,
strlen(ChannelIDVerifier::kContextStr) + 1);
- EVP_DigestUpdate(&md_ctx, ChannelIDVerifier::kClientToServerStr,
+ EVP_DigestUpdate(md_ctx.get(), ChannelIDVerifier::kClientToServerStr,
strlen(ChannelIDVerifier::kClientToServerStr) + 1);
- EVP_DigestUpdate(&md_ctx, signed_data.data(), signed_data.size());
+ EVP_DigestUpdate(md_ctx.get(), signed_data.data(), signed_data.size());
size_t sig_len;
- if (!EVP_DigestSignFinal(&md_ctx, NULL, &sig_len)) {
+ if (!EVP_DigestSignFinal(md_ctx.get(), NULL, &sig_len)) {
return false;
}
scoped_ptr<uint8[]> der_sig(new uint8[sig_len]);
- if (!EVP_DigestSignFinal(&md_ctx, der_sig.get(), &sig_len)) {
+ if (!EVP_DigestSignFinal(md_ctx.get(), der_sig.get(), &sig_len)) {
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