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

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

Issue 1459783002: Roll src/third_party/boringssl/src d7421ebf6..3ac32b1ed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build, estark comments Created 5 years, 1 month 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 | « crypto/curve25519_unittest.cc ('k') | third_party/boringssl/BUILD.gn » ('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/curve25519_key_exchange.h" 5 #include "net/quic/crypto/curve25519_key_exchange.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "crypto/curve25519.h" 9 #include "crypto/curve25519.h"
10 #include "net/quic/crypto/quic_random.h" 10 #include "net/quic/crypto/quic_random.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 bool Curve25519KeyExchange::CalculateSharedKey( 62 bool Curve25519KeyExchange::CalculateSharedKey(
63 const StringPiece& peer_public_value, 63 const StringPiece& peer_public_value,
64 string* out_result) const { 64 string* out_result) const {
65 if (peer_public_value.size() != crypto::curve25519::kBytes) { 65 if (peer_public_value.size() != crypto::curve25519::kBytes) {
66 return false; 66 return false;
67 } 67 }
68 68
69 uint8 result[crypto::curve25519::kBytes]; 69 uint8 result[crypto::curve25519::kBytes];
70 crypto::curve25519::ScalarMult( 70 if (!crypto::curve25519::ScalarMult(
71 private_key_, 71 private_key_,
72 reinterpret_cast<const uint8*>(peer_public_value.data()), 72 reinterpret_cast<const uint8*>(peer_public_value.data()), result)) {
73 result); 73 return false;
74 }
74 out_result->assign(reinterpret_cast<char*>(result), sizeof(result)); 75 out_result->assign(reinterpret_cast<char*>(result), sizeof(result));
75 76
76 return true; 77 return true;
77 } 78 }
78 79
79 StringPiece Curve25519KeyExchange::public_value() const { 80 StringPiece Curve25519KeyExchange::public_value() const {
80 return StringPiece(reinterpret_cast<const char*>(public_key_), 81 return StringPiece(reinterpret_cast<const char*>(public_key_),
81 sizeof(public_key_)); 82 sizeof(public_key_));
82 } 83 }
83 84
84 QuicTag Curve25519KeyExchange::tag() const { return kC255; } 85 QuicTag Curve25519KeyExchange::tag() const { return kC255; }
85 86
86 } // namespace net 87 } // namespace net
OLDNEW
« no previous file with comments | « crypto/curve25519_unittest.cc ('k') | third_party/boringssl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698