Chromium Code Reviews| 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> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 // Returns |hostname|. NormalizeHostname() doesn't support IP address | 48 // Returns |hostname|. NormalizeHostname() doesn't support IP address |
| 49 // literals. IsValidSNI() should be called before calling NormalizeHostname(). | 49 // literals. IsValidSNI() should be called before calling NormalizeHostname(). |
| 50 static std::string NormalizeHostname(const char* hostname); | 50 static std::string NormalizeHostname(const char* hostname); |
| 51 | 51 |
| 52 // DeriveKeys populates |out->encrypter| and |out->decrypter| given the | 52 // DeriveKeys populates |out->encrypter| and |out->decrypter| given the |
| 53 // contents of |premaster_secret|, |client_nonce|, |server_nonce| and | 53 // contents of |premaster_secret|, |client_nonce|, |server_nonce| and |
| 54 // |hkdf_input|. |aead| determines which cipher will be used. |perspective| | 54 // |hkdf_input|. |aead| determines which cipher will be used. |perspective| |
| 55 // controls whether the server's keys are assigned to |encrypter| or | 55 // controls whether the server's keys are assigned to |encrypter| or |
| 56 // |decrypter|. |server_nonce| is optional and, if non-empty, is mixed into | 56 // |decrypter|. |server_nonce| is optional and, if non-empty, is mixed into |
| 57 // the key derivation. | 57 // the key derivation. |
| 58 static void DeriveKeys(base::StringPiece premaster_secret, | 58 static bool DeriveKeys(base::StringPiece premaster_secret, |
|
wtc
2013/10/09 23:01:28
Nit: document the return value.
| |
| 59 QuicTag aead, | 59 QuicTag aead, |
| 60 base::StringPiece client_nonce, | 60 base::StringPiece client_nonce, |
| 61 base::StringPiece server_nonce, | 61 base::StringPiece server_nonce, |
| 62 const std::string& hkdf_input, | 62 const std::string& hkdf_input, |
| 63 Perspective perspective, | 63 Perspective perspective, |
| 64 CrypterPair* out); | 64 CrypterPair* out); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace net | 67 } // namespace net |
| 68 | 68 |
| 69 #endif // NET_QUIC_CRYPTO_CRYPTO_UTILS_H_ | 69 #endif // NET_QUIC_CRYPTO_CRYPTO_UTILS_H_ |
| OLD | NEW |