Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
pull_request:

jobs:
linux:
name: Linux (${{ matrix.backend }})
runs-on: ubuntu-20.04 # for OpenSSL 1.1.1
linux_ubuntu_22:
name: Linux Ubuntu 22.04 (${{ matrix.backend }})
runs-on: ubuntu-22.04 # for OpenSSL 3.0.2
strategy:
fail-fast: false
matrix:
Expand All @@ -25,7 +25,33 @@ jobs:
sudo apt install libcppunit-dev libbotan-2-dev p11-kit
- name: Build
env:
CXXFLAGS: -Werror -DBOTAN_NO_DEPRECATED_WARNINGS
CXXFLAGS: -DBOTAN_NO_DEPRECATED_WARNINGS
run: |
./autogen.sh
./configure --with-crypto-backend=${{ matrix.backend }}
make
- name: Test
run: |
make check || (find . -name test-suite.log -exec cat {} \; && false)

linux_ubuntu_24:
name: Linux Ubuntu 24.04 (${{ matrix.backend }})
runs-on: ubuntu-24.04 # for OpenSSL 3.0.13
strategy:
fail-fast: false
matrix:
include:
- backend: openssl
- backend: botan
steps:
- uses: actions/checkout@v4
- name: Prepare
run: |
sudo apt update -qq
sudo apt install libcppunit-dev libbotan-2-dev p11-kit
- name: Build
env:
CXXFLAGS: -DBOTAN_NO_DEPRECATED_WARNINGS
run: |
./autogen.sh
./configure --with-crypto-backend=${{ matrix.backend }}
Expand Down
10 changes: 9 additions & 1 deletion src/lib/crypto/test/cryptotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@
#include "MutexFactory.h"
#include "SecureMemoryRegistry.h"

#if defined(WITH_OPENSSL)
#ifdef WITH_OPENSSL
#include "OSSLCryptoFactory.h"
#if OPENSSL_VERSION_NUMBER >= 0x3000000fL
#include <openssl/provider.h>
#endif
#else
#include "BotanCryptoFactory.h"
#endif
Expand Down Expand Up @@ -75,6 +78,11 @@ std::auto_ptr<BotanCryptoFactory> BotanCryptoFactory::instance(NULL);

int main(int /*argc*/, char** /*argv*/)
{
#if defined(WITH_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x3000000fL
OSSL_PROVIDER_load(NULL, "legacy");
OSSL_PROVIDER_load(NULL, "default");
#endif

CppUnit::TestResult controller;
CppUnit::TestResultCollector result;
CppUnit::TextUi::TestRunner runner;
Expand Down
15 changes: 10 additions & 5 deletions src/lib/test/ForkTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,17 @@ void ForkTests::testFork()
case 0:
rv = CRYPTOKI_F_PTR( C_Initialize(NULL_PTR) );
CPPUNIT_ASSERT(rv == CKR_CRYPTOKI_ALREADY_INITIALIZED);
rv = CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
CPPUNIT_ASSERT(rv == CKR_OK);
_exit(0);
break;
default:
rv = CRYPTOKI_F_PTR( C_Initialize(NULL_PTR) );
CPPUNIT_ASSERT(rv == CKR_CRYPTOKI_ALREADY_INITIALIZED);
rv = CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
CPPUNIT_ASSERT(rv == CKR_OK);
break;
}

rv = CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
CPPUNIT_ASSERT(rv == CKR_OK);
}
#ifndef P11_SHARED_LIBRARY
void ForkTests::testResetOnFork()
Expand Down Expand Up @@ -118,16 +120,19 @@ void ForkTests::testResetOnFork()
/* For the child, the token is expected to be reset on fork */
rv = CRYPTOKI_F_PTR( C_Initialize(NULL_PTR) );
CPPUNIT_ASSERT(rv == CKR_OK);
rv = CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
CPPUNIT_ASSERT(rv == CKR_OK);
_exit(0);
break;
default:
/* For the parent, the token is expected to be still initialized */
rv = CRYPTOKI_F_PTR( C_Initialize(NULL_PTR) );
CPPUNIT_ASSERT(rv == CKR_CRYPTOKI_ALREADY_INITIALIZED);
rv = CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
CPPUNIT_ASSERT(rv == CKR_OK);
break;
}

rv = CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
CPPUNIT_ASSERT(rv == CKR_OK);

#ifndef _WIN32
setenv("SOFTHSM2_CONF", "./softhsm2.conf", 1);
Expand Down
6 changes: 4 additions & 2 deletions src/lib/test/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in

AM_CPPFLAGS = -I$(srcdir)/.. \
AM_CPPFLAGS = -I$(srcdir)/../.. \
-I$(srcdir)/.. \
-I$(srcdir)/../common \
-I$(srcdir)/../pkcs11 \
@CPPUNIT_CFLAGS@
@CPPUNIT_CFLAGS@ \
@CRYPTO_INCLUDES@

check_PROGRAMS = p11test

Expand Down
Loading
Loading