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

Side by Side Diff: net/quic/crypto/crypto_utils.h

Issue 1009543004: Create a Perspective enum to use instead of a bool is_server to improve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added NET_EXPORT_PRIVATE to fix compiler error Created 5 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/congestion_control/tcp_cubic_sender_test.cc ('k') | net/quic/crypto/crypto_utils.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 // Some helpers for quic crypto 5 // Some helpers for quic crypto
6 6
7 #ifndef NET_QUIC_CRYPTO_CRYPTO_UTILS_H_ 7 #ifndef NET_QUIC_CRYPTO_CRYPTO_UTILS_H_
8 #define NET_QUIC_CRYPTO_CRYPTO_UTILS_H_ 8 #define NET_QUIC_CRYPTO_CRYPTO_UTILS_H_
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
13 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
14 #include "net/quic/crypto/crypto_handshake.h" 14 #include "net/quic/crypto/crypto_handshake.h"
15 #include "net/quic/crypto/crypto_protocol.h" 15 #include "net/quic/crypto/crypto_protocol.h"
16 #include "net/quic/quic_protocol.h" 16 #include "net/quic/quic_protocol.h"
17 #include "net/quic/quic_time.h" 17 #include "net/quic/quic_time.h"
18 18
19 namespace net { 19 namespace net {
20 20
21 class QuicTime; 21 class QuicTime;
22 class QuicRandom; 22 class QuicRandom;
23 struct QuicCryptoNegotiatedParameters; 23 struct QuicCryptoNegotiatedParameters;
24 24
25 class NET_EXPORT_PRIVATE CryptoUtils { 25 class NET_EXPORT_PRIVATE CryptoUtils {
26 public: 26 public:
27 enum Perspective {
28 SERVER,
29 CLIENT,
30 };
31
32 // Generates the connection nonce. The nonce is formed as: 27 // Generates the connection nonce. The nonce is formed as:
33 // <4 bytes> current time 28 // <4 bytes> current time
34 // <8 bytes> |orbit| (or random if |orbit| is empty) 29 // <8 bytes> |orbit| (or random if |orbit| is empty)
35 // <20 bytes> random 30 // <20 bytes> random
36 static void GenerateNonce(QuicWallTime now, 31 static void GenerateNonce(QuicWallTime now,
37 QuicRandom* random_generator, 32 QuicRandom* random_generator,
38 base::StringPiece orbit, 33 base::StringPiece orbit,
39 std::string* nonce); 34 std::string* nonce);
40 35
41 // Returns true if the sni is valid, false otherwise. 36 // Returns true if the sni is valid, false otherwise.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 size_t result_len, 70 size_t result_len,
76 std::string* result); 71 std::string* result);
77 72
78 private: 73 private:
79 DISALLOW_COPY_AND_ASSIGN(CryptoUtils); 74 DISALLOW_COPY_AND_ASSIGN(CryptoUtils);
80 }; 75 };
81 76
82 } // namespace net 77 } // namespace net
83 78
84 #endif // NET_QUIC_CRYPTO_CRYPTO_UTILS_H_ 79 #endif // NET_QUIC_CRYPTO_CRYPTO_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender_test.cc ('k') | net/quic/crypto/crypto_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698