İşlemeleri karşılaştır

...

32 İşleme

Yazar SHA1 Mesaj Tarih
TDE Gitea 4712cafaf0 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
3 yıl önce
Slávek Banko fea3060f63
Update version number to R14.0.11.
3 yıl önce
TDE Gitea 194ba0d908 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
3 yıl önce
TDE Gitea 5341978a7f Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
3 yıl önce
TDE Gitea e52047e397 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
3 yıl önce
Slávek Banko b952583f7e
Raise the minimum required version of CMake to 2.8.12.
3 yıl önce
TDE Gitea 01ce35092b Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
3 yıl önce
TDE Gitea dd2c70ed57 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
3 yıl önce
gregory guy 6fdf132b37
Drop tqmake build support.
3 yıl önce
Slávek Banko 1fd0ee8538
Update version number to R14.0.10.
4 yıl önce
TDE Gitea cd48b66518 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea 0dd5eaad95 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea 00e73227a6 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea 1a1eb95681 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea 2fb765bc32 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea e73123c3cb Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea 19f8f0b734 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea 59ded955be Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea d6295d721b Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea bbd3d66e01 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea de08e8a2d9 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea d627b4e800 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
TDE Gitea f4e78ffea6 Reset submodule main/dependencies/tqca-tls/cmake to latest HEAD
4 yıl önce
Slávek Banko 4784056101
Add common cmake submodule.
4 yıl önce
Slávek Banko 95b018a8a6
Rename the tqca-tls files in the original QMake project
4 yıl önce
Slávek Banko da0049a4b9
Allow openssl detection without pkg-config file.
4 yıl önce
Slávek Banko 6601055e9e
Move the OpenSSL 0.97 test inside the source code
4 yıl önce
gregory guy c0c3393c7b
Conversion to the cmake building system.
4 yıl önce
Matías Fonzo 41462673ad
Added LibreSSL detection
4 yıl önce
Chris 1bc63c30d2
Replace Qt branding with TQt ones.
5 yıl önce
OBATA Akio 29511f81db
Fix portability for expr(1) usage
5 yıl önce
Michele Calgaro da4ed25676 Add support for OpenSSL 1.1
7 yıl önce

3
.gitmodules sağlanmış

@ -0,0 +1,3 @@
[submodule "cmake"]
path = cmake
url = https://system@scm.trinitydesktop.org/scm/git/tde-common-cmake

@ -0,0 +1,96 @@
############################################
# #
# Improvements and feedbacks are welcome #
# #
# This file is released under GPL >= 3 #
# #
############################################
cmake_minimum_required( VERSION 2.8.12 )
#### general package setup
project( tqca-tls )
set( VERSION R14.0.11 )
#### include essential cmake modules
include( FindPkgConfig )
include( CheckFunctionExists )
include( CheckSymbolExists )
include( CheckIncludeFile )
include( CheckLibraryExists )
include( CheckCSourceCompiles )
include( CheckCXXSourceCompiles )
#### include our cmake modules
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )
##### setup install paths
include( TDESetupPaths )
tde_setup_paths( )
##### optional stuff
option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
##### configure checks
include( ConfigureChecks.cmake )
###### global compiler settings
add_definitions( -DHAVE_CONFIG_H -DTQCA_PLUGIN )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )
##### write configure files
configure_file( config.h.cmake config.h @ONLY )
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${TQT_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
)
link_directories(
${TQT_LIBRARY_DIRS}
)
##### tqca-tls (shared)
tde_add_library( ${PROJECT_NAME} SHARED NO_LIBTOOL_FILE AUTOMOC
SOURCES
tqca-tls.cpp
LINK
${TQT_LIBRARIES}
${OPENSSL_LIBRARIES}
DESTINATION ${TQT_PLUGINS_CRYPTO_DIR}
)
##### write configure files
configure_file( config.h.cmake config.h @ONLY )

@ -0,0 +1,73 @@
###########################################
# #
# Improvements and feedback are welcome #
# #
# This file is released under GPL >= 3 #
# #
###########################################
# required stuff
find_package( TQt )
tde_setup_architecture_flags( )
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
tde_setup_largefiles( )
##### check for gcc visibility support
if( WITH_GCC_VISIBILITY )
tde_setup_gcc_visibility( )
endif( WITH_GCC_VISIBILITY )
##### check for openssl
find_package( OpenSSL )
if( NOT SSL_FOUND )
check_include_file( openssl/ssl.h HAVE_OPENSSL_H )
check_library_exists( ssl OPENSSL_init_ssl "" HAVE_LIBSSL_11 )
if( NOT HAVE_LIBSSL_11 )
check_library_exists( ssl SSL_library_init "" HAVE_LIBSSL )
endif( )
check_library_exists( crypto EVP_EncryptInit_ex "" HAVE_LIBCRYPTO )
if( HAVE_OPENSSL_H AND (HAVE_LIBSSL_11 OR HAVEL_LIBSSL) AND HAVE_LIBCRYPTO )
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 )
message( STATUS "Found OpenSSL: version ${SSL_VERSION}" )
endif( HAVE_OPENSSL_H AND (HAVE_LIBSSL_11 OR HAVEL_LIBSSL) AND HAVE_LIBCRYPTO )
endif( NOT SSL_FOUND )
if( NOT OPENSSL_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()
###### check for tqca
pkg_search_module( TQCA tqca )
if( TQCA_FOUND )
set( HAVE_TQCA 1 )
else()
message( STATUS " tqca was not found, built-in copy will be used" )
endif( )

@ -0,0 +1,29 @@
Basic Installation
==================
tqca-tls relies on cmake to build.
Here are suggested default options:
-DCMAKE_EXPORT_COMPILE_COMMANDS="ON" \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCONFIG_INSTALL_DIR="/etc/trinity" \
-DSYSCONF_INSTALL_DIR="/etc/trinity" \
-DXDG_MENU_INSTALL_DIR="/etc/xdg/menus" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_VERBOSE_MAKEFILE="ON" \
-DCMAKE_SKIP_RPATH="OFF" \
-DWITH_ALL_OPTIONS="ON"
Requirements:
=============
- OpenSSL
Optional:
=========
- tqca

@ -1,16 +1,19 @@
TQCA TLS Plugin v1.0
-------------------
Author: Justin Karneges <justin@affinix.com>
Date: September 15th, 2003
This is a plugin to provide SSL/TLS capability to programs that
utilize the TQt Cryptographic Architecture (TQCA).
tqca-tls - TQCA TLS Plugin
Requirements:
OpenSSL Library (http://www.openssl.org/)
Installation procedure:
./configure
make
su -c "make install"
tqca-tls is a plugin to provide SSL/TLS capability to programs that
use the TQt Cryptographic Architecture (TQCA).
CONTRIBUTING
==============
If you wish to contribute to tqca-tls, you might do so:
- TDE Gitea Workspace (TGW) collaboration tool.
https://mirror.git.trinitydesktop.org/gitea
- TDE Weblate Translation Workspace (TWTW) collaboration tool.
https://mirror.git.trinitydesktop.org/weblate

@ -0,0 +1 @@
Subproject commit bfa3a90b73588be47dc3f4d373ff63ce17dfb6ab

@ -0,0 +1,11 @@
#define VERSION "@VERSION@"
// Defined if you have fvisibility and fvisibility-inlines-hidden support.
#cmakedefine __KDE_HAVE_GCC_VISIBILITY 1
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
/* Defined if you have the tqca library */
#cmakedefine HAVE_TQCA 1

598
configure sağlanmış

@ -1,598 +0,0 @@
#!/bin/sh
show_usage() {
cat <<EOT
Usage: ./configure [OPTION]...
This script creates necessary configuration files to build/install.
Main options:
--qtdir=[path] Directory where Qt is installed.
--help This help text.
Dependency options:
--with-openssl-inc=[path] Path to OpenSSL include files
--with-openssl-lib=[path] Path to OpenSSL library files
EOT
}
while [ $# -gt 0 ]; do
case "$1" in
--qtdir=*)
QTDIR=`expr "${1}" : "--qtdir=\(.*\)"`
shift
;;
--with-openssl-inc=*)
QC_WITH_OPENSSL_INC=`expr "${1}" : "--with-openssl-inc=\(.*\)"`
shift
;;
--with-openssl-lib=*)
QC_WITH_OPENSSL_LIB=`expr "${1}" : "--with-openssl-lib=\(.*\)"`
shift
;;
--debug)
QC_DEBUG="Y"
shift
;;
--help) show_usage; exit ;;
*) show_usage; exit ;;
esac
done
echo "Configuring tqca-tls ..."
if [ "$QC_DEBUG" = "Y" ]; then
echo
echo QTDIR=$QTDIR
echo QC_WITH_OPENSSL_INC=$QC_WITH_OPENSSL_INC
echo QC_WITH_OPENSSL_LIB=$QC_WITH_OPENSSL_LIB
echo
fi
printf "Verifying TQt 3.x Multithreaded (MT) build environment ... "
if [ -z "$QTDIR" ]; then
if [ "$QC_DEBUG" = "Y" ]; then
echo \$QTDIR not set... trying to find Qt manually
fi
for p in /usr/lib/tqt /usr/share/tqt /usr/share/tqt3 /usr/local/lib/tqt /usr/local/share/tqt /usr/lib/tqt3 /usr/local/lib/tqt3 /usr/lib/qt /usr/share/qt /usr/share/qt3 /usr/local/lib/qt /usr/local/share/qt /usr/lib/qt3 /usr/local/lib/qt3 /usr/lib64/tqt /usr/local/lib64/tqt /usr/lib64/tqt3 /usr/local/lib64/tqt3 /usr/lib64/qt /usr/local/lib64/qt /usr/lib64/qt3 /usr/local/lib64/qt3 /usr/X11R6/share/qt /usr/qt/3 ; do
if [ -d "$p/mkspecs" ]; then
QTDIR=$p
break;
fi;
done
if [ -z "$QTDIR" ]; then
echo fail
echo
echo Unable to find Qt 'mkspecs'. Please set QTDIR
echo manually. Perhaps you need to install Qt 3
echo development utilities. You may download them either
echo from the vendor of your operating system or from
echo www.trolltech.com
echo
exit 1;
fi
fi
if [ ! -x "$QTDIR/bin/tqmake" ]; then
if [ "$QC_DEBUG" = "Y" ]; then
echo Warning: tqmake not in \$QTDIR/bin/tqmake
echo trying to find it in \$PATH
fi
qm=`type -p tqmake`
if [ -x "$qm" ]; then
if [ "$QC_DEBUG" = "Y" ]; then
echo tqmake found in $qm
fi
else
echo fail
echo
echo Sorry, you seem to have a very unusual setup,
echo or I missdetected \$QTDIR=$QTDIR
echo
echo Please set \$QTDIR manually and make sure that
echo \$QTDIR/bin/tqmake exists.
echo
exit 1;
fi
else
qm=$QTDIR/bin/tqmake
fi
gen_files() {
cat >$1/modules.cpp <<EOT
/*
-----BEGIN QCMOD-----
name: OpenSSL
arg: with-openssl-inc=[path],Path to OpenSSL include files
arg: with-openssl-lib=[path],Path to OpenSSL library files
-----END QCMOD-----
*/
class qc_openssl : public ConfObj
{
public:
qc_openssl(Conf *c) : ConfObj(c) {}
TQString name() const { return "OpenSSL"; }
TQString shortname() const { return "openssl"; }
bool exec()
{
TQString inc, lib;
TQString s;
bool kb = false;
TQString kbdir = "/usr/kerberos/include";
// Redhat 9?
if(TQFileInfo(kbdir).exists())
kb = true;
s = conf->getenv("QC_WITH_OPENSSL_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "openssl/ssl.h"))
return false;
inc = s;
}
else {
if(!conf->findHeader("openssl/ssl.h", TQStringList(), &s))
return false;
inc = s;
}
s = conf->getenv("QC_WITH_OPENSSL_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "ssl"))
return false;
lib = s;
}
else {
if(!conf->findLibrary("ssl", &s))
return false;
lib = s;
}
// is it at least openssl 0.9.7?
TQString str =
"#include<openssl/opensslv.h>\n"
"int main()\n"
"{\n"
" unsigned long x = OPENSSL_VERSION_NUMBER;\n"
" if(x >= 0x00907000) return 0; else return 1;\n"
"}\n";
TQString ext;
if(!inc.isEmpty())
ext += TQString("-I") + inc + ' ';
if(kb)
ext += TQString("-I") + kbdir + ' ';
if(!lib.isEmpty())
ext += TQString("-L") + lib + " -lssl -lcrypto ";
int ret;
if(!conf->doCompileAndLink(str, ext, &ret))
return false;
if(ret == 0)
conf->addDefine("OSSL_097");
if(!inc.isEmpty())
conf->addIncludePath(inc);
if(kb)
conf->addIncludePath(kbdir);
if(!lib.isEmpty())
conf->addLib(TQString("-L") + s);
conf->addLib("-lssl -lcrypto");
// Make sure tqtinterface can be found
conf->addIncludePath("/usr/include/tqt");
return true;
}
};
EOT
cat >$1/modules_new.cpp <<EOT
o = new qc_openssl(conf);
o->required = true;
o->disabled = false;
EOT
cat >$1/conf.cpp <<EOT
#include<stdio.h>
#include<stdlib.h>
#include<tqstring.h>
#include<tqdict.h>
#include<tqptrlist.h>
#include<tqfileinfo.h>
#include<tqfile.h>
#include<tqdir.h>
#include<tqstringlist.h>
class Conf;
class ConfObj
{
public:
ConfObj(Conf *c);
virtual ~ConfObj();
virtual TQString name() const=0;
virtual TQString shortname() const=0;
virtual bool exec()=0;
Conf *conf;
bool required;
bool disabled;
};
typedef TQPtrList<ConfObj> ConfObjList;
typedef TQPtrListIterator<ConfObj> ConfObjListIt;
class Conf
{
public:
Conf() : vars(17)
{
list.setAutoDelete(true);
vars.setAutoDelete(true);
vars.insert("QMAKE_INCDIR_X11", new TQString(X11_INC));
vars.insert("QMAKE_LIBDIR_X11", new TQString(X11_LIBDIR));
vars.insert("QMAKE_LIBS_X11", new TQString(X11_LIB));
vars.insert("QMAKE_CC", new TQString(CC));
}
~Conf()
{
}
void added(ConfObj *o)
{
list.append(o);
}
TQString getenv(const TQString &var)
{
char *p = ::getenv(var.latin1());
if(!p)
return TQString::null;
return TQString(p);
}
bool exec()
{
ConfObjListIt it(list);
for(ConfObj *o; (o = it.current()); ++it) {
// if this was a disabled-by-default option, check if it was enabled
if(o->disabled) {
TQString v = TQString("QC_ENABLE_") + o->shortname();
if(getenv(v) != "Y")
continue;
}
// and the opposite?
else {
TQString v = TQString("QC_DISABLE_") + o->shortname();
if(getenv(v) == "Y")
continue;
}
printf("Checking for %s ...", o->name().latin1());
fflush(stdout);
bool ok = o->exec();
if(ok)
printf(" yes\n");
else
printf(" no\n");
if(!ok && o->required) {
printf("\nError: need %s!\n", o->name().latin1());
return false;
}
}
return true;
}
const TQString & qvar(const TQString &s)
{
TQString *p = vars.find(s);
if(p)
return *p;
else
return blank;
}
TQString expandIncludes(const TQString &inc)
{
return TQString("-I") + inc;
}
TQString expandLibs(const TQString &lib)
{
return TQString("-L") + lib;
}
int doCommand(const TQString &s)
{
//printf("[%s]\n", s.latin1());
int r = system((s + " 1>/dev/null 2>/dev/null").latin1());
//printf("returned: %d\n", r);
return r;
}
bool doCompileAndLink(const TQString &filedata, const TQString &flags, int *retcode=0)
{
TQDir dir(".");
TQString fname = "atest.c";
TQString out = "atest";
TQFile f(fname);
TQCString cs = filedata.latin1();
if(!f.open(IO_WriteOnly | IO_Truncate))
return false;
f.writeBlock(cs.data(), cs.length());
f.close();
TQString str = qvar("QMAKE_CC") + ' ' + fname + " -o " + out + ' ' + flags;
int r = doCommand(str);
if(r == 0 && retcode)
*retcode = doCommand(TQString("./") + out);
dir.remove(fname);
dir.remove(out);
if(r != 0)
return false;
return true;
}
bool checkHeader(const TQString &path, const TQString &h)
{
TQFileInfo fi(path + '/' + h);
if(fi.exists())
return true;
return false;
}
bool findHeader(const TQString &h, const TQStringList &ext, TQString *inc)
{
if(checkHeader("/usr/include", h)) {
*inc = "";
return true;
}
TQStringList dirs;
dirs += "/usr/local/include";
dirs += ext;
for(TQStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) {
if(checkHeader(*it, h)) {
*inc = *it;
return true;
}
}
return false;
}
bool checkLibrary(const TQString &path, const TQString &name)
{
TQString str =
"int main()\n"
"{\n"
" return 0;\n"
"}\n";
TQString extra;
if(!path.isEmpty())
extra += TQString("-L") + path + ' ';
extra += TQString("-l") + name;
if(!doCompileAndLink(str, extra))
return false;
return true;
}
bool findLibrary(const TQString &name, TQString *lib)
{
if(checkLibrary("", name)) {
*lib = "";
return true;
}
if(checkLibrary("/usr/local/lib", name)) {
*lib = "/usr/local/lib";
return true;
}
if(checkLibrary("/usr/local/lib64", name)) {
*lib = "/usr/local/lib64";
return true;
}
return false;
}
void addDefine(const TQString &str)
{
if(DEFINES.isEmpty())
DEFINES = str;
else
DEFINES += TQString(" ") + str;
}
void addLib(const TQString &str)
{
if(LIBS.isEmpty())
LIBS = str;
else
LIBS += TQString(" ") + str;
}
void addIncludePath(const TQString &str)
{
if(INCLUDEPATH.isEmpty())
INCLUDEPATH = str;
else
INCLUDEPATH += TQString(" ") + str;
}
void addExtra(const TQString &str)
{
extra += str + '\n';
}
TQString DEFINES;
TQString INCLUDEPATH;
TQString LIBS;
TQString extra;
private:
ConfObjList list;
TQDict<TQString> vars;
TQString blank;
};
ConfObj::ConfObj(Conf *c)
{
conf = c;
conf->added(this);
required = false;
disabled = false;
}
ConfObj::~ConfObj()
{
}
#include"modules.cpp"
//----------------------------------------------------------------------------
// main
//----------------------------------------------------------------------------
int main()
{
Conf *conf = new Conf;
ConfObj *o;
o = 0;
#include"modules_new.cpp"
printf("ok\n");
bool success = false;
if(conf->exec()) {
TQFile f("conf.pri");
if(!f.open(IO_WriteOnly | IO_Truncate)) {
printf("Error writing %s\n", f.name().latin1());
return 1;
}
TQString str;
str += "# qconf\n";
str += "QT_PATH_PLUGINS = " + TQString(tqInstallPathPlugins()) + '\n';
if(!conf->DEFINES.isEmpty())
str += "DEFINES += " + conf->DEFINES + '\n';
if(!conf->INCLUDEPATH.isEmpty())
str += "INCLUDEPATH += " + conf->INCLUDEPATH + '\n';
if(!conf->LIBS.isEmpty())
str += "LIBS += " + conf->LIBS + '\n';
if(!conf->extra.isEmpty())
str += conf->extra;
str += '\n';
char *p = getenv("BINDIR");
if(p) {
str += TQString("target.path = ") + p + '\n';
str += "INSTALLS += target\n";
}
TQCString cs = str.latin1();
f.writeBlock(cs.data(), cs.length());
f.close();
success = true;
}
delete conf;
if(success)
return 0;
else
return 1;
}
EOT
cat >$1/conf.pro <<EOT
TEMPLATE = app
CONFIG += qt x11 thread console
TARGET = conf
INCLUDEPATH += '/usr/include/tqt'
DEFINES += X11_INC='"\$\$QMAKE_INCDIR_X11"'
DEFINES += X11_LIBDIR='"\$\$QMAKE_LIBDIR_X11"'
DEFINES += X11_LIB='"\$\$QMAKE_LIBS_X11"'
DEFINES += CC='"\$\$QMAKE_CC"'
SOURCES += conf.cpp
EOT
}
export QTDIR
export QC_WITH_OPENSSL_INC
export QC_WITH_OPENSSL_LIB
rm -rf .qconftemp
(
mkdir .qconftemp
gen_files .qconftemp
cd .qconftemp
$qm conf.pro >/dev/null
QTDIR=$QTDIR make clean >/dev/null 2>&1
QTDIR=$QTDIR make >../conf.log 2>&1
)
if [ "$?" != "0" ]; then
rm -rf .qconftemp
echo fail
echo
echo "There was an error compiling 'conf'. Be sure you have a proper"
echo "TQt 3.x Multithreaded (MT) build environment set up."
if [ ! -f "$QTDIR/lib/libtqt-mt.so.3" ]; then
if [ ! -f "$QTDIR/lib64/libtqt-mt.so.3" ]; then
echo
echo "One possible reason is that you don't have"
echo "libtqt-mt.so.3 installed in $QTDIR/lib/"
echo "or $QTDIR/lib64/."
fi
fi
echo
exit 1;
fi
.qconftemp/conf
ret="$?"
if [ "$ret" = "1" ]; then
rm -rf .qconftemp
echo
exit 1;
else
if [ "$ret" != "0" ]; then
rm -rf .qconftemp
echo fail
echo
echo Unexpected error launching 'conf'
echo
exit 1;
fi
fi
rm -rf .qconftemp
if [ -x "./qcextra" ]; then
./qcextra
fi
# run tqmake
if expr match "$DEB_BUILD_OPTIONS" ".*nostrip"; then
$qm QMAKE_STRIP=true qca-tls.pro
else
$qm qca-tls.pro
fi
if [ "$?" != "0" ]; then
echo
exit 1;
fi
cat >Makefile.tmp <<EOT
export QTDIR = $QTDIR
EOT
cat Makefile >> Makefile.tmp
rm -f Makefile
cp -f Makefile.tmp Makefile
rm -f Makefile.tmp
echo
echo Good, your configure finished. Now run \'make\'.
echo

@ -1,80 +0,0 @@
/*
-----BEGIN QCMOD-----
name: OpenSSL
arg: with-openssl-inc=[path],Path to OpenSSL include files
arg: with-openssl-lib=[path],Path to OpenSSL library files
-----END QCMOD-----
*/
class qc_openssl : public ConfObj
{
public:
qc_openssl(Conf *c) : ConfObj(c) {}
QString name() const { return "OpenSSL"; }
QString shortname() const { return "openssl"; }
bool exec()
{
QString inc, lib;
QString s;
bool kb = false;
QString kbdir = "/usr/kerberos/include";
// Redhat 9?
if(QFileInfo(kbdir).exists())
kb = true;
s = conf->getenv("QC_WITH_OPENSSL_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "openssl/ssl.h"))
return false;
inc = s;
}
else {
if(!conf->findHeader("openssl/ssl.h", QStringList(), &s))
return false;
inc = s;
}
s = conf->getenv("QC_WITH_OPENSSL_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "ssl"))
return false;
lib = s;
}
else {
if(!conf->findLibrary("ssl", &s))
return false;
lib = s;
}
// is it at least openssl 0.9.7?
QString str =
"#include<openssl/opensslv.h>\n"
"int main()\n"
"{\n"
" unsigned long x = OPENSSL_VERSION_NUMBER;\n"
" if(x >= 0x00907000) return 0; else return 1;\n"
"}\n";
QString ext;
if(!inc.isEmpty())
ext += QString("-I") + inc + ' ';
if(kb)
ext += QString("-I") + kbdir + ' ';
if(!lib.isEmpty())
ext += QString("-L") + lib + " -lssl -lcrypto ";
int ret;
if(!conf->doCompileAndLink(str, ext, &ret))
return false;
if(ret == 0)
conf->addDefine("OSSL_097");
if(!inc.isEmpty())
conf->addIncludePath(inc);
if(kb)
conf->addIncludePath(kbdir);
if(!lib.isEmpty())
conf->addLib(QString("-L") + s);
conf->addLib("-lssl -lcrypto");
return true;
}
};

@ -1,5 +0,0 @@
#!/bin/sh
cp ../../src/qca.h .
cp ../../src/qcaprovider.h .

@ -1,26 +0,0 @@
# tqca-tls qmake profile
TEMPLATE = lib
CONFIG += qt thread release plugin
TARGET = tqca-tls
!exists(qcaprovider.h) {
Q_PREFIX = ../../src
INCLUDEPATH += $$Q_PREFIX
}
HEADERS += ($$Q_PREFIX)qcaprovider.h
HEADERS = qca-tls.h
SOURCES = qca-tls.cpp
DEFINES += TQCA_PLUGIN
win32:{
DEFINES += TQCA_PLUGIN_DLL OSSL_097
INCLUDEPATH += c:\local\include
LIBS += c:\local\lib\libeay32.lib c:\local\lib\ssleay32.lib
}
include(conf.pri)
include(extra.pri)
QMAKE_PROJECT_DEPTH=0

@ -1,9 +0,0 @@
<qconf>
<name>tqca-tls</name>
<profile>qca-tls.pro</profile>
<noprefix/>
<dep type='openssl'>
<required/>
</dep>
<moddir>.</moddir>
</qconf>

@ -26,7 +26,16 @@
#include<tqdatetime.h>
#include<tqobject.h>
#include<tqhostaddress.h>
#include"qca.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_TQCA
#include <tqca.h>
#else
#include "qca.h"
#endif
#define TQCA_PLUGIN_VERSION 1

@ -1,9 +0,0 @@
#!/bin/sh
cat >extra.pri <<EOT
target.path=\$\$QT_PATH_PLUGINS/crypto
INSTALLS += target
INSTALL_ROOT = $PREFIX
EOT

@ -18,21 +18,25 @@
*
*/
#include"qca-tls.h"
#include<tqregexp.h>
#include<openssl/sha.h>
#include<openssl/md5.h>
#include<openssl/evp.h>
#include<openssl/bio.h>
#include<openssl/pem.h>
#include<openssl/rsa.h>
#include<openssl/x509.h>
#include<openssl/x509v3.h>
#include<openssl/ssl.h>
#include<openssl/err.h>
#include<openssl/rand.h>
#include "tqca-tls.h"
#include <tqregexp.h>
#include <openssl/sha.h>
#include <openssl/md5.h>
#include <openssl/evp.h>
#include <openssl/bio.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#if OPENSSL_VERSION_NUMBER >= 0x00907000
#define OSSL_097
#endif
#ifndef OSSL_097
#define NO_AES
@ -57,18 +61,28 @@ static bool lib_generateKeyIV(const EVP_CIPHER *_type, const TQByteArray &data,
TQByteArray k, i;
unsigned char *kp = 0;
unsigned char *ip = 0;
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
EVP_CIPHER type = *_type;
EVP_CIPHER *loctype = &type;
if(keysize != -1)
type.key_len = keysize;
#else
EVP_CIPHER *loctype = EVP_CIPHER_meth_dup(_type);
Q_UNUSED(keysize)
#endif
if(key) {
k.resize(type.key_len);
k.resize(EVP_CIPHER_key_length(loctype));
kp = (unsigned char *)k.data();
}
if(iv) {
i.resize(type.iv_len);
i.resize(EVP_CIPHER_iv_length(loctype));
ip = (unsigned char *)i.data();
}
if(!EVP_BytesToKey(&type, EVP_sha1(), (unsigned char *)salt.data(), (unsigned char *)data.data(), data.size(), 1, kp, ip))
int res = EVP_BytesToKey(loctype, EVP_sha1(), (unsigned char *)salt.data(), (unsigned char *)data.data(), data.size(), 1, kp, ip);
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
EVP_CIPHER_meth_free(loctype);
#endif
if (!res)
return false;
if(key)
*key = k;
@ -177,7 +191,12 @@ public:
virtual ~EVPCipherContext()
{
if(type) {
EVP_CIPHER_CTX_cleanup(&c);
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
EVP_CIPHER_CTX_cleanup(c);
OPENSSL_free(c);
#else
EVP_CIPHER_CTX_free(c);
#endif
type = 0;
}
}
@ -192,8 +211,8 @@ public:
virtual EVPCipherContext *cloneSelf() const=0;
virtual const EVP_CIPHER *getType(int mode) const=0;
int keySize() { return getType(TQCA::CBC)->key_len; }
int blockSize() { return getType(TQCA::CBC)->block_size; }
int keySize() { return EVP_CIPHER_key_length(getType(TQCA::CBC)); }
int blockSize() { return EVP_CIPHER_block_size(getType(TQCA::CBC)); }
bool generateKey(char *out, int keysize)
{
@ -219,22 +238,27 @@ public:
pad = _pad;
type = getType(mode);
r.resize(0);
EVP_CIPHER_CTX_init(&c);
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
c = (EVP_CIPHER_CTX*)OPENSSL_malloc(sizeof(EVP_CIPHER_CTX));
EVP_CIPHER_CTX_init(c);
#else
c = EVP_CIPHER_CTX_new();
#endif
if(dir == TQCA::Encrypt) {
if(!EVP_EncryptInit(&c, type, NULL, NULL))
if(!EVP_EncryptInit(c, type, NULL, NULL))
return false;
if(keysize != type->key_len)
EVP_CIPHER_CTX_set_key_length(&c, keysize);
if(!EVP_EncryptInit(&c, NULL, (unsigned char *)key, (unsigned char *)iv))
if(keysize != EVP_CIPHER_key_length(type))
EVP_CIPHER_CTX_set_key_length(c, keysize);
if(!EVP_EncryptInit(c, NULL, (unsigned char *)key, (unsigned char *)iv))
return false;
}
else {
if(!EVP_DecryptInit(&c, type, NULL, NULL))
if(!EVP_DecryptInit(c, type, NULL, NULL))
return false;
if(keysize != type->key_len)
EVP_CIPHER_CTX_set_key_length(&c, keysize);
if(!EVP_DecryptInit(&c, NULL, (unsigned char *)key, (unsigned char *)iv))
if(keysize != EVP_CIPHER_key_length(type))
EVP_CIPHER_CTX_set_key_length(c, keysize);
if(!EVP_DecryptInit(c, NULL, (unsigned char *)key, (unsigned char *)iv))
return false;
}
return true;
@ -242,14 +266,14 @@ public:
bool update(const char *in, unsigned int len)
{
TQByteArray result(len + type->block_size);
TQByteArray result(len + EVP_CIPHER_block_size(type));
int olen;
if(dir == TQCA::Encrypt || !pad) {
if(!EVP_EncryptUpdate(&c, (unsigned char *)result.data(), &olen, (unsigned char *)in, len))
if(!EVP_EncryptUpdate(c, (unsigned char *)result.data(), &olen, (unsigned char *)in, len))
return false;
}
else {
if(!EVP_DecryptUpdate(&c, (unsigned char *)result.data(), &olen, (unsigned char *)in, len))
if(!EVP_DecryptUpdate(c, (unsigned char *)result.data(), &olen, (unsigned char *)in, len))
return false;
}
result.resize(olen);
@ -260,14 +284,14 @@ public:
bool final(TQByteArray *out)
{
if(pad) {
TQByteArray result(type->block_size);
TQByteArray result(EVP_CIPHER_block_size(type));
int olen;
if(dir == TQCA::Encrypt) {
if(!EVP_EncryptFinal(&c, (unsigned char *)result.data(), &olen))
if(!EVP_EncryptFinal_ex(c, (unsigned char *)result.data(), &olen))
return false;
}
else {
if(!EVP_DecryptFinal(&c, (unsigned char *)result.data(), &olen))
if(!EVP_DecryptFinal_ex(c, (unsigned char *)result.data(), &olen))
return false;
}
result.resize(olen);
@ -279,7 +303,7 @@ public:
return true;
}
EVP_CIPHER_CTX c;
EVP_CIPHER_CTX *c;
const EVP_CIPHER *type;
TQByteArray r;
int dir;
@ -509,11 +533,22 @@ public:
bool generate(unsigned int bits)
{
RSA *r = RSA_generate_key(bits, RSA_F4, NULL, NULL);
BIGNUM *bign = BN_new();
if (BN_set_word(bign, RSA_F4) != 1)
{
BN_free(bign);
return false;
}
RSA *r = RSA_new();
if(!r)
{
BN_free(bign);
return false;
}
RSA_generate_key_ex(r, bits, bign, NULL);
separate(r, &pub, &sec);
RSA_free(r);
BN_free(bign);
return true;
}
@ -522,12 +557,10 @@ public:
// deep copy
RSAKeyContext *c = new RSAKeyContext;
if(pub) {
++(pub->references);
c->pub = pub; //RSAPublicKey_dup(pub);
c->pub = RSAPublicKey_dup(pub);
}
if(sec) {
++(sec->references);
c->sec = sec; //RSAPrivateKey_dup(sec);
c->sec = RSAPrivateKey_dup(sec);
}
return c;
}
@ -769,8 +802,7 @@ public:
{
CertContext *c = new CertContext(*this);
if(x) {
++(x->references);
c->x = x;
c->x = X509_dup(x);
}
return c;
}
@ -841,8 +873,7 @@ public:
void fromX509(X509 *t)
{
reset();
++(t->references);
x = t;
x = X509_dup(t);
// serial number
ASN1_INTEGER *ai = X509_get_serialNumber(x);

@ -21,12 +21,19 @@
#ifndef TQCA_TLS_H
#define TQCA_TLS_H
#include"qcaprovider.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_TQCA
#include <tqcaprovider.h>
#else
#include "qcaprovider.h"
#endif
#ifdef TQCA_PLUGIN
TQCA_PLUGIN_EXPORT TQCAProvider *createProvider();
#else
TQCAProvider *createProviderTLS();
#endif
#endif
Yükleniyor…
İptal
Kaydet