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

Unified Diff: net/quic/core/crypto/crypto_server_test.cc

Issue 2672403003: Replace crypto::SecureHash with calls to SHA256. (Closed)
Patch Set: Created 3 years, 10 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 | net/quic/core/crypto/crypto_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/crypto/crypto_server_test.cc
diff --git a/net/quic/core/crypto/crypto_server_test.cc b/net/quic/core/crypto/crypto_server_test.cc
index 941e2fedd0b0c59afc63556f0ff6694561adc7bc..9776deb7462a329357f2f51b7f244cb470f4c3d1 100644
--- a/net/quic/core/crypto/crypto_server_test.cc
+++ b/net/quic/core/crypto/crypto_server_test.cc
@@ -8,7 +8,6 @@
#include <ostream>
#include <vector>
-#include "crypto/secure_hash.h"
#include "net/quic/core/crypto/cert_compressor.h"
#include "net/quic/core/crypto/common_cert_set.h"
#include "net/quic/core/crypto/crypto_handshake.h"
@@ -29,6 +28,7 @@
#include "net/quic/test_tools/quic_crypto_server_config_peer.h"
#include "net/quic/test_tools/quic_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/boringssl/src/include/openssl/sha.h"
using base::StringPiece;
using std::string;
@@ -1085,14 +1085,13 @@ TEST(CryptoServerConfigGenerationTest, SCIDIsHashOfServerConfig) {
scfg->MarkDirty();
const QuicData& serialized(scfg->GetSerialized());
- std::unique_ptr<crypto::SecureHash> hash(
- crypto::SecureHash::Create(crypto::SecureHash::SHA256));
- hash->Update(serialized.data(), serialized.length());
- uint8_t digest[16];
- hash->Finish(digest, sizeof(digest));
+ uint8_t digest[SHA256_DIGEST_LENGTH];
+ SHA256(reinterpret_cast<const uint8_t*>(serialized.data()),
+ serialized.length(), digest);
- ASSERT_EQ(scid.size(), sizeof(digest));
- EXPECT_EQ(0, memcmp(digest, scid_str.c_str(), sizeof(digest)));
+ // scid is a SHA-256 hash, truncated to 16 bytes.
+ ASSERT_EQ(scid.size(), 16u);
+ EXPECT_EQ(0, memcmp(digest, scid_str.c_str(), scid.size()));
}
class CryptoServerTestNoConfig : public CryptoServerTest {
« no previous file with comments | « no previous file | net/quic/core/crypto/crypto_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698