henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
torbjorng | 07d0936 | 2015-09-22 11:58:04 -0700 | [diff] [blame^] | 27 | #endif // SSL_USE_OPENSSL && !SSL_USE_SCHANNEL |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 28 | |
| 29 | /////////////////////////////////////////////////////////////////////////////// |
| 30 | |
| 31 | namespace rtc { |
| 32 | |
| 33 | SSLAdapter* |
| 34 | SSLAdapter::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 | |
| 49 | bool InitializeSSL(VerificationCallback callback) { |
| 50 | return OpenSSLAdapter::InitializeSSL(callback); |
| 51 | } |
| 52 | |
| 53 | bool InitializeSSLThread() { |
| 54 | return OpenSSLAdapter::InitializeSSLThread(); |
| 55 | } |
| 56 | |
| 57 | bool CleanupSSL() { |
| 58 | return OpenSSLAdapter::CleanupSSL(); |
| 59 | } |
| 60 | |
torbjorng | 07d0936 | 2015-09-22 11:58:04 -0700 | [diff] [blame^] | 61 | #else // !SSL_USE_OPENSSL |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 62 | |
| 63 | bool InitializeSSL(VerificationCallback callback) { |
| 64 | return true; |
| 65 | } |
| 66 | |
| 67 | bool InitializeSSLThread() { |
| 68 | return true; |
| 69 | } |
| 70 | |
| 71 | bool CleanupSSL() { |
| 72 | return true; |
| 73 | } |
| 74 | |
torbjorng | 07d0936 | 2015-09-22 11:58:04 -0700 | [diff] [blame^] | 75 | #endif // !SSL_USE_OPENSSL |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 76 | |
| 77 | /////////////////////////////////////////////////////////////////////////////// |
| 78 | |
| 79 | } // namespace rtc |