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 | |
torbjorng | 172f009 | 2015-10-07 04:57:55 -0700 | [diff] [blame] | 19 | #if SSL_USE_OPENSSL |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 20 | |
| 21 | #include "openssladapter.h" |
| 22 | |
torbjorng | 172f009 | 2015-10-07 04:57:55 -0700 | [diff] [blame] | 23 | #endif |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 24 | |
| 25 | /////////////////////////////////////////////////////////////////////////////// |
| 26 | |
| 27 | namespace rtc { |
| 28 | |
| 29 | SSLAdapter* |
| 30 | SSLAdapter::Create(AsyncSocket* socket) { |
torbjorng | 172f009 | 2015-10-07 04:57:55 -0700 | [diff] [blame] | 31 | #if SSL_USE_OPENSSL |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 32 | return new OpenSSLAdapter(socket); |
torbjorng | 172f009 | 2015-10-07 04:57:55 -0700 | [diff] [blame] | 33 | #else // !SSL_USE_OPENSSL |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 34 | delete socket; |
| 35 | return NULL; |
torbjorng | 172f009 | 2015-10-07 04:57:55 -0700 | [diff] [blame] | 36 | #endif // SSL_USE_OPENSSL |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | /////////////////////////////////////////////////////////////////////////////// |
| 40 | |
| 41 | #if SSL_USE_OPENSSL |
| 42 | |
| 43 | bool InitializeSSL(VerificationCallback callback) { |
| 44 | return OpenSSLAdapter::InitializeSSL(callback); |
| 45 | } |
| 46 | |
| 47 | bool InitializeSSLThread() { |
| 48 | return OpenSSLAdapter::InitializeSSLThread(); |
| 49 | } |
| 50 | |
| 51 | bool CleanupSSL() { |
| 52 | return OpenSSLAdapter::CleanupSSL(); |
| 53 | } |
| 54 | |
torbjorng | 07d0936 | 2015-09-22 11:58:04 -0700 | [diff] [blame] | 55 | #else // !SSL_USE_OPENSSL |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 56 | |
| 57 | bool InitializeSSL(VerificationCallback callback) { |
| 58 | return true; |
| 59 | } |
| 60 | |
| 61 | bool InitializeSSLThread() { |
| 62 | return true; |
| 63 | } |
| 64 | |
| 65 | bool CleanupSSL() { |
| 66 | return true; |
| 67 | } |
| 68 | |
torbjorng | 172f009 | 2015-10-07 04:57:55 -0700 | [diff] [blame] | 69 | #endif // SSL_USE_OPENSSL |
henrike@webrtc.org | f048872 | 2014-05-13 18:00:26 +0000 | [diff] [blame] | 70 | |
| 71 | /////////////////////////////////////////////////////////////////////////////// |
| 72 | |
| 73 | } // namespace rtc |