OLD | NEW |
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_handshake_message.h" |
15 #include "net/quic/crypto/crypto_protocol.h" | 16 #include "net/quic/crypto/crypto_protocol.h" |
16 #include "net/quic/quic_protocol.h" | 17 #include "net/quic/quic_protocol.h" |
17 #include "net/quic/quic_time.h" | 18 #include "net/quic/quic_time.h" |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 | 21 |
21 class QuicTime; | 22 class QuicTime; |
22 class QuicRandom; | 23 class QuicRandom; |
23 struct QuicCryptoNegotiatedParameters; | 24 struct QuicCryptoNegotiatedParameters; |
24 | 25 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 static bool ExportKeyingMaterial(base::StringPiece subkey_secret, | 68 static bool ExportKeyingMaterial(base::StringPiece subkey_secret, |
68 base::StringPiece label, | 69 base::StringPiece label, |
69 base::StringPiece context, | 70 base::StringPiece context, |
70 size_t result_len, | 71 size_t result_len, |
71 std::string* result); | 72 std::string* result); |
72 | 73 |
73 // Computes the FNV-1a hash of the provided DER-encoded cert for use in the | 74 // Computes the FNV-1a hash of the provided DER-encoded cert for use in the |
74 // XLCT tag. | 75 // XLCT tag. |
75 static uint64 ComputeLeafCertHash(const std::string& cert); | 76 static uint64 ComputeLeafCertHash(const std::string& cert); |
76 | 77 |
| 78 // Validates that |server_hello| is actually an SHLO message and that it is |
| 79 // not part of a downgrade attack. |
| 80 // |
| 81 // Returns QUIC_NO_ERROR if this is the case or returns the appropriate error |
| 82 // code and sets |error_details|. |
| 83 static QuicErrorCode ValidateServerHello( |
| 84 const CryptoHandshakeMessage& server_hello, |
| 85 const QuicVersionVector& negotiated_versions, |
| 86 std::string* error_details); |
| 87 |
77 private: | 88 private: |
78 DISALLOW_COPY_AND_ASSIGN(CryptoUtils); | 89 DISALLOW_COPY_AND_ASSIGN(CryptoUtils); |
79 }; | 90 }; |
80 | 91 |
81 } // namespace net | 92 } // namespace net |
82 | 93 |
83 #endif // NET_QUIC_CRYPTO_CRYPTO_UTILS_H_ | 94 #endif // NET_QUIC_CRYPTO_CRYPTO_UTILS_H_ |
OLD | NEW |