Commit Graph

35 Commits

Author SHA1 Message Date
dab1d2d34e Enable SNI in ssl adapter.
Bug: webrtc:6973
Change-Id: I13d28cf41c586880bd7fea523005233921794cdf
Reviewed-on: https://chromium-review.googlesource.com/523024
Reviewed-by: Zeke Chin <tkchin@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Justin Uberti <juberti@chromium.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Commit-Queue: Emad Omara <emadomara@google.com>
Cr-Commit-Position: refs/heads/master@{#18640}
2017-06-16 23:30:48 +00:00
e5dce2b6b9 Replacing unnecessary conditional with DCHECK in OpenSSLAdapter
Follow-up from https://codereview.webrtc.org/2915243002/

BUG=None
TBR=pthatcher@webrtc.org

Review-Url: https://codereview.webrtc.org/2917933003
Cr-Commit-Position: refs/heads/master@{#18418}
2017-06-02 18:52:06 +00:00
ed3b986d63 Fixing SSL error that occurs when underlying socket is blocked.
BoringSSL (or OpenSSL) require that when SSL_write fails due to the
underlying socket being blocked, it's retried with the same parameters
until it succeeds. But we weren't doing this, and our socket
abstraction doesn't have an equivalent requirement. So when this was
occurring, we would just end up trying to send the next RTP or STUN
packet (instead of the packet that couldn't be sent), and BoringSSL
doesn't like that.

So, when this condition occurs now, we'll simply enter a "pending write"
mode and buffer the data that couldn't be completely sent. When the
underlying socket becomes writable again, or if Send is called again
before that happens, we retry sending the buffered data. Making both
BoringSSL and the upper layer of code that expects normal TCP socket
behavior happy.

Also adding some more logging, and fixing an issue with VirtualSocketServer
that made it behave slightly differently than PhysicalSocketServer when a
TCP packet is only partially read.

BUG=webrtc:7753

Review-Url: https://codereview.webrtc.org/2915243002
Cr-Commit-Position: refs/heads/master@{#18416}
2017-06-02 17:33:16 +00:00
37f5ecfd8f Replace NULL with nullptr or null in webrtc/base/.
BUG=webrtc:7147

Review-Url: https://codereview.webrtc.org/2718663005
Cr-Commit-Position: refs/heads/master@{#16878}
2017-02-27 22:06:41 +00:00
21e4e0b0ab Delete webrtc/base/common.h
BUG=webrtc:6424

Review-Url: https://codereview.webrtc.org/2684613002
Cr-Commit-Position: refs/heads/master@{#16718}
2017-02-20 13:01:01 +00:00
4ef903d3db Don't use CONF_VALUE in VerifyServerName.
This does not fix the myriad of other problems here, but at least
removes the dependency on CONF_VALUE.

BUG=526270

Review-Url: https://codereview.webrtc.org/2705603003
Cr-Commit-Position: refs/heads/master@{#16676}
2017-02-17 21:04:43 +00:00
c16fa5ea69 Replace all use of the VERIFY macro.
Replaced by assigning value to a local variable, followed by a DCHECK.
Also deletes dead test code under the always false TEST_DIGEST define.

BUG=webrtc:6424

Review-Url: https://codereview.webrtc.org/2623473004
Cr-Commit-Position: refs/heads/master@{#16476}
2017-02-07 15:18:43 +00:00
7d2542623a Delete unneeded includes of base/common.h.
Bulk of the changes were done using

   git grep -l '#include "webrtc/base/common.h"' | \
     xargs sed -i '\,^#include.*webrtc/base/common\.h,d'

followed by adding back the include in the few places where it is
still needed, and in one case (pseudotcp.cc) instead deleting its use
of RTC_UNUSED.

BUG=webrtc:6424

Review-Url: https://codereview.webrtc.org/2644103002
Cr-Commit-Position: refs/heads/master@{#16263}
2017-01-25 09:47:24 +00:00
1b54a5f018 Relanding: Removing #defines previously used for building without BoringSSL/OpenSSL.
These defines don't work any more, so they only cause confusion:

FEATURE_ENABLE_SSL
HAVE_OPENSSL_SSL_H
SSL_USE_OPENSSL

BUG=webrtc:7025

Review-Url: https://codereview.webrtc.org/2640513002
Cr-Commit-Position: refs/heads/master@{#16224}
2017-01-24 03:39:57 +00:00
f33491ebaf Revert of Removing #defines previously used for building without BoringSSL/OpenSSL. (patchset #2 id:20001 of https://codereview.webrtc.org/2640513002/ )
Reason for revert:
Broke chromium build, due to a config being removed. Will add it back and remove the dependency in a chromium CL.

Original issue's description:
> Removing #defines previously used for building without BoringSSL/OpenSSL.
>
> These defines don't work any more, so they only cause confusion:
>
> FEATURE_ENABLE_SSL
> HAVE_OPENSSL_SSL_H
> SSL_USE_OPENSSL
>
> BUG=webrtc:7025
>
> Review-Url: https://codereview.webrtc.org/2640513002
> Cr-Commit-Position: refs/heads/master@{#16196}
> Committed: eaa826c2ee

TBR=kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7025

Review-Url: https://codereview.webrtc.org/2648003003
Cr-Commit-Position: refs/heads/master@{#16197}
2017-01-21 01:01:45 +00:00
eaa826c2ee Removing #defines previously used for building without BoringSSL/OpenSSL.
These defines don't work any more, so they only cause confusion:

FEATURE_ENABLE_SSL
HAVE_OPENSSL_SSL_H
SSL_USE_OPENSSL

BUG=webrtc:7025

Review-Url: https://codereview.webrtc.org/2640513002
Cr-Commit-Position: refs/heads/master@{#16196}
2017-01-20 23:15:58 +00:00
ede5da4960 Replace ASSERT by RTC_DCHECK in all non-test code.
Bulk of the changes were produced using

  git grep -l ' ASSERT(' | grep -v test | grep -v 'common\.h' |\
    xargs -n1 sed -i 's/ ASSERT(/ RTC_DCHECK(/'

followed by additional includes of base/checks.h in affected files,
and git cl format.

Also had to do some tweaks to #if !defined(NDEBUG) logic in the
taskrunner code (webrtc/base/task.cc, webrtc/base/taskparent.cc,
webrtc/base/taskparent.h, webrtc/base/taskrunner.cc), replaced to
consistently use RTC_DCHECK_IS_ON, and some of the checks needed
additional #if protection.

Test code was excluded, because it should probably use RTC_CHECK
rather than RTC_DCHECK.

BUG=webrtc:6424

Review-Url: https://codereview.webrtc.org/2620303003
Cr-Commit-Position: refs/heads/master@{#16030}
2017-01-12 13:15:36 +00:00
c309e0e3ea Don't stop sending media on EWOULDBLOCK
This change makes WebRTC no longer stop sending video when we receive an
EWOULDBLOCK error from the operating system. This was previously
causing calls on a slow link (where the first hop is slow) to rapidly
oscillate between starting and stopping video.

We still do need to stop sending packets if there is no known good
connection we can use for that. We used to generate a synthetic
EWOULDBLOCK error in that case. This CL replaces it with a different
code (ENOTCONN); EWOULDBLOCK no longer stops the stream but ENOTCONN
does.

I've updated all the places where we seemed to be generating EWOULDBLOCK
for reasons other than some buffer been full; please give it a thorough
look in case I missed something.

R=pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/2192963002 .

Cr-Commit-Position: refs/heads/master@{#13566}
2016-07-29 00:15:30 +00:00
5d97a9a05b Adding more detail to MessageQueue::Dispatch logging.
Every message will now be traced with the location from which it was
posted, including function name, file and line number.

This CL also writes a normal LOG message when the dispatch took more
than a certain amount of time (currently 50ms).

This logging should help us identify messages that are taking
longer than expected to be dispatched.

R=pthatcher@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/2019423006 .

Cr-Commit-Position: refs/heads/master@{#13104}
2016-06-10 21:17:33 +00:00
9131efdb30 Read recv timestamps from socket (posix only).
This helps a lot on Android devices where the user threads can be scheduled with low priority when the app is in the background, causing spurious significantly delayed before a packet can be read from the socket. With this patch the timestamp is taken by the kernel when the packet actually arrives.

R=juberti@chromium.org
TBR=juberti@webrtc.org

BUG=webrtc:5773

Review URL: https://codereview.webrtc.org/1944683002 .

Cr-Commit-Position: refs/heads/master@{#12850}
2016-05-23 16:19:37 +00:00
b252856d10 Remove all uses of the HAVE_CONFIG_H define.
BUG=
R=henrik.lundin@webrtc.org, pthatcher@google.com, stefan@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1820023004 .

Cr-Commit-Position: refs/heads/master@{#12141}
2016-03-29 15:47:28 +00:00
9adc91d9cc Revert of Remove code interfacing legacy openssl. (patchset #3 id:40001 of https://codereview.webrtc.org/1808763002/ )
Reason for revert:
We will make it possible to link to BoringSSL for WebRTC's usages of the crypto APIs and OpenSSL for other usages in the same binary. Once that is completed, we will reland this.

Original issue's description:
> Remove code interfacing legacy openssl.
>
> BUG=webrtc:5664
>
> Committed: https://crrev.com/4cd331beade6de16c073dcdaf89c4e038bdbf73f
> Cr-Commit-Position: refs/heads/master@{#12041}

TBR=tommi@webrtc.org,davidben@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5664

Review URL: https://codereview.webrtc.org/1828773003 .

Cr-Commit-Position: refs/heads/master@{#12117}
2016-03-24 13:05:18 +00:00
4cd331bead Remove code interfacing legacy openssl.
BUG=

Review URL: https://codereview.webrtc.org/1808763002

Cr-Commit-Position: refs/heads/master@{#12041}
2016-03-17 18:53:22 +00:00
d44c077dce Revert of Safe numeric library: base/numerics (copied from Chromium) (patchset #11 id:250001 of https://codereview.webrtc.org/1753293002/ )
Reason for revert:
Looks like the Chrome iOS build is broken because of these two changes.  So I'm going to have to revert.  Here's the error:

https://build.chromium.org/p/tryserver.chromium.mac/builders/ios_rel_device_ninja/builds/185624/steps/compile/logs/stdio

FAILED: rm -f arch/libsafe_numerics.arm64.a && ./gyp-mac-tool filter-libtool libtool  -static -o arch/libsafe_numerics.arm64.a
error: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no files specified
Usage: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
FAILED: rm -f arch/libsafe_numerics.armv7.a && ./gyp-mac-tool filter-libtool libtool  -static -o arch/libsafe_numerics.armv7.a
error: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no files specified
Usage: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
ninja: build stopped: subcommand failed.

Original issue's description:
> Safe numeric library added: base/numerics (copied from Chromium)
>
> This copies the contents (unittest excluded) of base/numerics in
> chromium to base/numerics in webrtc. Files added:
> - safe_conversions.h
> - safe_conversions_impl.h
> - safe_math.h
> - safe_math_impl.h
>
> A really old version of safe_conversions[_impl].h previously existed in
> base/, this has been deleted and sources using it have been updated
> to include the new base/numerics/safe_converions.h.
>
> This CL also adds a DEPS file to webrtc/base.
>
> NOPRESUBMIT=True
> BUG=webrtc:5548, webrtc:5623
>
> Committed: https://crrev.com/de1c81b2d2196be611674aa6019b9db3a9329042
> Cr-Commit-Position: refs/heads/master@{#11907}

TBR=kjellander@webrtc.org,kwiberg@webrtc.org,tina.legrand@webrtc.org,hbos@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5548, webrtc:5623

Review URL: https://codereview.webrtc.org/1792613002 .

Cr-Commit-Position: refs/heads/master@{#11965}
2016-03-12 01:12:40 +00:00
de1c81b2d2 Safe numeric library added: base/numerics (copied from Chromium)
This copies the contents (unittest excluded) of base/numerics in
chromium to base/numerics in webrtc. Files added:
- safe_conversions.h
- safe_conversions_impl.h
- safe_math.h
- safe_math_impl.h

A really old version of safe_conversions[_impl].h previously existed in
base/, this has been deleted and sources using it have been updated
to include the new base/numerics/safe_converions.h.

This CL also adds a DEPS file to webrtc/base.

NOPRESUBMIT=True
BUG=webrtc:5548, webrtc:5623

Review URL: https://codereview.webrtc.org/1753293002

Cr-Commit-Position: refs/heads/master@{#11907}
2016-03-08 12:46:07 +00:00
0b518bf6fc Remove incorrect cast to AsyncSocketAdapter.
socket_ in OpenSSLAdapter should be (and is in tests) an AsyncSocket but
doesn't have to be an AsyncSocketAdapter. In tests this is
rtc::VirtualSocket which is an rtc::AsyncSocket. This also matches the
BIO_new_socket type signature.

This fixes the remaining UBSan vptr bot errors.

BUG=webrtc:5124, webrtc:5226
R=tommi@webrtc.org, torbjorng@webrtc.org

Review URL: https://codereview.webrtc.org/1639883002 .

Cr-Commit-Position: refs/heads/master@{#11391}
2016-01-27 11:35:52 +00:00
5237aaf243 Convert usage of ARRAY_SIZE to arraysize.
ARRAY_SIZE is the old version of arraysize and does not cover
all the cases in C++, arraysize is a copy of Chromium's
version and thus have wider coverage.

BUG=None
R=tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1405023016

Cr-Commit-Position: refs/heads/master@{#10594}
2015-11-11 07:44:39 +00:00
a41ab9326c Switch usage of _DEBUG macro to NDEBUG.
http://stackoverflow.com/a/29253284/5237416

BUG=None
R=tommi@webrtc.org
NOPRESUBMIT=true

Review URL: https://codereview.webrtc.org/1429513004

Cr-Commit-Position: refs/heads/master@{#10468}
2015-10-30 23:08:54 +00:00
8f622a9f83 Locking is no longer required with BoringSSL.
BoringSSL handles locking internally, so the various callback methods
are no longer required in this case.

R=juberti@webrtc.org

Review URL: https://codereview.webrtc.org/1158573008

Cr-Commit-Position: refs/heads/master@{#9388}
2015-06-06 11:09:38 +00:00
36d5c3cb44 Leave BIO_METHOD non-const.
This breaks building against OpenSSL upstream, which is still supported on iOS.
This reverts part of https://webrtc-codereview.appspot.com/34649004.

BUG=none
R=juberti@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/36879004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@8132 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-01-22 23:06:17 +00:00
c10eceab6e Always tag SRTP_PROTECTION_PROFILE and BIO_METHOD as const.
The BIO_METHODs ought to be const so they can go into rodata; BoringSSL makes
BIO_new take a const BIO_METHOD *, so there's no need for it to be non-const.
Also set SRTP_PROTECTION_PROFILE as const so we can constify those within
BoringSSL (https://boringssl-review.googlesource.com/#/c/2720/)

BUG=none
R=henrike@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/34649004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@8013 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-01-07 17:59:28 +00:00
a9b1ec0247 Support for DTLS in OpenSSLAdapter
1)  Added SetMode() to SSLAdapter and OpenSSLAdapter so the mode can be set to
     SSL_MODE_DTLS
 2)  OpenSSLAdapter overrides SendTo() and RecvFrom() to handle calls from
     TurnPort via AsyncUdpSocket
 3)  OpenSSLAdapter derives from MessageHandler to implement an internal DTLS
     timer
 4)  Updated SSLAdapter unit tests

BUG=
R=juberti@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/19059004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7981 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-12-29 23:00:14 +00:00
d89b69aade Fix WebRTC Win64 + BoringSSL build.
There were many size_t to int conversions. RAND_poll and RAND_seed no longer do
anything in BoringSSL, so fix that one by removing it. Use a checked_cast for
the remaining ones.

BUG=chromium:429039
R=henrike@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/28909004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7655 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-06 17:23:09 +00:00
92a9bacf9a Rebase webrtc/base with r6682 version of talk/base:
cls ported: r6671, r6672, r6679 (reverts and unreverts in r6680, r6682).
svn diff -r 6656:6682 http://webrtc.googlecode.com/svn/trunk/talk/base >
6682.diff
sed -i.bak "s/talk_base/rtc/g" 6682.diff
sed -i.bak "s/#ifdef WIN32/#if defined(WEBRTC_WIN)/g" 6682.diff
sed -i.bak "s/#if defined(WIN32)/#if defined(WEBRTC_WIN)/g" 6682.diff
patch -p0 -i 6682.diff

BUG=3379
TBR=tommi@webrtc.org,jiayl@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/14969004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6683 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-07-14 22:03:57 +00:00
d5a0506e84 Use X509_NAME, not struct X509_name_st.
Also include openssl/x509.h explicitly since we're using functions and types
from it.

BUG=none
R=henrike@webrtc.org, wu@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/12859004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6569 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-06-30 20:38:56 +00:00
14abcc7322 libvpx's UNUSED macro conflicts with webrtc/base's. Added missing include of assert.h. Globally defined function "Unused" in talk/base and its copy (webrtc/base) is causing a conflict.
libvpx macro (UNUSED) can be found here:
http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/libvpx/source/libvpx/vpx/vpx_codec.h

BUG=N/A
R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/17489004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6185 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-05-16 16:54:44 +00:00
c50bf7cbd0 Added namespace rtc to some base classes and functions. It was causing linker error in the FYI bots: http://chromegw.corp.google.com/i/internal.chromium.webrtc.fyi/builders/Android%20Builder%20%28dbg%29/builds/1808/steps/compile/logs/stdio but also, not doing it pollutes the global namespace.
BUG=N/A
R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/19479005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6157 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-05-14 18:24:13 +00:00
f048872e91 Adds a modified copy of talk/base to webrtc/base. It is the first step in
migrating talk/base to webrtc/base.

BUG=N/A
R=niklas.enbom@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/17479005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6129 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-05-13 18:00:26 +00:00
e9a604accd Revert 6107 "Adds a modified copy of talk/base to webrtc/base. I..."
This breaks Chromium FYI builds and prevent roll of webrtc/libjingle to Chrome.

http://chromegw.corp.google.com/i/chromium.webrtc.fyi/builders/Win%20Builder/builds/457


> Adds a modified copy of talk/base to webrtc/base. It is the first step in migrating talk/base to webrtc/base.
> 
> BUG=N/A
> R=andrew@webrtc.org, wu@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/12199004

TBR=henrike@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/14479004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6116 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-05-13 08:15:48 +00:00
2c7d1b39b9 Adds a modified copy of talk/base to webrtc/base. It is the first step in migrating talk/base to webrtc/base.
BUG=N/A
R=andrew@webrtc.org, wu@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/12199004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6107 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-05-12 18:03:09 +00:00