Replacing the usage of OpenSSL by GnuTLS due to a GPL incompatibility

from the former.
This commit is contained in:
Carles Fernandez 2015-09-15 01:41:18 +02:00
parent a84b4baef0
commit 18545077d8
5 changed files with 44 additions and 29 deletions

View File

@ -778,24 +778,24 @@ endif(NOT ARMADILLO_FOUND)
################################################################################
# OpenSSL - http://www.openssl.org
# GnuTLS - http://www.gnutls.org/
################################################################################
find_package(OpenSSL)
if(NOT OPENSSL_FOUND)
message(" The OpenSSL library has not been found.")
find_package(GnuTLS)
if(NOT GNUTLS_FOUND)
message(" The GnuTLS library has not been found.")
message(" You can try to install it by typing:")
if(OS_IS_LINUX)
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo yum install openssl-devel")
message(" sudo yum install gnutls-devel")
else(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo apt-get install libssl-dev")
message(" sudo apt-get install libgnutls28-dev")
endif(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
endif(OS_IS_LINUX)
if(OS_IS_MACOSX)
message(" sudo port install openssl")
message(" sudo port install gnutls")
endif(OS_IS_MACOSX)
message(FATAL_ERROR "OpenSSL libraries are required to build gnss-sdr")
endif(NOT OPENSSL_FOUND)
message(FATAL_ERROR "GnuTLS libraries are required to build gnss-sdr")
endif(NOT GNUTLS_FOUND)
################################################################################

View File

@ -34,7 +34,7 @@ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time
libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev \
libboost-serialization-dev libboost-program-options-dev libboost-test-dev \
liblog4cpp5-dev libuhd-dev gnuradio-dev gr-osmosdr libblas-dev liblapack-dev \
libarmadillo-dev libgflags-dev libgoogle-glog-dev libssl-dev libgtest-dev
libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls28-dev libgtest-dev
~~~~~~
Once you have installed these packages, you can jump directly to [how to download the source code and build GNSS-SDR](#download-and-build-linux). Alternatively, if you need to manually install those libraries, please keep reading.
@ -154,11 +154,11 @@ changing /home/username/gtest-1.7.0 by the actual directory where you downloaded
#### Install the [SSL development libraries](https://www.openssl.org/ "OpenSSL's Homepage"):
#### Install the [GnuTLS library](http://www.gnutls.org/ "GnuTLS's Homepage"):
~~~~~~
$ sudo apt-get install libssl-dev # For Debian/Ubuntu/LinuxMint
$ sudo yum install openssl-devel # For Fedora/CentOS/RHEL
$ sudo apt-get install libgnutls28-dev # For Debian/Ubuntu/LinuxMint
$ sudo yum install gnutls-devel # For Fedora/CentOS/RHEL
~~~~~~

View File

@ -24,11 +24,11 @@ set (SUPL_SOURCES
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/core/libs/supl
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl
${OPENSSL_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/core/libs/supl
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl
${GNUTLS_INCLUDE_DIR}
)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
@ -38,6 +38,21 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
endif(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_C_FLAGS}")
find_library(GNUTLS_OPENSSL_LIBRARY NAMES gnutls-openssl
HINTS /usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/aarch64-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/i386-linux-gnu
)
add_library (supl_library STATIC ${ASN_RRLP_SOURCES} ${ASN_SUPL_SOURCES} ${SUPL_SOURCES})
target_link_libraries (supl_library ssl gnss_system_parameters)
target_link_libraries (supl_library ${GNUTLS_LIBRARIES} ${GNUTLS_OPENSSL_LIBRARY} gnss_system_parameters)
set_target_properties(supl_library PROPERTIES LINKER_LANGUAGE C)

View File

@ -4,9 +4,11 @@
** Copyright (c) 2007 Tatu Mannisto <tatu a-t tajuma d-o-t com>
** All rights reserved.
** Redistribution and modifications are permitted subject to BSD license.
**
** Modifified by Carles Fernandez <carles d-o-t fernandez a-t cttc d-o-t es>
** to make use of the gnutls library.
*/
#include "supl.h"
#include <stdio.h>
#include <fcntl.h>
#include <netdb.h>
@ -16,16 +18,8 @@
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/time.h>
#include <openssl/crypto.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include "ULP-PDU.h"
#include "PDU.h"
#include "supl.h"
#define PARAM_GSM_CELL_CURRENT 1
#define PARAM_GSM_CELL_KNOWN 2

View File

@ -4,6 +4,8 @@
** Copyright (c) 2007 Tatu Mannisto <tatu a-t tajuma d-o-t com>
** All rights reserved.
** Redistribution and modifications are permitted subject to BSD license.
** Modifified by Carles Fernandez <carles d-o-t fernandez a-t cttc d-o-t es>
** to make use of the gnutls library.
**
*/
@ -16,7 +18,11 @@
#define EXPORT
#endif
#include <openssl/ssl.h>
#include <gnutls/gnutls.h>
#include <gnutls/compat.h>
#include <gnutls/crypto.h>
#include <gnutls/openssl.h>
#include <gnutls/x509.h>
#include <PDU.h>
#include <ULP-PDU.h>