OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/core/crypto/quic_crypto_client_config.h" | 5 #include "net/quic/core/crypto/quic_crypto_client_config.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; | 527 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; |
528 } | 528 } |
529 | 529 |
530 // AEAD: the work loads on the client and server are symmetric. Since the | 530 // AEAD: the work loads on the client and server are symmetric. Since the |
531 // client is more likely to be CPU-constrained, break the tie by favoring | 531 // client is more likely to be CPU-constrained, break the tie by favoring |
532 // the client's preference. | 532 // the client's preference. |
533 // Key exchange: the client does more work than the server, so favor the | 533 // Key exchange: the client does more work than the server, so favor the |
534 // client's preference. | 534 // client's preference. |
535 size_t key_exchange_index; | 535 size_t key_exchange_index; |
536 if (!QuicUtils::FindMutualTag(aead, their_aeads, num_their_aeads, | 536 if (!QuicUtils::FindMutualTag(aead, their_aeads, num_their_aeads, |
537 QuicUtils::LOCAL_PRIORITY, &out_params->aead, | 537 &out_params->aead, nullptr) || |
538 nullptr) || | |
539 !QuicUtils::FindMutualTag( | 538 !QuicUtils::FindMutualTag( |
540 kexs, their_key_exchanges, num_their_key_exchanges, | 539 kexs, their_key_exchanges, num_their_key_exchanges, |
541 QuicUtils::LOCAL_PRIORITY, &out_params->key_exchange, | 540 &out_params->key_exchange, &key_exchange_index)) { |
542 &key_exchange_index)) { | |
543 *error_details = "Unsupported AEAD or KEXS"; | 541 *error_details = "Unsupported AEAD or KEXS"; |
544 return QUIC_CRYPTO_NO_SUPPORT; | 542 return QUIC_CRYPTO_NO_SUPPORT; |
545 } | 543 } |
546 out->SetVector(kAEAD, QuicTagVector{out_params->aead}); | 544 out->SetVector(kAEAD, QuicTagVector{out_params->aead}); |
547 out->SetVector(kKEXS, QuicTagVector{out_params->key_exchange}); | 545 out->SetVector(kKEXS, QuicTagVector{out_params->key_exchange}); |
548 | 546 |
549 if (!tb_key_params.empty() && | 547 if (!tb_key_params.empty() && |
550 server_id.privacy_mode() == PRIVACY_MODE_DISABLED) { | 548 server_id.privacy_mode() == PRIVACY_MODE_DISABLED) { |
551 const QuicTag* their_tbkps; | 549 const QuicTag* their_tbkps; |
552 size_t num_their_tbkps; | 550 size_t num_their_tbkps; |
553 switch (scfg->GetTaglist(kTBKP, &their_tbkps, &num_their_tbkps)) { | 551 switch (scfg->GetTaglist(kTBKP, &their_tbkps, &num_their_tbkps)) { |
554 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND: | 552 case QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND: |
555 break; | 553 break; |
556 case QUIC_NO_ERROR: | 554 case QUIC_NO_ERROR: |
557 if (QuicUtils::FindMutualTag(tb_key_params, their_tbkps, | 555 if (QuicUtils::FindMutualTag( |
558 num_their_tbkps, QuicUtils::LOCAL_PRIORITY, | 556 tb_key_params, their_tbkps, num_their_tbkps, |
559 &out_params->token_binding_key_param, | 557 &out_params->token_binding_key_param, nullptr)) { |
560 nullptr)) { | |
561 out->SetVector(kTBKP, | 558 out->SetVector(kTBKP, |
562 QuicTagVector{out_params->token_binding_key_param}); | 559 QuicTagVector{out_params->token_binding_key_param}); |
563 } | 560 } |
564 break; | 561 break; |
565 default: | 562 default: |
566 *error_details = "Invalid TBKP"; | 563 *error_details = "Invalid TBKP"; |
567 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; | 564 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; |
568 } | 565 } |
569 } | 566 } |
570 | 567 |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 } | 982 } |
986 | 983 |
987 // Update canonical version to point at the "most recent" entry. | 984 // Update canonical version to point at the "most recent" entry. |
988 canonical_server_map_[suffix_server_id] = server_id; | 985 canonical_server_map_[suffix_server_id] = server_id; |
989 | 986 |
990 server_state->InitializeFrom(*canonical_state); | 987 server_state->InitializeFrom(*canonical_state); |
991 return true; | 988 return true; |
992 } | 989 } |
993 | 990 |
994 } // namespace net | 991 } // namespace net |
OLD | NEW |