| 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 <stddef.h> |
| 11 #include <stdint.h> |
| 12 |
| 10 #include <string> | 13 #include <string> |
| 11 | 14 |
| 15 #include "base/macros.h" |
| 12 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
| 13 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
| 14 #include "net/quic/crypto/crypto_handshake.h" | 18 #include "net/quic/crypto/crypto_handshake.h" |
| 15 #include "net/quic/crypto/crypto_handshake_message.h" | 19 #include "net/quic/crypto/crypto_handshake_message.h" |
| 16 #include "net/quic/crypto/crypto_protocol.h" | 20 #include "net/quic/crypto/crypto_protocol.h" |
| 17 #include "net/quic/quic_protocol.h" | 21 #include "net/quic/quic_protocol.h" |
| 18 #include "net/quic/quic_time.h" | 22 #include "net/quic/quic_time.h" |
| 19 | 23 |
| 20 namespace net { | 24 namespace net { |
| 21 | 25 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // parameters are invalid (e.g. |label| contains null bytes); returns true on | 70 // parameters are invalid (e.g. |label| contains null bytes); returns true on |
| 67 // success. | 71 // success. |
| 68 static bool ExportKeyingMaterial(base::StringPiece subkey_secret, | 72 static bool ExportKeyingMaterial(base::StringPiece subkey_secret, |
| 69 base::StringPiece label, | 73 base::StringPiece label, |
| 70 base::StringPiece context, | 74 base::StringPiece context, |
| 71 size_t result_len, | 75 size_t result_len, |
| 72 std::string* result); | 76 std::string* result); |
| 73 | 77 |
| 74 // Computes the FNV-1a hash of the provided DER-encoded cert for use in the | 78 // Computes the FNV-1a hash of the provided DER-encoded cert for use in the |
| 75 // XLCT tag. | 79 // XLCT tag. |
| 76 static uint64 ComputeLeafCertHash(const std::string& cert); | 80 static uint64_t ComputeLeafCertHash(const std::string& cert); |
| 77 | 81 |
| 78 // Validates that |server_hello| is actually an SHLO message and that it is | 82 // Validates that |server_hello| is actually an SHLO message and that it is |
| 79 // not part of a downgrade attack. | 83 // not part of a downgrade attack. |
| 80 // | 84 // |
| 81 // Returns QUIC_NO_ERROR if this is the case or returns the appropriate error | 85 // Returns QUIC_NO_ERROR if this is the case or returns the appropriate error |
| 82 // code and sets |error_details|. | 86 // code and sets |error_details|. |
| 83 static QuicErrorCode ValidateServerHello( | 87 static QuicErrorCode ValidateServerHello( |
| 84 const CryptoHandshakeMessage& server_hello, | 88 const CryptoHandshakeMessage& server_hello, |
| 85 const QuicVersionVector& negotiated_versions, | 89 const QuicVersionVector& negotiated_versions, |
| 86 std::string* error_details); | 90 std::string* error_details); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 101 static const char* HandshakeFailureReasonToString( | 105 static const char* HandshakeFailureReasonToString( |
| 102 HandshakeFailureReason reason); | 106 HandshakeFailureReason reason); |
| 103 | 107 |
| 104 private: | 108 private: |
| 105 DISALLOW_COPY_AND_ASSIGN(CryptoUtils); | 109 DISALLOW_COPY_AND_ASSIGN(CryptoUtils); |
| 106 }; | 110 }; |
| 107 | 111 |
| 108 } // namespace net | 112 } // namespace net |
| 109 | 113 |
| 110 #endif // NET_QUIC_CRYPTO_CRYPTO_UTILS_H_ | 114 #endif // NET_QUIC_CRYPTO_CRYPTO_UTILS_H_ |
| OLD | NEW |