Home | History | Annotate | Download | only in base
      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_OPENSSL
     20 
     21 #include "openssladapter.h"
     22 
     23 #endif
     24 
     25 ///////////////////////////////////////////////////////////////////////////////
     26 
     27 namespace rtc {
     28 
     29 SSLAdapter*
     30 SSLAdapter::Create(AsyncSocket* socket) {
     31 #if SSL_USE_OPENSSL
     32   return new OpenSSLAdapter(socket);
     33 #else  // !SSL_USE_OPENSSL
     34   delete socket;
     35   return NULL;
     36 #endif  // SSL_USE_OPENSSL
     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 
     55 #else  // !SSL_USE_OPENSSL
     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 
     69 #endif  // SSL_USE_OPENSSL
     70 
     71 ///////////////////////////////////////////////////////////////////////////////
     72 
     73 }  // namespace rtc
     74