Commit Graph

29 Commits

Author SHA1 Message Date
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
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
bbfed52cf2 Set OPENSSL_EC_NAMED_CURVE explicitly on EC key so that certificate has ASN1 OID and NIST curve info. Without this openSSL handshake negotiation fails throwing NO_SHARED_CIPHER error. the change made is along the lines of openssl behavior documented here: https://wiki.openssl.org/index.php/Elliptic_Curve_Diffie_Hellman#ECDH_and_Named_Curves
tested with openssl 1.0.2j

BUG=webrtc:6763

Review-Url: https://codereview.webrtc.org/2534773002
Cr-Commit-Position: refs/heads/master@{#15536}
2016-12-12 02:42:14 +00:00
6b470a9413 RTCCertificate serialization.
This CL adds the ability to convert RTCCertificate objects to and from
PEM string representations of it (its private key and certificate).
The RTCCertificate being a wrapper of SSLIdentity, this is where the
meat is.

Changes:
- SSLIdentity::PrivateKeyToPEMString() added. It together with the
  already existing SSLCertificate::ToPEMString() yields both private
  key and certificate PEM strings, both of which are required
  parameters to SSLIdentity::FromPEMStrings().
- Its only implementation, OpenSSLIdentity::PrivateKeyToPemString().
- SSLIdentity::PublicKeyToPEMString() added, used by tests.
- sslidentity_unittest.cc updated:
  * FromPEMStringsRSA and FromPEMStringsEC updated.
  * CloneIdentityRSA and CloneIdentityECDSA added.
- RTCCertificate::To/FromPem added, using new class RTCCertificatePem.
- rtccertificate_unittest.cc: New test CloneWithPemSerialization.
- Renamed rtc_unittests.cc to rtccertificate_unittest.cc to match
  convention.

BUG=webrtc:5794, chromium:581354

Review-Url: https://codereview.webrtc.org/1898383003
Cr-Commit-Position: refs/heads/master@{#12546}
2016-04-28 12:14:30 +00:00
555604a746 Replace scoped_ptr with unique_ptr in webrtc/base/
This propagated into various other places. Also had to #include headers that
were implicitly pulled by "scoped_ptr.h".

BUG=webrtc:5520

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

Cr-Commit-Position: refs/heads/master@{#12501}
2016-04-26 10:13:28 +00:00
1d846b2acb This CL addresses late feedback on https://codereview.webrtc.org/1683193003/
BUG=
R=hbos@webrtc.org, perkj@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#12179}
2016-03-31 14:21:14 +00:00
f81603549a Move to x509 v3 as required by the WebRTC draft.
BUG=webrtc:5246

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

Cr-Commit-Position: refs/heads/master@{#12139}
2016-03-29 14:57:51 +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
f5d4786080 SSLCertificate::GetChain: Return scoped_ptr
Instead of using a raw pointer output parameter. This is a good idea
in general, but will also be very convenient when scoped_ptr is gone,
since unique_ptr doesn't have an .accept() method.

BUG=webrtc:5520

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

Cr-Commit-Position: refs/heads/master@{#12004}
2016-03-15 19:53:33 +00:00
e8dc081c35 Implement certificate lifetime parameter as required by WebRTC RFC.
BUG=chromium:569005

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

Cr-Commit-Position: refs/heads/master@{#11629}
2016-02-15 17:36:01 +00:00
46c9cc0190 Provide method for returning certificate expiration time stamp.
We convert ASN1 time via std::tm to int64_t representing milliseconds-since-epoch. We do not use time_t since that cannot store milliseconds, and expires for 32-bit platforms in 2038 also for seconds.

Conversion via std::tm might might seem silly, but actually doesn't add any complexity.

One would expect tm -> seconds-since-epoch to already exist on the standard library. There is mktime, but it uses localtime (and sets an environment variable, and has the 2038 problem).

The ASN1 TIME parsing is limited to what is required by RFC 5280.

BUG=webrtc:5150
R=hbos@webrtc.org, nisse@webrtc.org, tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10854}
2015-12-01 12:06:46 +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
4e572470a3 Provide RSA2048 as per RFC
Original CL here:
https://codereview.webrtc.org/1329493005

That CL is in patch set #1 of this CL.
This CL resolves a method collision in Chrome.

BUG=webrtc:4972

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

Cr-Commit-Position: refs/heads/master@{#10222}
2015-10-08 16:43:03 +00:00
335204c550 Revert of Provide RSA2048 as per RFC (patchset #9 id:200001 of https://codereview.webrtc.org/1329493005/ )
Reason for revert:
Breaks chrome.

Original issue's description:
> provide RSA2048 as per RFC
>
> BUG=webrtc:4972
>
> Committed: https://crrev.com/0df3eb03c9a6a8299d7e18c8c314ca58c2f0681e
> Cr-Commit-Position: refs/heads/master@{#10209}

TBR=hbos@webrtc.org,juberti@google.com,jbauch@webrtc.org,henrikg@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4972

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

Cr-Commit-Position: refs/heads/master@{#10210}
2015-10-08 09:30:21 +00:00
0df3eb03c9 provide RSA2048 as per RFC
BUG=webrtc:4972

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

Cr-Commit-Position: refs/heads/master@{#10209}
2015-10-08 09:06:20 +00:00
b6d4ec4185 Support generation of EC keys using P256 curve and support ECDSA certs.
This CL started life here: https://webrtc-codereview.appspot.com/51189004

BUG=webrtc:4685, webrtc:4686
R=hbos@webrtc.org, juberti@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9718}
2015-08-17 12:09:10 +00:00
770cc380eb Don't call CRYPTO_add in BoringSSL.
The old OpenSSL threading hooks were removed in favor of the library knowing
about threads internally. Instead of CRYPTO_add, use FOO_up_ref wrappers that
don't require reaching into the type.

BUG=none
R=jiayl@webrtc.org, juberti@google.com

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

Cr-Commit-Position: refs/heads/master@{#9324}
2015-05-28 22:36:37 +00:00
1b794d56b7 Switch to use SHA-256 for certificates / fingerprints.
This CL changes identity generation to use SHA-256 for the self-signed
certificates and the fingerprints sent in the SDP.

BUG=4602
R=juberti@google.com

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

Cr-Commit-Position: refs/heads/master@{#9173}
2015-05-12 01:32:22 +00:00
01aeaee719 Fix GetSignatureDigestAlgorithm for openssl to prepare for EC key switch.
BUG=
R=davidben@chromium.org, juberti@google.com

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

Cr-Commit-Position: refs/heads/master@{#9061}
2015-04-22 19:18:16 +00:00
9478437fde rtc::Buffer improvements
1. Constructors, SetData(), and AppendData() now accept uint8_t*,
     int8_t*, and char*. Previously, they accepted void*, meaning that
     any kind of pointer was accepted. I think requiring an explicit
     cast in cases where the input array isn't already of a byte-sized
     type is a better compromise between convenience and safety.

  2. data() can now return a uint8_t* instead of a char*, which seems
     more appropriate for a byte array, and is harder to mix up with
     zero-terminated C strings. data<int8_t>() is also available so
     that callers that want that type instead won't have to cast, as
     is data<char>() (which remains the default until all existing
     callers have been fixed).

  3. Constructors, SetData(), and AppendData() now accept arrays
     natively, not just decayed to pointers. The advantage of this is
     that callers don't have to pass the size separately.

  4. There are new constructors that allow setting size and capacity
     without initializing the array. Previously, this had to be done
     separately after construction.

  5. Instead of TransferTo(), Buffer now supports swap(), and move
     construction and assignment, and has a Pass() method that works
     just like std::move(). (The Pass method is modeled after
     scoped_ptr::Pass().)

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

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

Cr-Commit-Position: refs/heads/master@{#9033}
2015-04-20 12:03:00 +00:00
67186fe00c Fix clang style warnings in webrtc/base
Mostly this consists of marking functions with override when
applicable, and moving function bodies from .h to .cc files.

Not inlining virtual functions with simple bodies such as

  { return false; }

strikes me as probably losing more in readability than we gain in
binary size and compilation time, but I guess it's just like any other
case where enabling a generally good warning forces us to write
slightly worse code in a couple of places.

BUG=163
R=kjellander@webrtc.org, tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#8656}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8656 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-09 22:24:25 +00:00
a5b7869f3d Add CHECK and friends from Chromium.
Replace FATAL_ERROR_IF with the more familiar (to Chromium developers)
CHECK and DCHECK. The full Chromium implementation is fairly elaborate
but I copied enough to get us most of the benefits. I believe the main
missing component is a more advanced stack dump. For this bit I relied
on the V8 implementation.

There are a few minor modifications from the Chromium original:
- The FatalMessage class is specialized for logging fatal error
messages and aborting. Chromium uses the general LogMessage class,
which we could consider moving towards in the future.
- NOTIMPLEMENTED() and NOTREACHED() have been removed, partly because
I don't want to rely on our logging.h until base/ and system_wrappers/
are consolidated.
- FATAL() replaces LOG(FATAL).

Minor modifications from V8's stack dump:
- If parsing of a stack trace symbol fails, just print the unparsed
symbol. (I noticed this happened on Mac.)
- Use __GLIBCXX__ and __UCLIBC__. This is from examining the backtrace
use in Chromium.

UNREACHABLE() has been removed because its behavior is different than
Chromium's NOTREACHED(), which is bound to cause confusion. The few uses
were replaced with FATAL(), matching the previous behavior.

Add a NO_RETURN macro, allowing us to remove unreachable return
statements following a CHECK/FATAL.

TESTED=the addition of dummy CHECK, DCHECK, CHECK_EQ and FATAL did the
did the right things. Stack traces work on Mac, but I don't get symbols
on Linux.

R=henrik.lundin@webrtc.org, kwiberg@webrtc.org, tommi@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7003 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-08-28 16:28:26 +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