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

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

Issue 1904213002: QUIC: support diversified keys with version 33. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hkdf
Patch Set: Rebase Created 4 years, 8 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/quic_crypto_client_config.h ('k') | net/quic/crypto/quic_crypto_client_config_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/quic_crypto_client_config.cc
diff --git a/net/quic/crypto/quic_crypto_client_config.cc b/net/quic/crypto/quic_crypto_client_config.cc
index a48560f9722d480bc9c0d244a690834822068ddb..eef60a7de1fe7272f4274ad04ad9c9b147fd3795 100644
--- a/net/quic/crypto/quic_crypto_client_config.cc
+++ b/net/quic/crypto/quic_crypto_client_config.cc
@@ -487,6 +487,7 @@ void QuicCryptoClientConfig::FillInchoateClientHello(
QuicErrorCode QuicCryptoClientConfig::FillClientHello(
const QuicServerId& server_id,
QuicConnectionId connection_id,
+ const QuicVersion actual_version,
const QuicVersion preferred_version,
const CachedState* cached,
QuicWallTime now,
@@ -653,7 +654,8 @@ QuicErrorCode QuicCryptoClientConfig::FillClientHello(
if (!CryptoUtils::DeriveKeys(
out_params->initial_premaster_secret, out_params->aead,
out_params->client_nonce, out_params->server_nonce, hkdf_input,
- Perspective::IS_CLIENT, &crypters, nullptr /* subkey secret */)) {
+ Perspective::IS_CLIENT, CryptoUtils::Diversification::Never(),
+ &crypters, nullptr /* subkey secret */)) {
*error_details = "Symmetric key setup failed";
return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED;
}
@@ -703,10 +705,17 @@ QuicErrorCode QuicCryptoClientConfig::FillClientHello(
hkdf_input.append(out_params->hkdf_input_suffix);
string* subkey_secret = &out_params->initial_subkey_secret;
+
+ // Only perform key diversification for QUIC versions 33 and later.
+ // TODO(rch): remove the |actual_version| argument to this method when
+ // QUIC_VERSION_32 is removed.
+ CryptoUtils::Diversification diversification =
+ actual_version > QUIC_VERSION_32 ? CryptoUtils::Diversification::Pending()
+ : CryptoUtils::Diversification::Never();
if (!CryptoUtils::DeriveKeys(out_params->initial_premaster_secret,
out_params->aead, out_params->client_nonce,
out_params->server_nonce, hkdf_input,
- Perspective::IS_CLIENT,
+ Perspective::IS_CLIENT, diversification,
&out_params->initial_crypters, subkey_secret)) {
*error_details = "Symmetric key setup failed";
return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED;
@@ -879,6 +888,7 @@ QuicErrorCode QuicCryptoClientConfig::ProcessServerHello(
out_params->client_nonce,
shlo_nonce.empty() ? out_params->server_nonce : shlo_nonce,
hkdf_input, Perspective::IS_CLIENT,
+ CryptoUtils::Diversification::Never(),
&out_params->forward_secure_crypters, &out_params->subkey_secret)) {
*error_details = "Symmetric key setup failed";
return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED;
« no previous file with comments | « net/quic/crypto/quic_crypto_client_config.h ('k') | net/quic/crypto/quic_crypto_client_config_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698