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