Browse Source

Add tqca-tls plugin to the tqca package.

Signed-off-by: gregory guy <gregory-tde@laposte.net>
Signed-off-by: Slavek Banko <slavek.banko@axis.cz>
pull/3/head
gregory guy 2 years ago
parent
commit
99ec4964d0
No known key found for this signature in database
GPG Key ID: 2CC84A1CC6823AF8
  1. 10
      CMakeLists.txt
  2. 45
      ConfigureChecks.cmake
  3. 27
      src/tls/CMakeLists.txt
  4. 1514
      src/tls/tqca-tls.cpp
  5. 35
      src/tls/tqca-tls.h

10
CMakeLists.txt

@ -50,6 +50,13 @@ option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
##### user requested modules
option( BUILD_ALL "Build all" ON )
option( BUILD_TQCA "Build tqca shared lib" ${BUILD_ALL} )
option( BUILD_TQCA_TLS "Build tqca-tls plugin" ${BUILD_ALL} )
##### configure checks
include( ConfigureChecks.cmake )
@ -66,7 +73,8 @@ set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined"
##### source directories
add_subdirectory( src )
tde_conditional_add_subdirectory( BUILD_TQCA src )
tde_conditional_add_subdirectory( BUILD_TQCA_TLS src/tls )
##### write configure files

45
ConfigureChecks.cmake

@ -23,6 +23,7 @@ if( WITH_GCC_VISIBILITY )
endif( WITH_GCC_VISIBILITY )
if( BUILD_TQCA )
##### look for tqt3 headers path
execute_process(
@ -31,3 +32,47 @@ execute_process(
OUTPUT_VARIABLE TQT_HEADERS_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif( BUILD_TQCA )
if( BUILD_TQCA_TLS )
##### check for openssl
pkg_search_module( SSL openssl )
if( NOT SSL_FOUND )
check_include_file( openssl/ssl.h HAVE_OPENSSL_H )
check_library_exists( ssl OPENSSL_init_ssl "" HAVE_LIBSSL_11 )
check_library_exists( crypto EVP_EncryptInit_ex "" HAVE_LIBCRYPTO )
if( NOT HAVE_LIBSSL_11 )
check_library_exists( ssl SSL_library_init "" HAVE_LIBSSL )
endif()
if( HAVE_OPENSSL_H AND HAVE_LIBCRYPTO AND (HAVE_LIBSSL_11 OR HAVE_LIBSSL) )
set( SSL_FOUND 1 CACHE INTERNAL "" FORCE )
find_file( OPENSSLV_H openssl/opensslv.h )
file( STRINGS "${OPENSSLV_H}" SSL_VERSION REGEX "#[ \t]*define[ \t]*OPENSSL_VERSION_TEXT" )
string( REGEX REPLACE "# *define[ \t]*OPENSSL_VERSION_TEXT[ \t]*\"[^0-9 ]* *([^ ]*).*" "\\1" SSL_VERSION "${SSL_VERSION}" )
set( SSL_VERSION "${SSL_VERSION}" CACHE INTERNAL "" FORCE )
set( SSL_LIBRARIES "ssl;crypto" CACHE INTERNAL "ssl and crypto libs" FORCE )
endif()
endif( NOT SSL_FOUND )
if( NOT SSL_FOUND )
tde_message_fatal( "OpenSSL is required but was not found on your system" )
endif()
##### look for tqt3 plugins path
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE}
--variable=pluginsdir tqt-mt
OUTPUT_VARIABLE TQT_PLUGINS_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if( TQT_PLUGINS_DIR )
set( TQT_PLUGINS_CRYPTO_DIR "${TQT_PLUGINS_DIR}/crypto" )
endif()
endif( BUILD_TQCA_TLS )

27
src/tls/CMakeLists.txt

@ -0,0 +1,27 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}
${TQT_INCLUDE_DIRS}
)
link_directories(
${TQT_LIBRARY_DIRS}
)
add_definitions( -DTQCA_PLUGIN )
##### tqca-tls (shared)
tde_add_library( tqca-tls SHARED NO_LIBTOOL_FILE AUTOMOC
SOURCES
tqca-tls.cpp
LINK
${TQT_LIBRARIES}
${SSL_LIBRARIES}
DESTINATION ${TQT_PLUGINS_CRYPTO_DIR}
)

1514
src/tls/tqca-tls.cpp

File diff suppressed because it is too large Load Diff

35
src/tls/tqca-tls.h

@ -0,0 +1,35 @@
/*
* qca-tls.h - TLS plugin for TQCA
* Copyright (C) 2003 Justin Karneges
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef TQCA_TLS_H
#define TQCA_TLS_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "../tqcaprovider.h"
#ifdef TQCA_PLUGIN
TQCA_PLUGIN_EXPORT TQCAProvider *createProvider();
#else
TQCAProvider *createProviderTLS();
#endif
#endif
Loading…
Cancel
Save