mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 06:40:43 +01:00

This extends the API surface so that custom certificates can be provided by an API user in both the standalone and factory creation paths for the OpenSSLAdapter. Prior to this change the SSL roots were hardcoded in a header file and directly included into openssladapter.cc. This forces the 100 kilobytes of certificates to always be compiled into the library. This is undesirable in certain linking cases where these certificates can be shared from another binary that already has an equivalent set of trusted roots hard coded into the binary. Support for removing the hard coded SSL roots has also been added through a new build flag. By default the hard coded SSL roots will be included and will be used if no other trusted root certificates are provided. The main goal of this CL is to reduce total binary size requirements of WebRTC by about 100kb in certain applications where adding these certificates is redundant. Change-Id: Ifd36d92b5cb32d1b3098a61ddfc244d76df8f30f Bug: chromium:526260 Change-Id: Ifd36d92b5cb32d1b3098a61ddfc244d76df8f30f Reviewed-on: https://webrtc-review.googlesource.com/64841 Commit-Queue: Benjamin Wright <benwright@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23180}
41 lines
1.5 KiB
C++
41 lines
1.5 KiB
C++
/*
|
|
* Copyright 2018 The WebRTC Project Authors. All rights reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef RTC_BASE_OPENSSLUTILITY_H_
|
|
#define RTC_BASE_OPENSSLUTILITY_H_
|
|
|
|
#include <openssl/ossl_typ.h>
|
|
#include <string>
|
|
#include "rtc_base/sslcertificate.h"
|
|
|
|
namespace rtc {
|
|
// The openssl namespace holds static helper methods. All methods related
|
|
// to OpenSSL that are commonly used and don't require global state should be
|
|
// placed here.
|
|
namespace openssl {
|
|
// Verifies that the hostname provided matches that in the peer certificate
|
|
// attached to this SSL state.
|
|
bool VerifyPeerCertMatchesHost(SSL* ssl, const std::string& host);
|
|
|
|
// Logs all the errors in the OpenSSL errror queue from the current thread. A
|
|
// prefix can be provided for context.
|
|
void LogSSLErrors(const std::string& prefix);
|
|
|
|
#ifndef WEBRTC_DISABLE_BUILT_IN_SSL_ROOT_CERTIFICATES
|
|
// Attempt to add the certificates from the loader into the SSL_CTX. False is
|
|
// returned only if there are no certificates returned from the loader or none
|
|
// of them can be added to the TrustStore for the provided context.
|
|
bool LoadBuiltinSSLRootCertificates(SSL_CTX* ssl_ctx);
|
|
#endif // WEBRTC_DISABLE_BUILT_IN_SSL_ROOT_CERTIFICATES
|
|
|
|
} // namespace openssl
|
|
} // namespace rtc
|
|
|
|
#endif // RTC_BASE_OPENSSLUTILITY_H_
|