Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meson option to disable explicit EC keys tests #492

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ jobs:
git config --global --add safe.directory \
/__w/pkcs11-provider/pkcs11-provider
git submodule update --init
CC=${{ matrix.compiler }} meson setup builddir
if [ -f /etc/redhat-release ]; then
CC=${{ matrix.compiler }} meson setup builddir
else
CC=${{ matrix.compiler }} meson setup builddir -Denable_explicit_EC_test=true
fi
- name: Build and Test
if : ( steps.nss-version-check.outputs.skiptest != 'true' )
run: |
Expand Down
5 changes: 5 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ option('preload_libasan',
type: 'string',
value: 'no',
description: 'Path to libasan.so to preload')

option('enable_explicit_EC_test',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this needs to be generic, but meson provides a feature option type for enabled/disabled kind of options.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure either, I'm guessing it would be more useful if we had a dependency in this case, but since this is just a on-and-off switch I don't see the need for it.

type: 'boolean',
value: false,
description: 'Enable explicit EC tests')
9 changes: 9 additions & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ if nss_softokn.found()
endif
endif

if get_option('enable_explicit_EC_test')
conf_env.set('ENABLE_EXPLICIT_EC_TEST', '1')
endif

setup_script=find_program('setup.sh')
foreach suite : ['softokn', 'softhsm', 'kryoptic', 'kryoptic.nss']
test(
Expand All @@ -47,6 +51,10 @@ test_env = environment({
'TESTBLDDIR': meson.current_build_dir(),
})

if get_option('enable_explicit_EC_test')
test_env.set('ENABLE_EXPLICIT_EC_TEST', '1')
endif

valgrind = find_program('valgrind', required: false)
if valgrind.found()
add_test_setup('valgrind',
Expand Down Expand Up @@ -96,6 +104,7 @@ if get_option('b_sanitize') == 'address'
endif
endif


test_programs = {
'tsession': ['tsession.c'],
'tgenkey': ['tgenkey.c'],
Expand Down
4 changes: 2 additions & 2 deletions tests/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ echo "${ECPRI2URI}"
echo "${ECCRT2URI}"
echo ""

if [ -f /etc/redhat-release ]; then
title PARA "explicit EC unsupported on Fedora/EL"
if [ -z "${ENABLE_EXPLICIT_EC_TEST}" ]; then
title PARA "explicit EC unsupported"
elif [ "${TOKENTYPE}" == "softokn" ]; then
title PARA "explicit EC unsupported with softokn"
else
Expand Down
8 changes: 4 additions & 4 deletions tests/tecxc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# Copyright (C) 2023 Simo Sorce <[email protected]>
# SPDX-License-Identifier: Apache-2.0

# On Fedora/EL completely removed support for explicit EC from libcrypto,
# so skip the test completely
if [ -f /etc/redhat-release ]; then
exit 0
# Some distributions completely removed support for explicit EC from libcrypto.
# If `-Denable_explicit_EC_test=true` is not set, skip the test.
if [ -z "${ENABLE_EXPLICIT_EC_TEST}" ]; then
exit 77
fi

source "${TESTSSRCDIR}/helpers.sh"
Expand Down
Loading