Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1549)

Side by Side Diff: net/quic/chromium/quic_chromium_client_session.cc

Issue 2337253004: Update Token Binding code to the latest drafts (Closed)
Patch Set: Fix compilation error in unit_tests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromium/quic_chromium_client_session.h" 5 #include "net/quic/chromium/quic_chromium_client_session.h"
6 6
7 #include <openssl/ssl.h> 7 #include <openssl/ssl.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 ssl_info->connection_status = ssl_connection_status; 577 ssl_info->connection_status = ssl_connection_status;
578 ssl_info->client_cert_sent = false; 578 ssl_info->client_cert_sent = false;
579 ssl_info->channel_id_sent = crypto_stream_->WasChannelIDSent(); 579 ssl_info->channel_id_sent = crypto_stream_->WasChannelIDSent();
580 ssl_info->security_bits = security_bits; 580 ssl_info->security_bits = security_bits;
581 ssl_info->handshake_type = SSLInfo::HANDSHAKE_FULL; 581 ssl_info->handshake_type = SSLInfo::HANDSHAKE_FULL;
582 ssl_info->pinning_failure_log = pinning_failure_log_; 582 ssl_info->pinning_failure_log = pinning_failure_log_;
583 583
584 ssl_info->UpdateCertificateTransparencyInfo(*ct_verify_result_); 584 ssl_info->UpdateCertificateTransparencyInfo(*ct_verify_result_);
585 585
586 if (crypto_stream_->crypto_negotiated_params().token_binding_key_param == 586 if (crypto_stream_->crypto_negotiated_params().token_binding_key_param ==
587 kP256) { 587 kTB10) {
588 ssl_info->token_binding_negotiated = true; 588 ssl_info->token_binding_negotiated = true;
589 ssl_info->token_binding_key_param = TB_PARAM_ECDSAP256; 589 ssl_info->token_binding_key_param = TB_PARAM_ECDSAP256;
590 } 590 }
591 591
592 return true; 592 return true;
593 } 593 }
594 594
595 Error QuicChromiumClientSession::GetTokenBindingSignature( 595 Error QuicChromiumClientSession::GetTokenBindingSignature(
596 crypto::ECPrivateKey* key, 596 crypto::ECPrivateKey* key,
597 TokenBindingType tb_type,
597 std::vector<uint8_t>* out) { 598 std::vector<uint8_t>* out) {
598 // The same key will be used across multiple requests to sign the same value, 599 // The same key will be used across multiple requests to sign the same value,
599 // so the signature is cached. 600 // so the signature is cached.
600 std::string raw_public_key; 601 std::string raw_public_key;
601 if (!key->ExportRawPublicKey(&raw_public_key)) 602 if (!key->ExportRawPublicKey(&raw_public_key))
602 return ERR_FAILED; 603 return ERR_FAILED;
603 TokenBindingSignatureMap::iterator it = 604 TokenBindingSignatureMap::iterator it =
604 token_binding_signatures_.Get(raw_public_key); 605 token_binding_signatures_.Get(std::make_pair(tb_type, raw_public_key));
605 if (it != token_binding_signatures_.end()) { 606 if (it != token_binding_signatures_.end()) {
606 *out = it->second; 607 *out = it->second;
607 return OK; 608 return OK;
608 } 609 }
609 610
610 std::string key_material; 611 std::string key_material;
611 if (!crypto_stream_->ExportTokenBindingKeyingMaterial(&key_material)) 612 if (!crypto_stream_->ExportTokenBindingKeyingMaterial(&key_material))
612 return ERR_FAILED; 613 return ERR_FAILED;
613 if (!SignTokenBindingEkm(key_material, key, out)) 614 if (!CreateTokenBindingSignature(key_material, tb_type, key, out))
614 return ERR_FAILED; 615 return ERR_FAILED;
615 token_binding_signatures_.Put(raw_public_key, *out); 616 token_binding_signatures_.Put(std::make_pair(tb_type, raw_public_key), *out);
616 return OK; 617 return OK;
617 } 618 }
618 619
619 int QuicChromiumClientSession::CryptoConnect( 620 int QuicChromiumClientSession::CryptoConnect(
620 bool require_confirmation, 621 bool require_confirmation,
621 const CompletionCallback& callback) { 622 const CompletionCallback& callback) {
622 require_confirmation_ = require_confirmation; 623 require_confirmation_ = require_confirmation;
623 handshake_start_ = base::TimeTicks::Now(); 624 handshake_start_ = base::TimeTicks::Now();
624 RecordHandshakeState(STATE_STARTED); 625 RecordHandshakeState(STATE_STARTED);
625 DCHECK(flow_controller()); 626 DCHECK(flow_controller());
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 } 1375 }
1375 1376
1376 void QuicChromiumClientSession::DeletePromised( 1377 void QuicChromiumClientSession::DeletePromised(
1377 QuicClientPromisedInfo* promised) { 1378 QuicClientPromisedInfo* promised) {
1378 if (IsOpenStream(promised->id())) 1379 if (IsOpenStream(promised->id()))
1379 streams_pushed_and_claimed_count_++; 1380 streams_pushed_and_claimed_count_++;
1380 QuicClientSessionBase::DeletePromised(promised); 1381 QuicClientSessionBase::DeletePromised(promised);
1381 } 1382 }
1382 1383
1383 } // namespace net 1384 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698