Skip to content
Merged
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
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
linux:
name: Linux (${{ matrix.backend }})
runs-on: ubuntu-20.04 # for OpenSSL 1.1.1
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
Expand All @@ -23,6 +23,13 @@ jobs:
run: |
sudo apt update -qq
sudo apt install libcppunit-dev libbotan-2-dev p11-kit
# Replace installed OpenSSL with the supported version 1.1.1
curl -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb
curl -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.24_amd64.deb
curl -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_1.1.1f-1ubuntu2.24_amd64.deb
sudo dpkg -i --force-confnew openssl_1.1.1f-1ubuntu2.24_amd64.deb \
libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb \
libssl-dev_1.1.1f-1ubuntu2.24_amd64.deb
- name: Build
env:
CXXFLAGS: -Werror -DBOTAN_NO_DEPRECATED_WARNINGS
Expand Down
17 changes: 17 additions & 0 deletions src/lib/test/ForkTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "osmutex.h"

#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

CPPUNIT_TEST_SUITE_REGISTRATION(ForkTests);
Expand All @@ -64,6 +65,7 @@ void ForkTests::testFork()
{
CK_RV rv;
pid_t pid;
int status;

// Just make sure that we finalize any previous failed tests
CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
Expand All @@ -78,12 +80,20 @@ void ForkTests::testFork()
CPPUNIT_FAIL("Fork failed");
break;
case 0:
/* For the child, the token is expected to still be 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);
_exit(EXIT_SUCCESS);
break;
default:
/* For the parent, the token is expected to still be initialized. */
rv = CRYPTOKI_F_PTR( C_Initialize(NULL_PTR) );
CPPUNIT_ASSERT(rv == CKR_CRYPTOKI_ALREADY_INITIALIZED);
/* Wait for the child process to finish and check its status. */
CPPUNIT_ASSERT(waitpid(pid, &status, 0) == pid);
CPPUNIT_ASSERT(WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS);
break;
}

Expand All @@ -95,6 +105,7 @@ void ForkTests::testResetOnFork()
{
CK_RV rv;
pid_t pid;
int status;

// Just make sure that we finalize any previous failed tests
CRYPTOKI_F_PTR( C_Finalize(NULL_PTR) );
Expand All @@ -118,11 +129,17 @@ 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(EXIT_SUCCESS);
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);
/* Wait for the child process to finish and check its status. */
CPPUNIT_ASSERT(waitpid(pid, &status, 0) == pid);
CPPUNIT_ASSERT(WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS);
break;
}

Expand Down
Loading