OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 753 matching lines...) Loading... |
764 | 764 |
765 ssl_ = SSL_new(ssl_ctx_); | 765 ssl_ = SSL_new(ssl_ctx_); |
766 if (!ssl_) { | 766 if (!ssl_) { |
767 BIO_free(bio); | 767 BIO_free(bio); |
768 return -1; | 768 return -1; |
769 } | 769 } |
770 | 770 |
771 SSL_set_app_data(ssl_, this); | 771 SSL_set_app_data(ssl_, this); |
772 | 772 |
773 SSL_set_bio(ssl_, bio, bio); // the SSL object owns the bio now. | 773 SSL_set_bio(ssl_, bio, bio); // the SSL object owns the bio now. |
| 774 #ifndef OPENSSL_IS_BORINGSSL |
774 if (ssl_mode_ == SSL_MODE_DTLS) { | 775 if (ssl_mode_ == SSL_MODE_DTLS) { |
775 #ifdef OPENSSL_IS_BORINGSSL | |
776 // Change the initial retransmission timer from 1 second to 50ms. | |
777 // This will likely result in some spurious retransmissions, but | |
778 // it's useful for ensuring a timely handshake when there's packet | |
779 // loss. | |
780 DTLSv1_set_initial_timeout_duration(ssl_, 50); | |
781 #else | |
782 // Enable read-ahead for DTLS so whole packets are read from internal BIO | 776 // Enable read-ahead for DTLS so whole packets are read from internal BIO |
783 // before parsing. This is done internally by BoringSSL for DTLS. | 777 // before parsing. This is done internally by BoringSSL for DTLS. |
784 SSL_set_read_ahead(ssl_, 1); | 778 SSL_set_read_ahead(ssl_, 1); |
| 779 } |
785 #endif | 780 #endif |
786 } | |
787 | 781 |
788 SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE | | 782 SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE | |
789 SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); | 783 SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); |
790 | 784 |
791 #if !defined(OPENSSL_IS_BORINGSSL) | 785 #if !defined(OPENSSL_IS_BORINGSSL) |
792 // Specify an ECDH group for ECDHE ciphers, otherwise OpenSSL cannot | 786 // Specify an ECDH group for ECDHE ciphers, otherwise OpenSSL cannot |
793 // negotiate them when acting as the server. Use NIST's P-256 which is | 787 // negotiate them when acting as the server. Use NIST's P-256 which is |
794 // commonly supported. BoringSSL doesn't need explicit configuration and has | 788 // commonly supported. BoringSSL doesn't need explicit configuration and has |
795 // a reasonable default set. | 789 // a reasonable default set. |
796 EC_KEY* ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); | 790 EC_KEY* ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); |
(...skipping 402 matching lines...) Loading... |
1199 return true; | 1193 return true; |
1200 } | 1194 } |
1201 } | 1195 } |
1202 | 1196 |
1203 return false; | 1197 return false; |
1204 } | 1198 } |
1205 | 1199 |
1206 } // namespace rtc | 1200 } // namespace rtc |
1207 | 1201 |
1208 #endif // HAVE_OPENSSL_SSL_H | 1202 #endif // HAVE_OPENSSL_SSL_H |
OLD | NEW |