blob: 77ad90b504154b6ae62772abd713323b4b19104a [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#if HAVE_CONFIG_H
12#include "config.h"
13#endif // HAVE_CONFIG_H
14
15#include "webrtc/base/ssladapter.h"
16
17#include "webrtc/base/sslconfig.h"
18
19#if SSL_USE_SCHANNEL
20
21#include "schanneladapter.h"
22
23#elif SSL_USE_OPENSSL // && !SSL_USE_SCHANNEL
24
25#include "openssladapter.h"
26
torbjorng07d09362015-09-22 11:58:04 -070027#endif // SSL_USE_OPENSSL && !SSL_USE_SCHANNEL
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000028
29///////////////////////////////////////////////////////////////////////////////
30
31namespace rtc {
32
33SSLAdapter*
34SSLAdapter::Create(AsyncSocket* socket) {
35#if SSL_USE_SCHANNEL
36 return new SChannelAdapter(socket);
37#elif SSL_USE_OPENSSL // && !SSL_USE_SCHANNEL
38 return new OpenSSLAdapter(socket);
39#else // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL
40 delete socket;
41 return NULL;
42#endif // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL
43}
44
45///////////////////////////////////////////////////////////////////////////////
46
47#if SSL_USE_OPENSSL
48
49bool InitializeSSL(VerificationCallback callback) {
50 return OpenSSLAdapter::InitializeSSL(callback);
51}
52
53bool InitializeSSLThread() {
54 return OpenSSLAdapter::InitializeSSLThread();
55}
56
57bool CleanupSSL() {
58 return OpenSSLAdapter::CleanupSSL();
59}
60
torbjorng07d09362015-09-22 11:58:04 -070061#else // !SSL_USE_OPENSSL
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000062
63bool InitializeSSL(VerificationCallback callback) {
64 return true;
65}
66
67bool InitializeSSLThread() {
68 return true;
69}
70
71bool CleanupSSL() {
72 return true;
73}
74
torbjorng07d09362015-09-22 11:58:04 -070075#endif // !SSL_USE_OPENSSL
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000076
77///////////////////////////////////////////////////////////////////////////////
78
79} // namespace rtc