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 #include "net/quic/crypto/crypto_handshake.h" | 5 #include "net/quic/crypto/crypto_handshake.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 | 785 |
786 CryptoUtils::DeriveKeys(out_params->initial_premaster_secret, | 786 CryptoUtils::DeriveKeys(out_params->initial_premaster_secret, |
787 out_params->aead, out_params->client_nonce, | 787 out_params->aead, out_params->client_nonce, |
788 out_params->server_nonce, hkdf_input, | 788 out_params->server_nonce, hkdf_input, |
789 CryptoUtils::CLIENT, &out_params->initial_crypters); | 789 CryptoUtils::CLIENT, &out_params->initial_crypters); |
790 | 790 |
791 return QUIC_NO_ERROR; | 791 return QUIC_NO_ERROR; |
792 } | 792 } |
793 | 793 |
794 QuicErrorCode QuicCryptoClientConfig::ProcessRejection( | 794 QuicErrorCode QuicCryptoClientConfig::ProcessRejection( |
795 CachedState* cached, | |
796 const CryptoHandshakeMessage& rej, | 795 const CryptoHandshakeMessage& rej, |
797 QuicWallTime now, | 796 QuicWallTime now, |
| 797 CachedState* cached, |
798 QuicCryptoNegotiatedParameters* out_params, | 798 QuicCryptoNegotiatedParameters* out_params, |
799 string* error_details) { | 799 string* error_details) { |
800 DCHECK(error_details != NULL); | 800 DCHECK(error_details != NULL); |
801 | 801 |
802 if (rej.tag() != kREJ) { | 802 if (rej.tag() != kREJ) { |
803 *error_details = "Message is not REJ"; | 803 *error_details = "Message is not REJ"; |
804 return QUIC_CRYPTO_INTERNAL_ERROR; | 804 return QUIC_CRYPTO_INTERNAL_ERROR; |
805 } | 805 } |
806 | 806 |
807 StringPiece scfg; | 807 StringPiece scfg; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; | 849 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; |
850 } | 850 } |
851 } | 851 } |
852 | 852 |
853 return QUIC_NO_ERROR; | 853 return QUIC_NO_ERROR; |
854 } | 854 } |
855 | 855 |
856 QuicErrorCode QuicCryptoClientConfig::ProcessServerHello( | 856 QuicErrorCode QuicCryptoClientConfig::ProcessServerHello( |
857 const CryptoHandshakeMessage& server_hello, | 857 const CryptoHandshakeMessage& server_hello, |
858 QuicGuid guid, | 858 QuicGuid guid, |
| 859 CachedState* cached, |
859 QuicCryptoNegotiatedParameters* out_params, | 860 QuicCryptoNegotiatedParameters* out_params, |
860 string* error_details) { | 861 string* error_details) { |
861 DCHECK(error_details != NULL); | 862 DCHECK(error_details != NULL); |
862 | 863 |
863 if (server_hello.tag() != kSHLO) { | 864 if (server_hello.tag() != kSHLO) { |
864 *error_details = "Bad tag"; | 865 *error_details = "Bad tag"; |
865 return QUIC_INVALID_CRYPTO_MESSAGE_TYPE; | 866 return QUIC_INVALID_CRYPTO_MESSAGE_TYPE; |
866 } | 867 } |
867 | 868 |
| 869 // Learn about updated source address tokens. |
| 870 StringPiece token; |
| 871 if (server_hello.GetStringPiece(kSourceAddressTokenTag, &token)) { |
| 872 cached->set_source_address_token(token); |
| 873 } |
| 874 |
868 // TODO(agl): | 875 // TODO(agl): |
869 // learn about updated SCFGs. | 876 // learn about updated SCFGs. |
870 | 877 |
871 StringPiece public_value; | 878 StringPiece public_value; |
872 if (!server_hello.GetStringPiece(kPUBS, &public_value)) { | 879 if (!server_hello.GetStringPiece(kPUBS, &public_value)) { |
873 *error_details = "server hello missing forward secure public value"; | 880 *error_details = "server hello missing forward secure public value"; |
874 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; | 881 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; |
875 } | 882 } |
876 | 883 |
877 if (!out_params->client_key_exchange->CalculateSharedKey( | 884 if (!out_params->client_key_exchange->CalculateSharedKey( |
(...skipping 26 matching lines...) Expand all Loading... |
904 | 911 |
905 ChannelIDSigner* QuicCryptoClientConfig::channel_id_signer() const { | 912 ChannelIDSigner* QuicCryptoClientConfig::channel_id_signer() const { |
906 return channel_id_signer_.get(); | 913 return channel_id_signer_.get(); |
907 } | 914 } |
908 | 915 |
909 void QuicCryptoClientConfig::SetChannelIDSigner(ChannelIDSigner* signer) { | 916 void QuicCryptoClientConfig::SetChannelIDSigner(ChannelIDSigner* signer) { |
910 channel_id_signer_.reset(signer); | 917 channel_id_signer_.reset(signer); |
911 } | 918 } |
912 | 919 |
913 } // namespace net | 920 } // namespace net |
OLD | NEW |