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

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

Issue 868953002: Remove unused QuicDecrypter::Decrypt method and implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@merge_84442484
Patch Set: Created 5 years, 11 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 | « net/quic/crypto/chacha20_poly1305_decrypter_test.cc ('k') | net/quic/crypto/null_decrypter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/crypto_secret_boxer.cc
diff --git a/net/quic/crypto/crypto_secret_boxer.cc b/net/quic/crypto/crypto_secret_boxer.cc
index 5d8a11b27a309c9a612d8194732af76ef1e1a39a..5af45a95527000121e455b38f67fdc7400697c1f 100644
--- a/net/quic/crypto/crypto_secret_boxer.cc
+++ b/net/quic/crypto/crypto_secret_boxer.cc
@@ -74,8 +74,7 @@ bool CryptoSecretBoxer::Unbox(StringPiece ciphertext,
return false;
}
- char nonce[kBoxNonceSize];
- memcpy(nonce, ciphertext.data(), kBoxNonceSize);
+ StringPiece nonce(ciphertext.data(), kBoxNonceSize);
ciphertext.remove_prefix(kBoxNonceSize);
size_t len = ciphertext.size();
@@ -87,13 +86,21 @@ bool CryptoSecretBoxer::Unbox(StringPiece ciphertext,
DLOG(DFATAL) << "CryptoSecretBoxer's decrypter->SetKey failed.";
return false;
}
- if (!decrypter->Decrypt(StringPiece(nonce, kBoxNonceSize), StringPiece(),
- ciphertext, reinterpret_cast<unsigned char*>(data),
- &len)) {
+
+ QuicPacketSequenceNumber sequence_number;
+ StringPiece nonce_prefix(nonce.data(),
+ nonce.size() - sizeof(sequence_number));
+ decrypter->SetNoncePrefix(nonce_prefix);
+ memcpy(&sequence_number, nonce.data() + nonce_prefix.size(),
+ sizeof(sequence_number));
+ scoped_ptr<QuicData> decrypted(
+ decrypter->DecryptPacket(sequence_number, StringPiece(), ciphertext));
+ if (!decrypted.get()) {
return false;
}
- out->set(data, len);
+ memcpy(data, decrypted->data(), decrypted->length());
+ out->set(data, decrypted->length());
Ryan Hamilton 2015/01/23 00:29:13 consider using out->assign(decrypted->data(), decr
ramant (doing other things) 2015/01/23 00:47:54 Used std::string's assign to copy the data in the
return true;
}
« no previous file with comments | « net/quic/crypto/chacha20_poly1305_decrypter_test.cc ('k') | net/quic/crypto/null_decrypter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698