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

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

Issue 2561913003: Create a QUIC wrapper around a mutex and a mutex lock. (Closed)
Patch Set: fix 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 | « net/quic/core/crypto/crypto_secret_boxer.h ('k') | net/quic/core/crypto/local_strike_register_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/crypto/crypto_secret_boxer.cc
diff --git a/net/quic/core/crypto/crypto_secret_boxer.cc b/net/quic/core/crypto/crypto_secret_boxer.cc
index 6c5807c9feb371bedd29b1c41158eafea4f10036..986e34ab9b7f1948d886cf3131aa7f1874ea967a 100644
--- a/net/quic/core/crypto/crypto_secret_boxer.cc
+++ b/net/quic/core/crypto/crypto_secret_boxer.cc
@@ -50,14 +50,14 @@ void CryptoSecretBoxer::SetKeys(const std::vector<string>& keys) {
for (const string& key : keys) {
DCHECK_EQ(kKeySize, key.size());
}
- base::AutoLock l(lock_);
+ QuicWriterMutexLock l(&lock_);
keys_.swap(copy);
}
string CryptoSecretBoxer::Box(QuicRandom* rand, StringPiece plaintext) const {
std::unique_ptr<Aes128Gcm12Encrypter> encrypter(new Aes128Gcm12Encrypter());
{
- base::AutoLock l(lock_);
+ QuicReaderMutexLock l(&lock_);
DCHECK_EQ(kKeySize, keys_[0].size());
if (!encrypter->SetKey(keys_[0])) {
DLOG(DFATAL) << "CryptoSecretBoxer's encrypter->SetKey failed.";
@@ -104,7 +104,7 @@ bool CryptoSecretBoxer::Unbox(StringPiece ciphertext,
size_t plaintext_length = 0;
bool ok = false;
{
- base::AutoLock l(lock_);
+ QuicReaderMutexLock l(&lock_);
for (const string& key : keys_) {
if (decrypter->SetKey(key)) {
decrypter->SetNoncePrefix(nonce_prefix);
« no previous file with comments | « net/quic/core/crypto/crypto_secret_boxer.h ('k') | net/quic/core/crypto/local_strike_register_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698