-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow the user to build oqs-provider as a static library.
This commit removes the `SHARED` argument of the `add_library`. By doing so, we let the user choose the build type of library. By default, CMake will build a static library. Thus, [`BUILD_SHARED_LIBS`] must be used to switch to a shared library. `oqs-provider` as a static library allows us to use the provider without having to store its shared library somewhere. In addition, it happens that some operating systems prohibit the use of `dlopen`/`dlsym`. To load `oqs-provider` when it is embedded into a library of a binary, one can use the [`OSSL_PROVIDER_add_builtin`] API from OpenSSL 3. [`BUILD_SHARED_LIBS`]: https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html [`OSSL_PROVIDER_add_builtin`]: https://www.openssl.org/docs/man3.1/man3/OSSL_PROVIDER_add_builtin.html
- Loading branch information
thb-sb
committed
Jul 18, 2023
1 parent
080c3dd
commit 04fdb5d
Showing
15 changed files
with
179 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,10 @@ jobs: | |
OPENSSL_PREINSTALL: | ||
description: "OpenSSL version preinstalled." | ||
type: string | ||
OQS_PROVIDER_BUILD_STATIC: | ||
description: "Build oqsprovider as a static library" | ||
type: boolean | ||
default: false | ||
docker: | ||
- image: << parameters.IMAGE >> | ||
steps: | ||
|
@@ -61,11 +65,19 @@ jobs: | |
- run: | ||
name: Build OQS-OpenSSL provider (<< parameters.CMAKE_ARGS >> with QSC encoding support) | ||
command: | | ||
mkdir _build && cd _build && cmake -GNinja << parameters.CMAKE_ARGS >> -DUSE_ENCODING_LIB=ON -DCMAKE_PREFIX_PATH=$(pwd)/../.local .. && ninja && cd .. | ||
oqsprovider_cmake_args="<< parameters.CMAKE_ARGS >>" | ||
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then | ||
oqsprovider_cmake_args="${oqsprovider_cmake_args} -DOQS_PROVIDER_BUILD_STATIC=ON" | ||
fi | ||
mkdir _build && cd _build && cmake -GNinja ${oqsprovider_cmake_args} -DUSE_ENCODING_LIB=ON -DCMAKE_PREFIX_PATH=$(pwd)/../.local .. && ninja && cd .. | ||
- run: | ||
name: Run tests | ||
command: | | ||
./scripts/runtests.sh -V | ||
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then | ||
ctest --test-dir _build/ | ||
else | ||
./scripts/runtests.sh -V | ||
fi | ||
- run: | ||
name: Run tests (with encodings, positive and negative test) | ||
command: | | ||
|
@@ -83,7 +95,11 @@ jobs: | |
- run: | ||
name: Run tests (-DNOPUBKEY_IN_PRIVKEY=ON) | ||
command: | | ||
./scripts/runtests.sh -V | ||
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then | ||
ctest --test-dir _build/ | ||
else | ||
./scripts/runtests.sh -V | ||
fi | ||
- run: | ||
name: Run tests (-DNOPUBKEY_IN_PRIVKEY=ON, with encodings, positive and negative test) | ||
command: | | ||
|
@@ -104,6 +120,10 @@ jobs: | |
OPENSSL_PREINSTALL: | ||
description: "OpenSSL version preinstalled." | ||
type: string | ||
OQS_PROVIDER_BUILD_STATIC: | ||
description: "Build oqsprovider as a static library" | ||
type: boolean | ||
default: false | ||
macos: | ||
xcode: "13.2.1" | ||
steps: | ||
|
@@ -134,7 +154,11 @@ jobs: | |
- run: | ||
name: Build OQS-OpenSSL provider | ||
command: | | ||
export OPENSSL_INSTALL=$(pwd)/.local && mkdir _build && cd _build && cmake -GNinja -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL -DCMAKE_PREFIX_PATH=$(pwd)/../.local << parameters.CMAKE_ARGS >> .. && ninja && echo "export OPENSSL_INSTALL=$OPENSSL_INSTALL" >> "$BASH_ENV" | ||
oqsprovider_cmake_args="<< parameters.CMAKE_ARGS >>" | ||
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then | ||
oqsprovider_cmake_args="${oqsprovider_cmake_args} -DOQS_PROVIDER_BUILD_STATIC=ON" | ||
fi | ||
export OPENSSL_INSTALL=$(pwd)/.local && mkdir _build && cd _build && cmake -GNinja -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL -DCMAKE_PREFIX_PATH=$(pwd)/../.local ${oqsprovider_cmake_args} .. && ninja && echo "export OPENSSL_INSTALL=$OPENSSL_INSTALL" >> "$BASH_ENV" | ||
- when: | ||
condition: | ||
equal: [ [email protected], << parameters.OPENSSL_PREINSTALL >> ] | ||
|
@@ -146,15 +170,27 @@ jobs: | |
- run: | ||
name: Run tests | ||
command: | | ||
./scripts/runtests.sh -V | ||
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then | ||
ctest --test-dir _build/ --output-on-failure | ||
else | ||
./scripts/runtests.sh -V | ||
fi | ||
- run: | ||
name: Build OQS-OpenSSL provider with QSC encoding support | ||
command: | | ||
rm -rf _build && mkdir _build && cd _build && cmake -GNinja -DUSE_ENCODING_LIB=ON -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL -DCMAKE_PREFIX_PATH=$(pwd)/../.local << parameters.CMAKE_ARGS >> .. && ninja | ||
oqsprovider_cmake_args="<< parameters.CMAKE_ARGS >>" | ||
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then | ||
oqsprovider_cmake_args="${oqsprovider_cmake_args} -DOQS_PROVIDER_BUILD_STATIC=ON" | ||
fi | ||
rm -rf _build && mkdir _build && cd _build && cmake -GNinja -DUSE_ENCODING_LIB=ON -DOPENSSL_ROOT_DIR=$OPENSSL_INSTALL -DCMAKE_PREFIX_PATH=$(pwd)/../.local ${oqsprovider_cmake_args} .. && ninja | ||
- run: | ||
name: Run tests | ||
command: | | ||
./scripts/runtests.sh -V | ||
if << parameters.OQS_PROVIDER_BUILD_STATIC >> ; then | ||
ctest --test-dir _build/ --output-on-failure | ||
else | ||
./scripts/runtests.sh -V | ||
fi | ||
- run: | ||
name: Run tests (with encodings) | ||
command: | | ||
|
@@ -202,6 +238,13 @@ workflows: | |
IMAGE: openquantumsafe/ci-ubuntu-jammy:latest | ||
CMAKE_ARGS: -DOQS_STRICT_WARNINGS=ON -DOQS_ALGS_ENABLED=STD | ||
OPENSSL_PREINSTALL: openssl@3 | ||
- ubuntu: | ||
name: ubuntu-jammy-static | ||
context: openquantumsafe | ||
IMAGE: openquantumsafe/ci-ubuntu-jammy:latest | ||
OQS_PROVIDER_BUILD_STATIC: true | ||
CMAKE_ARGS: -DOQS_STRICT_WARNINGS=ON -DOQS_ALGS_ENABLED=STD | ||
OPENSSL_PREINSTALL: openssl@3 | ||
- macOS: | ||
name: macOS-noopenssl | ||
CMAKE_ARGS: -DOQS_STRICT_WARNINGS=ON -DOQS_USE_OPENSSL=OFF | ||
|
@@ -210,6 +253,11 @@ workflows: | |
name: macOS-shared | ||
CMAKE_ARGS: -DBUILD_SHARED_LIBS=ON -DOQS_DIST_BUILD=OFF -DOQS_ENABLE_KEM_CLASSIC_MCELIECE=OFF | ||
OPENSSL_PREINSTALL: [email protected] | ||
- macOS: | ||
name: macOS-static | ||
OQS_PROVIDER_BUILD_STATIC: true | ||
CMAKE_ARGS: -DOQS_DIST_BUILD=OFF -DOQS_ENABLE_KEM_CLASSIC_MCELIECE=OFF | ||
OPENSSL_PREINSTALL: [email protected] | ||
on-main-branch: | ||
when: | ||
or: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.