Skip to content

Commit

Permalink
Merge branch 'develop' into ipv6_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jumoog authored Oct 13, 2024
2 parents ab2f737 + 338ebca commit fce0824
Show file tree
Hide file tree
Showing 28 changed files with 554 additions and 121 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: icraggs
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.

**Log files**
Please try to attach log files rather than pasting the log contents. It makes the issues easier to read.

** Environment (please complete the following information):**
- OS: [e.g. Linux]
- Version [e.g. 22]
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/artifact_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Upload release artifact for Linux"
on: [workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install doxygen
- name: Build
run: |
rm -rf build.paho
mkdir build.paho
cd build.paho
echo "pwd $PWD"
cmake -DPAHO_BUILD_STATIC=FALSE -DPAHO_BUILD_SHARED=TRUE -DCMAKE_BUILD_TYPE=Debug -DPAHO_WITH_SSL=TRUE -DOPENSSL_ROOT_DIR= -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=TRUE -DPAHO_HIGH_PERFORMANCE=TRUE ..
cmake --build .
- name: package
run: |
cd build.paho
cpack --verbose
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Eclipse-Paho-MQTT-C-1.3.13-Linux.tar.gz
path: /home/runner/work/paho.mqtt.c/paho.mqtt.c/build.paho/Eclipse-Paho-MQTT-C-1.3.13-Linux.tar.gz
30 changes: 30 additions & 0 deletions .github/workflows/artifact_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Upload release artifact for MacOS"
on: [workflow_dispatch]

jobs:
build:
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install dependencies
run: |
brew update
brew install doxygen
- name: Build
run: |
rm -rf build.paho
mkdir build.paho
cd build.paho
echo "pwd $PWD"
cmake -DPAHO_BUILD_STATIC=FALSE -DPAHO_BUILD_SHARED=TRUE -DCMAKE_BUILD_TYPE=Debug -DPAHO_WITH_SSL=TRUE -DOPENSSL_ROOT_DIR=/usr/local/opt/[email protected] -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=TRUE -DPAHO_HIGH_PERFORMANCE=TRUE ..
cmake --build .
- name: package
run: |
cd build.paho
cpack --verbose
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Eclipse-Paho-MQTT-C-1.3.13-Darwin.tar.gz
path: /Users/runner/work/paho.mqtt.c/paho.mqtt.c/build.paho/Eclipse-Paho-MQTT-C-1.3.13-Darwin.tar.gz
47 changes: 47 additions & 0 deletions .github/workflows/test_libressl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Test LibreSSL"
on: [push, pull_request]

jobs:
nix:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build LibreSSL
run: |
curl -O https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.8.2.tar.gz
tar -xf libressl-3.8.2.tar.gz
cd libressl-3.8.2
rm -rf build
mkdir build
cd build
cmake .. -DLIBRESSL_APPS:BOOL=0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=$(pwd)/../artifacts
cmake --build . --config Release -j$(nproc)
cmake --install .
- name: Build
run: |
rm -rf build.paho
mkdir build.paho
cd build.paho
echo "pwd $PWD"
cmake -DPAHO_BUILD_STATIC=FALSE -DPAHO_BUILD_SHARED=TRUE -DCMAKE_BUILD_TYPE=Debug -DPAHO_WITH_LIBRESSL=TRUE -DLIBRESSL_ROOT_DIR=$(pwd)/../libressl-3.8.2/artifacts -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_SAMPLES=TRUE -DPAHO_HIGH_PERFORMANCE=TRUE ..
cmake --build . --config Debug -j$(nproc)
- name: Start test broker
run: |
git clone https://github.com/eclipse/paho.mqtt.testing.git
cd paho.mqtt.testing/interoperability
python3 startbroker.py -c localhost_testing.conf &
- name: Start test proxy
run: |
python3 test/mqttsas.py &
- name: run tests
run: |
cd build.paho
ctest -C Debug -VV --timeout 600
- name: clean up
run: |
killall python3 || true
sleep 3 # allow broker time to terminate and report
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#*******************************************************************************
# Copyright (c) 2015, 2023 logi.cals GmbH and others
# Copyright (c) 2023 Frank Pagliughi <[email protected]>
# Copyright (c) 2015, 2024 logi.cals GmbH, Frank Pagliughi <[email protected]> and others
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
Expand Down Expand Up @@ -53,8 +52,8 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
endif()

## build options

option(PAHO_WITH_SSL "Flag that defines whether to build ssl-enabled binaries too. " FALSE)
option(PAHO_WITH_LIBRESSL "Flag that defines whether to build ssl-enabled binaries with LibreSSL instead of OpenSSL. " FALSE)
option(PAHO_WITH_LIBUUID "Flag that defines whether libuuid or a custom uuid implementation should be used" FALSE)
option(PAHO_BUILD_SHARED "Build shared library" TRUE)
option(PAHO_BUILD_STATIC "Build static library" FALSE)
Expand Down Expand Up @@ -82,7 +81,7 @@ if(NOT PAHO_BUILD_SHARED AND NOT PAHO_BUILD_STATIC)
message(FATAL_ERROR "You must set either PAHO_BUILD_SHARED, PAHO_BUILD_STATIC, or both")
endif()

if(PAHO_BUILD_SAMPLES AND NOT PAHO_WITH_SSL)
if(PAHO_BUILD_SAMPLES AND NOT (PAHO_WITH_SSL OR PAHO_WITH_LIBRESSL))
message(WARNING "You must build with SSL to build the full set of samples")
endif()

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ PAHO_BUILD_STATIC | FALSE | Build a static version of the libraries
PAHO_HIGH_PERFORMANCE | FALSE | When set to true, the debugging aids internal tracing and heap tracking are not included.
PAHO_WITH_SSL | FALSE | Flag that defines whether to build ssl-enabled binaries too.
OPENSSL_ROOT_DIR | "" (system default) | Directory containing your OpenSSL installation (i.e. `/usr/local` when headers are in `/usr/local/include` and libraries are in `/usr/local/lib`)
PAHO_WITH_LIBRESSL | FALSE | Flag that defines whether to build ssl-enabled binaries with LibreSSL instead of OpenSSL.
LIBRESSL_ROOT_DIR | "" (system default) | Directory containing your LibreSSL installation (i.e. `/usr/local` when headers are in `/usr/local/include` and libraries are in `/usr/local/lib`)
PAHO_BUILD_DOCUMENTATION | FALSE | Create and install the HTML based API documentation (requires Doxygen)
PAHO_BUILD_SAMPLES | FALSE | Build sample programs
PAHO_ENABLE_TESTING | TRUE | Build test and run
Expand Down
File renamed without changes.
227 changes: 227 additions & 0 deletions cmake/modules/FindLibreSSL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
#[=======================================================================[

Copyright (c) 2019 John Norrbin <[email protected]>

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

FindLibreSSL
------------

Find the LibreSSL encryption library.

Optional Components
^^^^^^^^^^^^^^^^^^^

This module supports two optional components: SSL and TLS. Both
components have associated imported targets, as described below.

Imported Targets
^^^^^^^^^^^^^^^^

This module defines the following imported targets:

LibreSSL::Crypto
The LibreSSL crypto library, if found.

LibreSSL::SSL
The LibreSSL ssl library, if found. Requires and includes LibreSSL::Crypto automatically.

LibreSSL::TLS
The LibreSSL tls library, if found. Requires and includes LibreSSL::SSL and LibreSSL::Crypto automatically.

Result Variables
^^^^^^^^^^^^^^^^

This module will set the following variables in your project:

LIBRESSL_FOUND
System has the LibreSSL library. If no components are requested it only requires the crypto library.
LIBRESSL_INCLUDE_DIR
The LibreSSL include directory.
LIBRESSL_CRYPTO_LIBRARY
The LibreSSL crypto library.
LIBRESSL_SSL_LIBRARY
The LibreSSL SSL library.
LIBRESSL_TLS_LIBRARY
The LibreSSL TLS library.
LIBRESSL_LIBRARIES
All LibreSSL libraries.
LIBRESSL_VERSION
This is set to $major.$minor.$revision (e.g. 2.6.8).

Hints
^^^^^

Set LIBRESSL_ROOT_DIR to the root directory of an LibreSSL installation.

]=======================================================================]

INCLUDE(FindPackageHandleStandardArgs)

# Set Hints
set(_LIBRESSL_ROOT_HINTS
${LIBRESSL_ROOT_DIR}
ENV LIBRESSL_ROOT_DIR
)

# Set Paths
if (WIN32)
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
set(_LIBRESSL_ROOT_PATHS
"${_programfiles}/LibreSSL"
)
unset(_programfiles)
else()
set(_LIBRESSL_ROOT_PATHS
"/usr/local/"
)
endif()

# Combine
set(_LIBRESSL_ROOT_HINTS_AND_PATHS
HINTS ${_LIBRESSL_ROOT_HINTS}
PATHS ${_LIBRESSL_ROOT_PATHS}
)

# Find Include Path
find_path(LIBRESSL_INCLUDE_DIR
NAMES
tls.h
${_LIBRESSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
include
)

# Find Crypto Library
find_library(LIBRESSL_CRYPTO_LIBRARY
NAMES
libcrypto
crypto
NAMES_PER_DIR
${_LIBRESSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
lib
)

# Find SSL Library
find_library(LIBRESSL_SSL_LIBRARY
NAMES
libssl
ssl
NAMES_PER_DIR
${_LIBRESSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
lib
)

# Find TLS Library
find_library(LIBRESSL_TLS_LIBRARY
NAMES
libtls
tls
NAMES_PER_DIR
${_LIBRESSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
lib
)

# Set Libraries
set(LIBRESSL_LIBRARIES ${LIBRESSL_CRYPTO_LIBRARY} ${LIBRESSL_SSL_LIBRARY} ${LIBRESSL_TLS_LIBRARY})

# Mark Variables As Advanced
mark_as_advanced(LIBRESSL_INCLUDE_DIR LIBRESSL_LIBRARIES LIBRESSL_CRYPTO_LIBRARY LIBRESSL_SSL_LIBRARY LIBRESSL_TLS_LIBRARY)

# Find Version File
if(LIBRESSL_INCLUDE_DIR AND EXISTS "${LIBRESSL_INCLUDE_DIR}/openssl/opensslv.h")

# Get Version From File
file(STRINGS "${LIBRESSL_INCLUDE_DIR}/openssl/opensslv.h" OPENSSLV.H REGEX "#define LIBRESSL_VERSION_TEXT[ ]+\".*\"")

# Match Version String
string(REGEX REPLACE ".*\".*([0-9]+)\\.([0-9]+)\\.([0-9]+)\"" "\\1;\\2;\\3" LIBRESSL_VERSION_LIST "${OPENSSLV.H}")

# Split Parts
list(GET LIBRESSL_VERSION_LIST 0 LIBRESSL_VERSION_MAJOR)
list(GET LIBRESSL_VERSION_LIST 1 LIBRESSL_VERSION_MINOR)
list(GET LIBRESSL_VERSION_LIST 2 LIBRESSL_VERSION_REVISION)

# Set Version String
set(LIBRESSL_VERSION "${LIBRESSL_VERSION_MAJOR}.${LIBRESSL_VERSION_MINOR}.${LIBRESSL_VERSION_REVISION}")

endif()

# Set Find Package Arguments
find_package_handle_standard_args(LibreSSL
REQUIRED_VARS
LIBRESSL_CRYPTO_LIBRARY
LIBRESSL_INCLUDE_DIR
VERSION_VAR
LIBRESSL_VERSION
HANDLE_COMPONENTS
FAIL_MESSAGE
"Could NOT find LibreSSL, try setting the path to LibreSSL using the LIBRESSL_ROOT_DIR environment variable"
)

# LibreSSL Found
if(LIBRESSL_FOUND)

# Set LibreSSL::Crypto
if(NOT TARGET LibreSSL::Crypto AND EXISTS "${LIBRESSL_CRYPTO_LIBRARY}")

# Add Library
add_library(LibreSSL::Crypto UNKNOWN IMPORTED)

# Set Properties
set_target_properties(
LibreSSL::Crypto
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBRESSL_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LIBRESSL_CRYPTO_LIBRARY}"
)

endif() # LibreSSL::Crypto

# Set LibreSSL::SSL
if(NOT TARGET LibreSSL::SSL AND EXISTS "${LIBRESSL_SSL_LIBRARY}")

# Add Library
add_library(LibreSSL::SSL UNKNOWN IMPORTED)

# Set Properties
set_target_properties(
LibreSSL::SSL
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBRESSL_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LIBRESSL_SSL_LIBRARY}"
INTERFACE_LINK_LIBRARIES LibreSSL::Crypto
)

endif() # LibreSSL::SSL

# Set LibreSSL::TLS
if(NOT TARGET LibreSSL::TLS AND EXISTS "${LIBRESSL_TLS_LIBRARY}")
add_library(LibreSSL::TLS UNKNOWN IMPORTED)
set_target_properties(
LibreSSL::TLS
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBRESSL_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LIBRESSL_TLS_LIBRARY}"
INTERFACE_LINK_LIBRARIES LibreSSL::SSL
)

endif() # LibreSSL::TLS

endif(LIBRESSL_FOUND)
Loading

0 comments on commit fce0824

Please sign in to comment.