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

Side by Side Diff: net/quic/crypto/p256_key_exchange_nss.cc

Issue 1787453002: Switch "const StringPiece&" to just "StringPiece" in QUIC code. No functional change. Not flag prot… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@116566297
Patch Set: Remove const StringPiece& from _nss crypto files. Created 4 years, 9 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/crypto/p256_key_exchange.h ('k') | net/quic/crypto/p256_key_exchange_openssl.cc » ('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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/crypto/p256_key_exchange.h" 5 #include "net/quic/crypto/p256_key_exchange.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/numerics/safe_conversions.h" 8 #include "base/numerics/safe_conversions.h"
9 #include "base/sys_byteorder.h" 9 #include "base/sys_byteorder.h"
10 10
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 return string(&result[0], result_size); 147 return string(&result[0], result_size);
148 } 148 }
149 149
150 KeyExchange* P256KeyExchange::NewKeyPair(QuicRandom* /*rand*/) const { 150 KeyExchange* P256KeyExchange::NewKeyPair(QuicRandom* /*rand*/) const {
151 // TODO(agl): avoid the serialisation/deserialisation in this function. 151 // TODO(agl): avoid the serialisation/deserialisation in this function.
152 const string private_value = NewPrivateKey(); 152 const string private_value = NewPrivateKey();
153 return P256KeyExchange::New(private_value); 153 return P256KeyExchange::New(private_value);
154 } 154 }
155 155
156 bool P256KeyExchange::CalculateSharedKey(const StringPiece& peer_public_value, 156 bool P256KeyExchange::CalculateSharedKey(StringPiece peer_public_value,
157 string* out_result) const { 157 string* out_result) const {
158 if (peer_public_value.size() != kUncompressedP256PointBytes || 158 if (peer_public_value.size() != kUncompressedP256PointBytes ||
159 peer_public_value[0] != kUncompressedECPointForm) { 159 peer_public_value[0] != kUncompressedECPointForm) {
160 DVLOG(1) << "Peer public value is invalid."; 160 DVLOG(1) << "Peer public value is invalid.";
161 return false; 161 return false;
162 } 162 }
163 163
164 DCHECK(key_pair_.get()); 164 DCHECK(key_pair_.get());
165 DCHECK(key_pair_->public_key()); 165 DCHECK(key_pair_->public_key());
166 166
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 StringPiece P256KeyExchange::public_value() const { 215 StringPiece P256KeyExchange::public_value() const {
216 return StringPiece(reinterpret_cast<const char*>(public_key_), 216 return StringPiece(reinterpret_cast<const char*>(public_key_),
217 sizeof(public_key_)); 217 sizeof(public_key_));
218 } 218 }
219 219
220 QuicTag P256KeyExchange::tag() const { 220 QuicTag P256KeyExchange::tag() const {
221 return kP256; 221 return kP256;
222 } 222 }
223 223
224 } // namespace net 224 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/p256_key_exchange.h ('k') | net/quic/crypto/p256_key_exchange_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698