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

Side by Side Diff: net/quic/core/crypto/quic_crypto_server_config.cc

Issue 2340583002: Make DiversificationNonce a std::array (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « net/quic/core/crypto/null_decrypter.cc ('k') | net/quic/core/crypto/quic_decrypter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/core/crypto/quic_crypto_server_config.h" 5 #include "net/quic/core/crypto/quic_crypto_server_config.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 string hkdf_input; 788 string hkdf_input;
789 size_t label_len = strlen(QuicCryptoConfig::kInitialLabel) + 1; 789 size_t label_len = strlen(QuicCryptoConfig::kInitialLabel) + 1;
790 hkdf_input.reserve(label_len + hkdf_suffix.size()); 790 hkdf_input.reserve(label_len + hkdf_suffix.size());
791 hkdf_input.append(QuicCryptoConfig::kInitialLabel, label_len); 791 hkdf_input.append(QuicCryptoConfig::kInitialLabel, label_len);
792 hkdf_input.append(hkdf_suffix); 792 hkdf_input.append(hkdf_suffix);
793 793
794 string* subkey_secret = &params->initial_subkey_secret; 794 string* subkey_secret = &params->initial_subkey_secret;
795 CryptoUtils::Diversification diversification = 795 CryptoUtils::Diversification diversification =
796 CryptoUtils::Diversification::Never(); 796 CryptoUtils::Diversification::Never();
797 if (version > QUIC_VERSION_32) { 797 if (version > QUIC_VERSION_32) {
798 rand->RandBytes(reinterpret_cast<char*>(out_diversification_nonce), 798 rand->RandBytes(out_diversification_nonce->data(),
799 sizeof(*out_diversification_nonce)); 799 out_diversification_nonce->size());
800 diversification = 800 diversification =
801 CryptoUtils::Diversification::Now(out_diversification_nonce); 801 CryptoUtils::Diversification::Now(out_diversification_nonce);
802 } 802 }
803 803
804 if (!CryptoUtils::DeriveKeys(params->initial_premaster_secret, params->aead, 804 if (!CryptoUtils::DeriveKeys(params->initial_premaster_secret, params->aead,
805 info.client_nonce, info.server_nonce, hkdf_input, 805 info.client_nonce, info.server_nonce, hkdf_input,
806 Perspective::IS_SERVER, diversification, 806 Perspective::IS_SERVER, diversification,
807 &params->initial_crypters, subkey_secret)) { 807 &params->initial_crypters, subkey_secret)) {
808 *error_details = "Symmetric key setup failed"; 808 *error_details = "Symmetric key setup failed";
809 return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED; 809 return QUIC_CRYPTO_SYMMETRIC_KEY_SETUP_FAILED;
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 priority(0), 2068 priority(0),
2069 source_address_token_boxer(nullptr) {} 2069 source_address_token_boxer(nullptr) {}
2070 2070
2071 QuicCryptoServerConfig::Config::~Config() { 2071 QuicCryptoServerConfig::Config::~Config() {
2072 base::STLDeleteElements(&key_exchanges); 2072 base::STLDeleteElements(&key_exchanges);
2073 } 2073 }
2074 2074
2075 QuicCryptoProof::QuicCryptoProof() {} 2075 QuicCryptoProof::QuicCryptoProof() {}
2076 QuicCryptoProof::~QuicCryptoProof() {} 2076 QuicCryptoProof::~QuicCryptoProof() {}
2077 } // namespace net 2077 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/crypto/null_decrypter.cc ('k') | net/quic/core/crypto/quic_decrypter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698