diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000000..cda100bce2 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,4 @@ +Checks: '-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling' +WarningsAsErrors: '-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling' +HeaderFilterRegex: '.*' +UseColor: 'true' diff --git a/configure.ac b/configure.ac index b8224b5de7..145f380981 100644 --- a/configure.ac +++ b/configure.ac @@ -980,6 +980,8 @@ if test "${enable_sm}" = "yes"; then esac fi +AC_DEFINE([ENABLE_PKCS11], [1], [Enable building of PKCS#11 library]) + if test "${with_pkcs11_provider}" = "detect"; then if test "${WIN32}" != "yes"; then DEFAULT_PKCS11_PROVIDER="${libdir}/opensc-pkcs11${DYN_LIB_EXT}" diff --git a/doc/files/meson.build b/doc/files/meson.build new file mode 100644 index 0000000000..5f29177314 --- /dev/null +++ b/doc/files/meson.build @@ -0,0 +1,76 @@ +if progxsltproc.found() and stylesheets_path != '' + xml1 = configure_file( + configuration: { + 'sysconfdir': absolute_sysconfdir, + 'docdir': absolute_docdir, + 'libdir': absolute_libdir / '', + 'DYN_LIB_EXT': '.' + extension_of_libraries, + 'DEFAULT_PCSC_PROVIDER': conf.get_unquoted('DEFAULT_PCSC_PROVIDER'), + 'PROFILE_DIR_DEFAULT': (host_machine.system() == 'windows' or host_machine.system() == 'cygwin')? + 'obtained from windows registers' : absolute_pkgdir, + 'DEFAULT_SM_MODULE': conf.get_unquoted('DEFAULT_SM_MODULE') + }, + input: 'opensc.conf.5.xml.in', + output: 'opensc.conf.5.xml' + ) + + custom_target( + command: [progxsltproc, + '--nonet', + '--path', meson.project_source_root() / 'doc' + ':' + stylesheets_path / 'manpages', + '--xinclude', + '-o', '@OUTPUT@', + 'man.xsl', + '@INPUT@' + ], + input: xml1, + output: modfs.stem(xml1), + build_by_default: get_option('man'), + install: get_option('man'), + install_dir: get_option('mandir') / 'man5' + ) + + xml2 = configure_file( + configuration: {'pkgdatadir': absolute_pkgdir}, + input: 'pkcs15-profile.5.xml', + output: 'pkcs15-profile.5.xml' + ) + + custom_target( + command: [progxsltproc, + '--nonet', + '--path', meson.project_source_root() / 'doc' + ':' + stylesheets_path / 'manpages', + '--xinclude', + '-o', '@OUTPUT@', + 'man.xsl', + '@INPUT@' + ], + input: xml2, + output: modfs.stem(xml2), + build_by_default: get_option('man'), + install: get_option('man'), + install_dir: get_option('mandir') / 'man5' + ) + + custom_target( + command: [progxsltproc, + '--nonet', + '--path', meson.project_build_root() / 'doc' / 'files' + ':' + + meson.project_source_root() / 'doc' + ':' + + stylesheets_path / 'html', + '--xinclude', + '-o', '@OUTPUT@', + 'html.xsl', + '@INPUT@' + ], + input: 'files.xml', + output: 'files.html', + depend_files: [xml1, xml2], + build_by_default: get_option('doc'), + install: get_option('doc'), + install_dir: absolute_docdir + ) + + unset_variable('xml1') + unset_variable('xml2') +endif diff --git a/doc/tools/generate_completion.sh b/doc/tools/generate_completion.sh new file mode 100755 index 0000000000..4c541d9f60 --- /dev/null +++ b/doc/tools/generate_completion.sh @@ -0,0 +1,38 @@ +if [ ! $# -eq 3 ]; then + echo "Usage: template description.1.xml generated_completion" + exit 1 +fi +if [ ! -r "$1" ]; then + echo "The file \"$1\" does not exist or is not readable" + exit 2 +fi +if [ ! -r "$2" ]; then + echo "The file \"$2\" does not exist or is not readable" + exit 3 +fi + +ALLOPTS=$(sed -n 's,.*.*,\1,pg' "$2" | sort -u | grep '^-' | tr '\n' ' ') + +OPTSWITHARGS=$(sed -n 's,.*.*.*,\1,pg' "$2" | sort -u | grep '^-' | tr '\n' '|' | sed 's,|$$,,' | grep ^ || echo "!*") + +FILEOPTS=$(sed -n 's,.*.*.*filename.*,\1,pg' "$2" | sort -u | grep '^-' | tr '\n' '|' | sed 's,|$$,,' | grep ^ || echo "!*") + +PINOPTS=$(sed -En 's,.*.*\s*(newpin|pin|puk|sopin|sopuk)\s*<.*,\1,pg' "$2" | sort -u | grep '^-' | tr '\n' '|' | sed 's,|$$,,' | grep ^ || echo "!*") + +MODULEOPTS=$(sed -n 's,.*.*.*mod.*,\1,pg' "$2" | sort -u | grep '^-' | tr '\n' '|' | sed 's,|$$,,' | grep ^ || echo "!*") + +FUNCTION_NAME=$(basename "$3" | sed s,-,_,g) + +PROGRAM_NAME=$(basename "$3") + +cat "$1" \ + | sed "s,ALLOPTS,${ALLOPTS}," \ + | sed "s,OPTSWITHARGS,${OPTSWITHARGS}," \ + | sed "s,FILEOPTS,${FILEOPTS}," \ + | sed "s,PINOPTS,${PINOPTS}," \ + | sed "s,MODULEOPTS,${MODULEOPTS}," \ + | sed "s,FUNCTION_NAME,${FUNCTION_NAME}," \ + | sed "s,PROGRAM_NAME,${PROGRAM_NAME}," \ +> "$3" + +exit 0 diff --git a/doc/tools/meson.build b/doc/tools/meson.build new file mode 100644 index 0000000000..c0d11e8e18 --- /dev/null +++ b/doc/tools/meson.build @@ -0,0 +1,93 @@ +sources = [ + 'cardos-tool.1.xml', + 'dnie-tool.1.xml', + 'dtrust-tool.1.xml', + 'egk-tool.1.xml', + 'eidenv.1.xml', + 'goid-tool.1.xml', + 'iasecc-tool.1.xml', + 'openpgp-tool.1.xml', + 'opensc-asn1.1.xml', + 'opensc-explorer.1.xml', + 'opensc-tool.1.xml', + 'pkcs11-register.1.xml', + 'pkcs11-tool.1.xml', + 'pkcs15-crypt.1.xml', + 'pkcs15-tool.1.xml' +] + +if conf.get('ENABLE_OPENSSL') + sources += [ + 'cryptoflex-tool.1.xml', + 'gids-tool.1.xml', + 'netkey-tool.1.xml', + 'piv-tool.1.xml', + 'pkcs15-init.1.xml', + 'sc-hsm-tool.1.xml', + 'westcos-tool.1.xml' + ] +endif + +if conf.get('ENABLE_OPENSSL') and conf.get('ENABLE_OPENPACE') + sources += [ + 'npa-tool.1.xml' + ] +endif + +if conf.get('ENABLE_NOTIFY') + sources += [ + 'opensc-notify.1.xml' + ] +endif + +if progxsltproc.found() and stylesheets_path != '' + foreach xml : sources + custom_target( + command: [progxsltproc, + '--nonet', + '--path', meson.project_source_root() / 'doc' + ':' + stylesheets_path / 'manpages', + '--xinclude', + '-o', '@OUTPUT@', + 'man.xsl', + '@INPUT@' + ], + input: xml, + output: modfs.replace_suffix(xml, ''), + build_by_default: get_option('man'), + install: get_option('man'), + install_dir: get_option('mandir') / 'man1' + ) + endforeach + + custom_target( + command: [progxsltproc, + '--nonet', + '--path', meson.project_source_root() / 'doc' + ':' + stylesheets_path / 'html', + '--xinclude', + '-o', '@OUTPUT@', + 'html.xsl', + '@INPUT@' + ], + input: 'tools.xml', + output: 'tools.html', + depend_files: sources, + build_by_default: get_option('doc'), + install: get_option('doc'), + install_dir: absolute_docdir + ) +endif + +if bash_completion_path != '' + foreach xml : sources + custom_target( + command: ['generate_completion.sh', '@INPUT0@', '@INPUT1@', '@OUTPUT@'], + input: ['completion-template', xml], + output: modfs.replace_suffix(modfs.replace_suffix(xml, ''), ''), + build_by_default: get_option('bash_completion'), + install: get_option('bash_completion'), + install_dir: bash_completion_path + ) + endforeach +endif + +unset_variable('sources') diff --git a/etc/meson.build b/etc/meson.build new file mode 100644 index 0000000000..1a3c1aec09 --- /dev/null +++ b/etc/meson.build @@ -0,0 +1,40 @@ +install_data( + 'opensc.conf', + install_dir: get_option('sysconfdir') +) + +if conf.get('ENABLE_OPENPACE') + install_data( + 'DESRCACC100001', + 'DESCHSMCVCA00001', + install_dir: cv_certificates_path + ) +endif + +if get_option('doc') + conf_etc = configuration_data() + conf_etc.set('LIBDIR', absolute_libdir / '') + conf_etc.set('DEFAULT_PCSC_PROVIDER', conf.get_unquoted('DEFAULT_PCSC_PROVIDER')) + conf_etc.set('DEFAULT_SM_MODULE', conf.get_unquoted('DEFAULT_SM_MODULE')) + conf_etc.set('DEFAULT_SM_MODULE_PATH', conf.get_unquoted('DEFAULT_SM_MODULE_PATH')) + conf_etc.set('DYN_LIB_EXT', '.' + extension_of_libraries) + conf_etc.set('LIB_PRE', prefix_of_libraries) + + if host_machine.system() == 'windows' or host_machine.system() == 'cygwin' + conf_etc.set('DEBUG_FILE', '%TEMP%\\opensc-debug.log') + conf_etc.set('PROFILE_DIR_DEFAULT', 'obtained from windows registers') + conf_etc.set('PROFILE_DIR', '') + else + conf_etc.set('DEBUG_FILE', '/tmp/opensc-debug.log') + conf_etc.set('PROFILE_DIR_DEFAULT', absolute_pkgdir) + conf_etc.set('PROFILE_DIR', absolute_pkgdir) + endif + + configure_file( + configuration: conf_etc, + input: 'opensc.conf.example.in', + output: 'opensc.conf', + install: true, + install_dir: absolute_docdir + ) +endif diff --git a/meson.build b/meson.build new file mode 100644 index 0000000000..aa2bee5a30 --- /dev/null +++ b/meson.build @@ -0,0 +1,449 @@ +project('opensc', 'c', + version: '0.25.1', + license: 'LGPLv2.1+', + default_options: 'c_std=none', + meson_version: '>= 0.62' + ) + +modpkgconfig = import('pkgconfig') +modfs = import('fs') + +all_languages = ['c'] +if host_machine.system() == 'windows' + add_languages('cpp') + all_languages += 'cpp' +elif host_machine.system() == 'darwin' + add_languages('objc') + all_languages += 'objc' +endif + +prefix_of_libraries = 'lib' +if host_machine.system() == 'cygwin' + prefix_of_libraries = 'cyg' +elif meson.get_compiler('c').get_id() == 'msvc' + prefix_of_libraries = '' +endif + +extension_of_libraries = 'so' +if host_machine.system() == 'windows' + extension_of_libraries = 'dll' +elif host_machine.system() == 'darwin' + extension_of_libraries = 'dylib' +endif + +absolute_bindir = (modfs.is_absolute(get_option('bindir'))? '' : get_option('prefix')) / get_option('bindir') +absolute_libdir = (modfs.is_absolute(get_option('libdir'))? '' : get_option('prefix')) / get_option('libdir') +absolute_sysconfdir = (modfs.is_absolute(get_option('sysconfdir'))? '' : get_option('prefix')) / get_option('sysconfdir') +absolute_datadir = (modfs.is_absolute(get_option('datadir'))? '' : get_option('prefix')) / get_option('datadir') + +absolute_pkgdir = absolute_datadir / 'opensc' +absolute_docdir = absolute_datadir / 'doc' / 'opensc' + +################################################# +# Dependencies and configuration +################################################# +conf = configuration_data() +conf.set_quoted('VERSION', meson.project_version()) +conf.set_quoted('PACKAGE_NAME', 'OpenSC') +conf.set_quoted('PACKAGE_VERSION', meson.project_version()) +conf.set_quoted('OPENSC_VS_FF_COMPANY_NAME', 'OpenSC project') +conf.set_quoted('OPENSC_VS_FF_PRODUCT_NAME', 'OpenSC smartcard framework') +conf.set_quoted('VS_FF_LEGAL_COPYRIGHT', 'OpenSC Project') +conf.set_quoted('VS_FF_LEGAL_COMPANY_NAME', 'OpenSC Project') +conf.set_quoted('VS_FF_LEGAL_COMPANY_URL', 'https://github.com/OpenSC') +conf.set_quoted('VS_FF_COMMENTS', 'Provided under the terms of the GNU Lesser General Public License (LGPLv2.1+).') +conf.set_quoted('VS_FF_PRODUCT_NAME', 'OpenSC smartcard framework') +conf.set_quoted('VS_FF_PRODUCT_UPDATES', 'https://github.com/OpenSC/OpenSC/releases') +conf.set_quoted('VS_FF_PRODUCT_URL', 'https://github.com/OpenSC/OpenSC') +conf.set_quoted('OPENSC_CONF_PATH', absolute_sysconfdir / 'opensc.conf') +conf.set_quoted('SC_PKCS15_PROFILE_DIRECTORY', absolute_pkgdir) +conf.set_quoted('DEFAULT_SM_MODULE', prefix_of_libraries + 'smm-local.' + extension_of_libraries) + +project_version = meson.project_version().split('.') +conf.set('OPENSC_VERSION_MAJOR', project_version[0]) +conf.set('OPENSC_VERSION_MINOR', project_version[1]) +conf.set('OPENSC_VERSION_FIX', project_version[2]) + +if host_machine.system() == 'windows' or host_machine.system() == 'cygwin' + conf.set_quoted('DEFAULT_PCSC_PROVIDER', 'winscard.dll') + conf.set_quoted('DEFAULT_SM_MODULE_PATH', '%PROGRAMFILES%\\OpenSC Project\\OpenSC\\tools') + conf.set_quoted('PKCS11_REGISTER_SKIP_FIREFOX', 'on') + +elif host_machine.system() == 'darwin' + conf.set_quoted('DEFAULT_PCSC_PROVIDER', '/System/Library/Frameworks/PCSC.framework/PCSC') + conf.set_quoted('DEFAULT_SM_MODULE_PATH', absolute_libdir) + conf.set_quoted('PKCS11_REGISTER_SKIP_FIREFOX', 'on') + +else + conf.set_quoted('DEFAULT_PCSC_PROVIDER', 'libpcsclite.so.1') + conf.set_quoted('DEFAULT_SM_MODULE_PATH', absolute_libdir) + conf.set_quoted('PKCS11_REGISTER_SKIP_FIREFOX', 'off') +endif + +conf.set('ENABLE_SHARED', get_option('default_library') != 'static') +conf.set('ENABLE_PKCS11', get_option('components').contains('pkcs11')) +conf.set('ENABLE_MINIDRIVER', get_option('components').contains('minidriver')) +conf.set('ENABLE_SM', get_option('components').contains('sm')) + +conf.set('ENABLE_PCSC', false) +conf.set('ENABLE_CRYPTOTOKENKIT', false) +conf.set('ENABLE_OPENCT', false) +conf.set('ENABLE_CTAPI', false) +conf.set('HAVE_WINSCARD_H', false) +conf.set('HAVE_PCSCLITE_H', false) + +if get_option('driver') == 'pcsc' + conf.set('ENABLE_PCSC', true) + deppcsclite = dependency('libpcsclite', version: '>= 1.8.22') + conf.set('HAVE_WINSCARD_H', meson.get_compiler('c').has_header('winscard.h', dependencies: deppcsclite)) + conf.set('HAVE_PCSCLITE_H', meson.get_compiler('c').has_header('pcsclite.h', dependencies: deppcsclite)) + +elif get_option('driver') == 'crypttokenkit' + conf.set('ENABLE_CRYPTOTOKENKIT', true) + depcryptotokenkit = dependency('appleframeworks', modules: 'CryptoTokenKit') + +elif get_option('driver') == 'openct' + conf.set('ENABLE_OPENCT', true) + depopenct = dependency('openct') + +elif get_option('driver') == 'ctapi' + conf.set('ENABLE_CTAPI', true) + +else + error('The option "driver" has unknown value') +endif + +depopenpace = dependency('libeac', version: '>= 0.9', required: get_option('openpace')) +conf.set('ENABLE_OPENPACE', depopenpace.found()) +if depopenpace.found() + cv_certificates_path = depopenpace.get_variable('cvcdir') + conf.set_quoted('CVCDIR', cv_certificates_path) + x509_certificates_path = depopenpace.get_variable('x509dir') + conf.set_quoted('X509DIR', x509_certificates_path) +endif + +depopenssl = dependency('openssl', version: '>= 1.1.1', required: get_option('openssl')) +conf.set('ENABLE_OPENSSL', depopenssl.found()) +if depopenssl.found() and get_option('openssl-secure-malloc') != 0 + conf.set('OPENSSL_SECURE_MALLOC_SIZE', get_option('openssl-secure-malloc')) +endif + +depreadline = dependency('readline', required: get_option('readline')) +conf.set('ENABLE_READLINE', depreadline.found()) + +depzlib = dependency('zlib', required: get_option('zlib')) +conf.set('ENABLE_ZLIB', depzlib.found()) + +depcorefoundation = dependency('appleframeworks', modules: 'CoreFoundation', required: get_option('dnie_ui')) +conf.set('ENABLE_DNIE_UI', depcorefoundation.found()) + +depthreads = dependency('threads', required: false) +conf.set('HAVE_PTHREAD', depthreads.found()) + +depgio2 = dependency('gio-2.0', required: false) +conf.set('ENABLE_GIO2', depgio2.found()) + +conf.set('ENABLE_NOTIFY', get_option('notify')) +conf.set('PKCS11_THREAD_LOCKING', get_option('thread_locking')) +conf.set('ENABLE_PIV_SM', get_option('piv_sm')) + +depdl = dependency('dl') + +conf.set_quoted('DEFAULT_PKCS11_PROVIDER', '') +conf.set_quoted('DEFAULT_ONEPIN_PKCS11_PROVIDER', '') +if get_option('components').contains('pkcs11') + depp11kit = dependency('p11-kit-1', required: false) + conf.set('HAVE_P11KIT', depp11kit.found()) + if depp11kit.found() + p11kit_modules_path = depp11kit.get_variable('p11_module_path') + p11kit_configs_path = depp11kit.get_variable('p11_module_configs') + + conf.set_quoted('DEFAULT_PKCS11_PROVIDER', p11kit_modules_path / 'opensc-pkcs11.' + extension_of_libraries) + conf.set_quoted('DEFAULT_ONEPIN_PKCS11_PROVIDER', p11kit_modules_path / 'opensc-pkcs11.' + extension_of_libraries) + else + if get_option('default_library') != 'static' + conf.set_quoted('DEFAULT_PKCS11_PROVIDER', absolute_libdir / prefix_of_libraries + 'opensc-pkcs11.' + extension_of_libraries) + conf.set_quoted('DEFAULT_ONEPIN_PKCS11_PROVIDER', absolute_libdir / prefix_of_libraries + 'opensc-pkcs11.' + extension_of_libraries) + endif + endif +endif + +conf.set('HAVE_INTTYPES_H', meson.get_compiler('c').has_header('inttypes.h')) +conf.set('HAVE_STRING_H', meson.get_compiler('c').has_header('string.h')) +conf.set('HAVE_STRINGS_H', meson.get_compiler('c').has_header('strings.h')) +conf.set('HAVE_SYS_TIME_H', meson.get_compiler('c').has_header('sys' / 'time.h')) +conf.set('HAVE_SYS_MMAN_H', meson.get_compiler('c').has_header('sys' / 'mman.h')) +conf.set('HAVE_SYS_ENDIAN_H', meson.get_compiler('c').has_header('sys' / 'endian.h')) +conf.set('HAVE_UNISTD_H', meson.get_compiler('c').has_header('unistd.h')) +conf.set('HAVE_ENDIAN_H', meson.get_compiler('c').has_header('endian.h')) + +conf.set('HAVE_GETPASS', meson.get_compiler('c').has_function('getpass')) +conf.set('HAVE_GETTIMEOFDAY', meson.get_compiler('c').has_function('gettimeofday')) +conf.set('HAVE_GETLINE', meson.get_compiler('c').has_function('getline')) +conf.set('HAVE_MEMSET_S', meson.get_compiler('c').has_function('memset_s')) +conf.set('HAVE_EXPLICIT_BZERO', meson.get_compiler('c').has_function('explicit_bzero')) +conf.set('HAVE_STRNLEN', meson.get_compiler('c').has_function('strnlen')) +conf.set('HAVE_SIGACTION', meson.get_compiler('c').has_function('sigaction')) +conf.set('HAVE_BUILTIN_OVERFLOW', meson.get_compiler('c').has_function('__builtin_uadd_overflow')) + +opensc_features = '' +opensc_features += conf.get('PKCS11_THREAD_LOCKING')? ' locking' : '' +opensc_features += conf.get('ENABLE_OPENPACE')? ' openpace' : '' +opensc_features += conf.get('ENABLE_OPENSSL')? ' openssl' : '' +opensc_features += conf.get('ENABLE_READLINE')? ' readline' : '' +opensc_features += conf.get('ENABLE_ZLIB')? ' zlib' : '' +opensc_features += conf.get('ENABLE_PCSC')? ' pcsc(@0@)'.format(conf.get_unquoted('DEFAULT_PCSC_PROVIDER')) : '' +opensc_features += conf.get('ENABLE_CRYPTOTOKENKIT')? ' cryptotokenkit' : '' +opensc_features += conf.get('ENABLE_OPENCT')? ' openct' : '' +opensc_features += conf.get('ENABLE_CTAPI')? ' ctapi' : '' +conf.set_quoted('OPENSC_FEATURES', opensc_features.strip()) +unset_variable('opensc_features') + +proggit = find_program('git', required: false) +if proggit.found() + description = run_command(proggit, 'describe', check: true).stdout().strip() + if description == '' + description = run_command(proggit, 'describe', '--tags', check: true).stdout().strip() + endif + hash_commit_date = run_command(proggit, 'log', '-1', '--pretty=format:rev: %h, commit-time: %ci', check: true).stdout().strip() + tag_commit = run_command(proggit, 'rev-list', '--tags', '--no-walk', '--max-count=1', check: true).stdout().strip() + revision = run_command(proggit, 'rev-list', tag_commit + '..HEAD', '--count', check: true).stdout().strip() + + conf.set_quoted('OPENSC_SCM_REVISION', 'OpenSC-@0@, @1@'.format(description, hash_commit_date)) + conf.set_quoted('OPENSC_VERSION_REVISION', revision) + + unset_variable('description') + unset_variable('hash_commit_date') + unset_variable('tag_commit') + unset_variable('revision') +else + conf.set_quoted('OPENSC_SCM_REVISION', '') + conf.set_quoted('OPENSC_VERSION_REVISION', '0') +endif + +configure_file( + output: 'config.h', + configuration: conf +) +add_project_arguments('-DHAVE_CONFIG_H', language: all_languages) + +################################################# +# Build targets +################################################# +core_inc = include_directories('.', 'src') + +subdir('src' / 'common') +subdir('src' / 'scconf') +subdir('src' / 'ui') +subdir('src' / 'pkcs15init') +subdir('src' / 'sm') +subdir('src' / 'libopensc') + +if get_option('components').contains('pkcs11') + subdir('src' / 'pkcs11') +endif + +if get_option('components').contains('tools') + subdir('src' / 'tools') +endif + +if get_option('components').contains('minidriver') + subdir('src' / 'minidriver') +endif + +if get_option('components').contains('sm') + subdir('src' / 'smm') +endif + +subdir('etc') + +if get_option('tests') + depcmocka = dependency('cmocka', version: '>= 1.0.1') + + subdir('src' / 'tests') +endif + +################################################# +# Documentation and completion files +################################################# +progxsltproc = find_program('xsltproc', required: false) +if progxsltproc.found() + stylesheets_path = get_option('xsl_stylesheets_path') + if stylesheets_path == '' + foreach path : [ + '/usr/share/xml/docbook/stylesheet/nwalsh', + '/usr/share/xml/docbook/stylesheet/nwalsh/current', + '/opt/local/share/xsl/docbook-xsl', + '/sw/share/xml/xsl/docbook-xsl' ] + + if modfs.exists(path / 'html' / 'docbook.xsl') + stylesheets_path = path + break + endif + endforeach + else + if not modfs.exists(stylesheets_path / 'html' / 'docbook.xsl') + error('The file @0@ does not exist'.format(stylesheets_path / 'html' / 'docbook.xsl')) + endif + endif +endif + +bash_completion_path = get_option('bash_completion_path') +if bash_completion_path == '' + depbashcompletion = dependency('bash-completion', version: '>= 2.0', required: false) + if depbashcompletion.found() + bash_completion_path = depbashcompletion.get_variable('completionsdir') + endif +endif + +subdir('doc' / 'files') + +if get_option('components').contains('tools') + subdir('doc' / 'tools') +endif + +install_data('NEWS', install_dir: absolute_docdir) + +################################################# +# Automated code checks +################################################# +progclangtidy = find_program('clang-tidy', required: false) +if progclangtidy.found() + run_target('clang-tidy', + command: [progclangtidy, + '-p', meson.project_build_root(), + '--config-file', meson.project_source_root() / '.clang-tidy', + meson.project_source_root() / 'src' / 'common' / 'compat_dummy.c', + meson.project_source_root() / 'src' / 'common' / 'compat_getopt.c', + meson.project_source_root() / 'src' / 'common' / 'compat_getopt.h', + meson.project_source_root() / 'src' / 'common' / 'compat_getpass.c', + meson.project_source_root() / 'src' / 'common' / 'compat_getpass.h', + meson.project_source_root() / 'src' / 'common' / 'compat___iob_func.c', + meson.project_source_root() / 'src' / 'common' / 'compat_overflow.c', + meson.project_source_root() / 'src' / 'common' / 'compat_overflow.h', + meson.project_source_root() / 'src' / 'common' / 'compat_report_rangecheckfailure.c', + meson.project_source_root() / 'src' / 'common' / 'compat_strlcat.c', + meson.project_source_root() / 'src' / 'common' / 'compat_strlcat.h', + meson.project_source_root() / 'src' / 'common' / 'compat_strlcpy.c', + meson.project_source_root() / 'src' / 'common' / 'compat_strlcpy.h', + meson.project_source_root() / 'src' / 'common' / 'compat_strnlen.c', + meson.project_source_root() / 'src' / 'common' / 'compat_strnlen.h', + meson.project_source_root() / 'src' / 'common' / 'constant-time.h', + meson.project_source_root() / 'src' / 'common' / 'libpkcs11.c', + meson.project_source_root() / 'src' / 'common' / 'libscdl.c', + meson.project_source_root() / 'src' / 'common' / 'simclist.c', + meson.project_source_root() / 'src' / 'common' / 'simclist.h', + + meson.project_source_root() / 'src' / 'libopensc' / 'apdu.c', + meson.project_source_root() / 'src' / 'libopensc' / 'asn1.c', + meson.project_source_root() / 'src' / 'libopensc' / 'aux-data.c', + meson.project_source_root() / 'src' / 'libopensc' / 'base64.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-asepcos.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-atrust-acos.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-authentic.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-belpic.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-cac1.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-cac.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-cac-common.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-cardos.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-coolkey.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-default.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-dtrust.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-edo.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-entersafe.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-eoi.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-epass2003.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-esteid2018.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-flex.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-gemsafeV1.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-iasecc.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-idprime.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-isoApplet.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-itacns.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-jpki.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-masktech.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-mcrd.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-muscle.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-myeid.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-npa.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-nqApplet.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-oberthur.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-rtecp.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-rutoken.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-sc-hsm.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-setcos.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-skeid.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-starcos.c', + meson.project_source_root() / 'src' / 'libopensc' / 'card-tcos.c', + meson.project_source_root() / 'src' / 'libopensc' / 'compression.c', + meson.project_source_root() / 'src' / 'libopensc' / 'ctbcs.c', + meson.project_source_root() / 'src' / 'libopensc' / 'ctx.c', + meson.project_source_root() / 'src' / 'libopensc' / 'cwa14890.c', + meson.project_source_root() / 'src' / 'libopensc' / 'cwa-dnie.c', + meson.project_source_root() / 'src' / 'libopensc' / 'dir.c', + meson.project_source_root() / 'src' / 'libopensc' / 'ef-atr.c', + meson.project_source_root() / 'src' / 'libopensc' / 'ef-gdo.c', + meson.project_source_root() / 'src' / 'libopensc' / 'errors.c', + meson.project_source_root() / 'src' / 'libopensc' / 'gp.c', + meson.project_source_root() / 'src' / 'libopensc' / 'iasecc-sdo.c', + meson.project_source_root() / 'src' / 'libopensc' / 'iasecc-sm.c', + meson.project_source_root() / 'src' / 'libopensc' / 'iso7816.c', + meson.project_source_root() / 'src' / 'libopensc' / 'muscle.c', + meson.project_source_root() / 'src' / 'libopensc' / 'muscle-filesystem.c', + meson.project_source_root() / 'src' / 'libopensc' / 'padding.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-actalis.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-algo.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-atrust-acos.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-cac.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-cache.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-cardos.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-cert.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-coolkey.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-data.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-din-66291.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-dnie.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-emulator-filter.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-esinit.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-esteid2018.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-gids.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-iasecc.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-idprime.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-itacns.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-jpki.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-nqApplet.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-oberthur.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-openpgp.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-pin.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-prkey.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-pteid.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-pubkey.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-sc-hsm.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-sec.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-skeid.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-skey.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-starcos-esign.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-syn.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-tccardos.c', + meson.project_source_root() / 'src' / 'libopensc' / 'pkcs15-tcos.c', + meson.project_source_root() / 'src' / 'libopensc' / 'reader-ctapi.c', + meson.project_source_root() / 'src' / 'libopensc' / 'reader-openct.c', + meson.project_source_root() / 'src' / 'libopensc' / 'reader-pcsc.c', + meson.project_source_root() / 'src' / 'libopensc' / 'reader-tr03119.c', + meson.project_source_root() / 'src' / 'libopensc' / 'sc.c', + meson.project_source_root() / 'src' / 'libopensc' / 'sec.c', + meson.project_source_root() / 'src' / 'libopensc' / 'simpletlv.c', + meson.project_source_root() / 'src' / 'libopensc' / 'sm.c', + + meson.project_source_root() / 'src' / 'pkcs11' / 'debug.c', + meson.project_source_root() / 'src' / 'pkcs11' / 'framework-pkcs15.c', + meson.project_source_root() / 'src' / 'pkcs11' / 'framework-pkcs15init.c', + meson.project_source_root() / 'src' / 'pkcs11' / 'mechanism.c', + meson.project_source_root() / 'src' / 'pkcs11' / 'openssl.c', + meson.project_source_root() / 'src' / 'pkcs11' / 'pkcs11-global.c', + meson.project_source_root() / 'src' / 'pkcs11' / 'pkcs11-object.c', + meson.project_source_root() / 'src' / 'pkcs11' / 'pkcs11-session.c', + meson.project_source_root() / 'src' / 'pkcs11' / 'slot.c', + ] + ) +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000000..81da042907 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,26 @@ +option('components', type: 'array', choices: ['pkcs11', 'tools', 'minidriver', 'sm'], value: ['pkcs11', 'tools']) + +option('driver', type: 'combo', choices: ['pcsc', 'cryptotokenkit', 'openct', 'ctapi'], value: 'pcsc', description: 'A card reader API that OpenSC will use') + +option('openpace', type: 'feature', value: 'auto', description: 'Use OpenPACE') +option('openssl', type: 'feature', value: 'auto', description: 'Use OpenSSL') +option('readline', type: 'feature', value: 'auto', description: 'Use readline') +option('zlib', type: 'feature', value: 'auto', description: 'Use zlib') +option('dnie_ui', type: 'feature', value: 'auto', description: 'Enable to request DNIe user pin with an external program') + +option('openssl-secure-malloc', type: 'integer', min: 0, value: 0, description: 'Size of OpenSSL secure memory in bytes (must be a power of 2)') + +option('notify', type: 'boolean', value: true, description: 'Notification support') +option('thread_locking', type: 'boolean', value: true, description: 'Serialize threads in PKCS#11 API') +option('piv_sm', type: 'boolean', value: true, description: 'Enable secure messages in PIV card driver') +option('autostart', type: 'boolean', value: false, description: 'Launch "pkcs11-register" on user login') + +option('doc', type: 'boolean', value: true, description: 'Install documentation') +option('man', type: 'boolean', value: true, description: 'Install manual pages') +option('bash_completion', type: 'boolean', value: true, description: 'Install bash completion scripts') + +option('xsl_stylesheets_path', type: 'string', value: '') +option('bash_completion_path', type: 'string', value: '') + +option('tests', type: 'boolean', value: false, description: 'Build tests') +option('fuzzing_libs', type: 'string', value: '', description: 'Additional link argument for fuzzing tests') diff --git a/src/common/meson.build b/src/common/meson.build new file mode 100644 index 0000000000..9586df2e74 --- /dev/null +++ b/src/common/meson.build @@ -0,0 +1,29 @@ +libcompat = static_library('compat', + include_directories: core_inc, + sources: files( + 'compat_dummy.c', + 'compat_getopt.c', + 'compat_getopt_main.c', + 'compat_getpass.c', + 'compat___iob_func.c', + 'compat_overflow.c', + 'compat_report_rangecheckfailure.c', + 'compat_strlcat.c', + 'compat_strlcpy.c', + 'compat_strnlen.c', + 'simclist.c' + ) +) + +libscdl = static_library('scdl', + include_directories: core_inc, + sources: files('libscdl.c'), + dependencies: depdl +) + +libpkcs11_common = static_library('pkcs11', + include_directories: core_inc, + sources: files('libpkcs11.c'), + link_with: libscdl +) + diff --git a/src/libopensc/apdu.c b/src/libopensc/apdu.c index 82e55f7a8b..2fb076df02 100644 --- a/src/libopensc/apdu.c +++ b/src/libopensc/apdu.c @@ -563,7 +563,7 @@ int sc_transmit_apdu(sc_card_t *card, sc_apdu_t *apdu) return r; } -#if ENABLE_SM +#ifdef ENABLE_SM if (card->sm_ctx.sm_mode == SM_MODE_TRANSMIT && (apdu->flags & SC_APDU_FLAGS_CHAINING) != 0 && (apdu->flags & SC_APDU_FLAGS_SM_CHAINING) != 0) { diff --git a/src/libopensc/card-iasecc.c b/src/libopensc/card-iasecc.c index 4ecadc8bfb..e241dec2e7 100644 --- a/src/libopensc/card-iasecc.c +++ b/src/libopensc/card-iasecc.c @@ -792,7 +792,7 @@ iasecc_erase_binary(struct sc_card *card, unsigned int offs, size_t count, unsig } -#if ENABLE_SM +#ifdef ENABLE_SM static int _iasecc_sm_read_binary(struct sc_card *card, unsigned int offs, unsigned char *buff, size_t count) diff --git a/src/libopensc/iso7816.c b/src/libopensc/iso7816.c index 2fea840785..494bc52014 100644 --- a/src/libopensc/iso7816.c +++ b/src/libopensc/iso7816.c @@ -1398,7 +1398,7 @@ static int iso7816_get_data(struct sc_card *card, unsigned int tag, u8 *buf, si static int iso7816_init(struct sc_card *card) { -#if ENABLE_SM +#ifdef ENABLE_SM memset(&card->sm_ctx, 0, sizeof card->sm_ctx); #endif return SC_SUCCESS; diff --git a/src/libopensc/meson.build b/src/libopensc/meson.build new file mode 100644 index 0000000000..15cf800b0e --- /dev/null +++ b/src/libopensc/meson.build @@ -0,0 +1,154 @@ +libopensc_sources = files( + 'apdu.c', + 'asn1.c', + 'aux-data.c', + 'base64.c', + 'card-asepcos.c', + 'card-atrust-acos.c', + 'card-authentic.c', + 'card-belpic.c', + 'card.c', + 'card-cac1.c', + 'card-cac.c', + 'card-cac-common.c', + 'card-cardos.c', + 'card-coolkey.c', + 'card-default.c', + 'card-dnie.c', + 'card-dtrust.c', + 'card-edo.c', + 'card-entersafe.c', + 'card-eoi.c', + 'card-epass2003.c', + 'card-esteid2018.c', + 'card-flex.c', + 'card-gemsafeV1.c', + 'card-gids.c', + 'card-iasecc.c', + 'card-idprime.c', + 'card-isoApplet.c', + 'card-itacns.c', + 'card-jpki.c', + 'card-masktech.c', + 'card-mcrd.c', + 'card-muscle.c', + 'card-myeid.c', + 'card-npa.c', + 'card-nqApplet.c', + 'card-oberthur.c', + 'card-openpgp.c', + 'card-piv.c', + 'card-rtecp.c', + 'card-rutoken.c', + 'card-sc-hsm.c', + 'card-setcos.c', + 'card-skeid.c', + 'card-starcos.c', + 'card-tcos.c', + 'compression.c', + 'ctbcs.c', + 'ctx.c', + 'cwa14890.c', + 'cwa-dnie.c', + 'dir.c', + 'ef-atr.c', + 'ef-gdo.c', + 'errors.c', + 'gp.c', + 'iasecc-sdo.c', + 'iasecc-sm.c', + 'iso7816.c', + 'log.c', + 'muscle.c', + 'muscle-filesystem.c', + 'padding.c', + 'pkcs15-actalis.c', + 'pkcs15-algo.c', + 'pkcs15-atrust-acos.c', + 'pkcs15.c', + 'pkcs15-cac.c', + 'pkcs15-cache.c', + 'pkcs15-cardos.c', + 'pkcs15-cert.c', + 'pkcs15-coolkey.c', + 'pkcs15-data.c', + 'pkcs15-din-66291.c', + 'pkcs15-dnie.c', + 'pkcs15-emulator-filter.c', + 'pkcs15-eoi.c', + 'pkcs15-esinit.c', + 'pkcs15-esteid2018.c', + 'pkcs15-gemsafeV1.c', + 'pkcs15-gids.c', + 'pkcs15-iasecc.c', + 'pkcs15-idprime.c', + 'pkcs15-itacns.c', + 'pkcs15-jpki.c', + 'pkcs15-nqApplet.c', + 'pkcs15-oberthur.c', + 'pkcs15-openpgp.c', + 'pkcs15-pin.c', + 'pkcs15-piv.c', + 'pkcs15-prkey.c', + 'pkcs15-pteid.c', + 'pkcs15-pubkey.c', + 'pkcs15-sc-hsm.c', + 'pkcs15-sec.c', + 'pkcs15-skeid.c', + 'pkcs15-skey.c', + 'pkcs15-starcert.c', + 'pkcs15-starcos-esign.c', + 'pkcs15-syn.c', + 'pkcs15-tccardos.c', + 'pkcs15-tcos.c', + 'reader-tr03119.c', + 'sc.c', + 'sec.c', + 'simpletlv.c', + 'sm.c' +) + +libopensc_libraries = [ + libcompat, + libscdl, + libscconf, + libstrings, + libnotify, + libpkcs15init, + libsmeac, + libsmiso +] + +libopensc_dependencies = [ + depopenpace, + depopenssl, + depzlib +] + +if get_option('driver') == 'pcsc' + libopensc_sources += files('reader-pcsc.c') + libopensc_dependencies += deppcsclite + +elif get_option('driver') == 'crypttokenkit' + libopensc_sources += files('reader-cryptotokenkit.m') + libopensc_dependencies += depcryptotokenkit + +elif get_option('driver') == 'openct' + libopensc_sources += files('reader-openct.c') + libopensc_dependencies += depopenct + +elif get_option('driver') == 'ctapi' + libopensc_sources += files('reader-ctapi.c') + +else + error('The option "driver" has unknown value') +endif + +libopensc = library('opensc', + version: '11.0.2', + include_directories: core_inc, + sources: libopensc_sources, + link_with: libopensc_libraries, + dependencies: libopensc_dependencies, + install: true +) diff --git a/src/libopensc/sc.c b/src/libopensc/sc.c index 7c9e0d25ed..ec7a120fd9 100644 --- a/src/libopensc/sc.c +++ b/src/libopensc/sc.c @@ -951,11 +951,11 @@ void sc_mem_clear(void *ptr, size_t len) if (len > 0) { #ifdef HAVE_MEMSET_S memset_s(ptr, len, 0, len); -#elif _WIN32 +#elif defined(_WIN32) SecureZeroMemory(ptr, len); -#elif HAVE_EXPLICIT_BZERO +#elif defined(HAVE_EXPLICIT_BZERO) explicit_bzero(ptr, len); -#elif ENABLE_OPENSSL +#elif defined(ENABLE_OPENSSL) OPENSSL_cleanse(ptr, len); #else memset(ptr, 0, len); diff --git a/src/minidriver/meson.build b/src/minidriver/meson.build new file mode 100644 index 0000000000..4807eeab02 --- /dev/null +++ b/src/minidriver/meson.build @@ -0,0 +1,28 @@ +libminidriver = library('opensc-minidriver', + include_directories: core_inc, + sources: files('minidriver.c'), + link_with: [ + libcompat, + libnotify, + libopensc, + libpkcs15init, + libstrings + ], + dependencies: [ + depopenpace, + depopenssl + ], + install: true +) + +configure_file( + configuration: { + 'OPENSC_VERSION_MAJOR': conf.get('OPENSC_VERSION_MAJOR'), + 'OPENSC_VERSION_MINOR': conf.get('OPENSC_VERSION_MINOR'), + 'OPENSC_VERSION_FIX': conf.get('OPENSC_VERSION_FIX') + }, + input: 'opensc-minidriver.inf.in', + output: 'opensc-minidriver.inf', + install: true, + install_dir: absolute_pkgdir +) diff --git a/src/pkcs11/meson.build b/src/pkcs11/meson.build new file mode 100644 index 0000000000..e1ef0a0e8c --- /dev/null +++ b/src/pkcs11/meson.build @@ -0,0 +1,103 @@ +libpkcs11_sources = files( + 'debug.c', + 'framework-pkcs15.c', + 'framework-pkcs15init.c', + 'mechanism.c', + 'misc.c', + 'openssl.c', + 'pkcs11-display.c', + 'pkcs11-global.c', + 'pkcs11-object.c', + 'pkcs11-session.c', + 'slot.c' +) + +libpkcs11_libraries = [ + libnotify, + libopensc +] + +libpkcs11_dependencies = [ + depopenpace, + depopenssl, + depthreads +] + +libpkcs11spy_sources = files( + 'pkcs11-display.c', + 'pkcs11-spy.c' +) + +libpkcs11spy_libraries = [ + libpkcs11_common +] + +libpkcs11spy_dependencies = [ + depopenssl, + depthreads +] + +if depp11kit.found() + libpkcs11 = shared_library('opensc-pkcs11', + name_prefix: '', + include_directories: core_inc, + sources: libpkcs11_sources, + link_with: libpkcs11_libraries, + dependencies: libpkcs11_dependencies, + install: true, + install_dir: p11kit_modules_path + ) + + libpkcs11spy = shared_library('pkcs11-spy', + name_prefix: '', + include_directories: core_inc, + sources: libpkcs11spy_sources, + link_with: libpkcs11spy_libraries, + dependencies: libpkcs11spy_dependencies, + install: true, + install_dir: p11kit_modules_path + ) + + configure_file( + configuration: {'EXTENSION': extension_of_libraries}, + input: 'opensc.module.in', + output: 'opensc.module', + install: true, + install_dir: p11kit_configs_path + ) + + install_symlink('onepin-opensc-pkcs11.' + extension_of_libraries, + install_dir: p11kit_modules_path, + pointing_to: 'opensc-pkcs11.' + extension_of_libraries + ) +else + libpkcs11 = library('opensc-pkcs11', + include_directories: core_inc, + sources: libpkcs11_sources, + link_with: libpkcs11_libraries, + dependencies: libpkcs11_dependencies, + install: true + ) + + libpkcs11spy = library('pkcs11-spy', + include_directories: core_inc, + sources: libpkcs11spy_sources, + link_with: libpkcs11spy_libraries, + dependencies: libpkcs11spy_dependencies, + install: true + ) + + modpkgconfig.generate( + libpkcs11, + name: 'OpenSC smartcard framework', + version: meson.project_version(), + description: 'OpenSC PKCS#11 module', + url: 'https://github.com/OpenSC/OpenSC', + filebase: 'opensc-pkcs11' + ) + + install_symlink(prefix_of_libraries + 'onepin-opensc-pkcs11.' + extension_of_libraries, + install_dir: get_option('libdir'), + pointing_to: prefix_of_libraries + 'opensc-pkcs11.' + extension_of_libraries + ) +endif diff --git a/src/pkcs11/opensc.module.in b/src/pkcs11/opensc.module.in new file mode 100644 index 0000000000..c7b0f3bbf9 --- /dev/null +++ b/src/pkcs11/opensc.module.in @@ -0,0 +1 @@ +module: opensc-pkcs11.@EXTENSION@ diff --git a/src/pkcs11/pkcs11-global.c b/src/pkcs11/pkcs11-global.c index 65fcee73c9..dd42cbea9b 100644 --- a/src/pkcs11/pkcs11-global.c +++ b/src/pkcs11/pkcs11-global.c @@ -587,7 +587,7 @@ CK_RV C_GetSlotList(CK_BBOOL tokenPresent, /* only slots with token prese static sc_timestamp_t get_current_time(void) { -#if HAVE_GETTIMEOFDAY +#ifdef HAVE_GETTIMEOFDAY struct timeval tv; struct timezone tz; sc_timestamp_t curr; diff --git a/src/pkcs15init/meson.build b/src/pkcs15init/meson.build new file mode 100644 index 0000000000..87595196cb --- /dev/null +++ b/src/pkcs15init/meson.build @@ -0,0 +1,58 @@ +libpkcs15init = static_library('pkcs15init', + include_directories: core_inc, + sources: files( + 'pkcs15-asepcos.c', + 'pkcs15-authentic.c', + 'pkcs15-cardos.c', + 'pkcs15-cflex.c', + 'pkcs15-entersafe.c', + 'pkcs15-epass2003.c', + 'pkcs15-gids.c', + 'pkcs15-iasecc.c', + 'pkcs15-isoApplet.c', + 'pkcs15-lib.c', + 'pkcs15-muscle.c', + 'pkcs15-myeid.c', + 'pkcs15-oberthur-awp.c', + 'pkcs15-oberthur.c', + 'pkcs15-openpgp.c', + 'pkcs15-rtecp.c', + 'pkcs15-rutoken.c', + 'pkcs15-sc-hsm.c', + 'pkcs15-setcos.c', + 'pkcs15-starcos.c', + 'profile.c' + ), + dependencies: depopenssl +) + +install_data( + 'asepcos.profile', + 'authentic.profile', + 'cardos.profile', + 'cyberflex.profile', + 'entersafe.profile', + 'epass2003.profile', + 'flex.profile', + 'gids.profile', + 'ias_adele_admin1.profile', + 'ias_adele_admin2.profile', + 'ias_adele_common.profile', + 'iasecc_admin_eid.profile', + 'iasecc_generic_oberthur.profile', + 'iasecc_generic_pki.profile', + 'iasecc.profile', + 'isoApplet.profile', + 'muscle.profile', + 'myeid.profile', + 'oberthur.profile', + 'openpgp.profile', + 'pkcs15.profile', + 'rutoken_ecp.profile', + 'rutoken_lite.profile', + 'rutoken.profile', + 'sc-hsm.profile', + 'setcos.profile', + 'starcos.profile', + install_dir: conf.get_unquoted('SC_PKCS15_PROFILE_DIRECTORY') +) diff --git a/src/scconf/meson.build b/src/scconf/meson.build new file mode 100644 index 0000000000..150cefe63a --- /dev/null +++ b/src/scconf/meson.build @@ -0,0 +1,9 @@ +libscconf = static_library('scconf', + include_directories: core_inc, + sources: files( + 'parse.c', + 'scconf.c', + 'sclex.c', + 'write.c' + ) +) diff --git a/src/sm/meson.build b/src/sm/meson.build new file mode 100644 index 0000000000..753c389091 --- /dev/null +++ b/src/sm/meson.build @@ -0,0 +1,22 @@ +libsmiso = static_library('smiso', + include_directories: core_inc, + sources: files('sm-iso.c') +) + +libsmeac = static_library('smeac', + include_directories: core_inc, + sources: files('sm-eac.c'), + link_with: libsmiso, + dependencies: [ + depopenpace, + depopenssl + ] +) + +if conf.get('ENABLE_OPENSSL') + libsm = static_library('sm', + include_directories: core_inc, + sources: files('sm-common.c'), + dependencies: depopenssl + ) +endif diff --git a/src/smm/meson.build b/src/smm/meson.build new file mode 100644 index 0000000000..22aed43720 --- /dev/null +++ b/src/smm/meson.build @@ -0,0 +1,28 @@ +if conf.get('ENABLE_OPENSSL') + libsmm = library('smm-local', + version: '11.0.2', + include_directories: core_inc, + sources: files( + 'sm-card-authentic.c', + 'sm-card-iasecc.c', + 'sm-cwa14890.c', + 'sm-global-platform.c', + 'smm-local.c' + ), + link_with: [ + libopensc, + libsm + ], + dependencies: depopenssl, + install: true + ) + + modpkgconfig.generate( + libsmm, + name: 'OpenSC smartcard framework', + version: meson.project_version(), + description: 'OpenSC Secure Messaging module', + url: 'https://github.com/OpenSC/OpenSC', + filebase: 'opensc-smm' + ) +endif diff --git a/src/tests/meson.build b/src/tests/meson.build new file mode 100644 index 0000000000..1ffc443dda --- /dev/null +++ b/src/tests/meson.build @@ -0,0 +1,452 @@ +libtest = static_library('common', + include_directories: core_inc, + sources: files('sc-test.c'), + link_with: libopensc +) + +executable('base64', + include_directories: core_inc, + sources: files('base64.c'), + link_with: [ + libopensc, + libtest + ] +) + +executable('lottery', + include_directories: core_inc, + sources: files('lottery.c'), + link_with: [ + libopensc, + libtest + ] +) + +executable('p15dump', + include_directories: core_inc, + sources: files( + 'p15dump.c', + 'print.c' + ), + link_with: [ + libopensc, + libtest + ] +) + +executable('pintest', + include_directories: core_inc, + sources: files( + 'pintest.c', + 'print.c' + ), + link_with: [ + libcompat, + libopensc, + libtest + ] +) + +executable('prngtest', + include_directories: core_inc, + sources: files('prngtest.c'), + link_with: [ + libopensc, + libtest + ] +) + +################################################# +# Unit tests +################################################# +ut_asn1 = executable('asn1', + include_directories: core_inc, + sources: files('unittests' / 'asn1.c'), + link_with: [ + libopensc, + libopensc_libraries + ], + dependencies: [ + depcmocka, + libopensc_dependencies + ] +) +test('asn1', ut_asn1) + +ut_cachedir = executable('cachedir', + include_directories: core_inc, + sources: files('unittests' / 'cachedir.c'), + link_with: libopensc, + dependencies: depcmocka +) +test('cachedir', ut_cachedir) + +ut_check_macro_reference_loop = executable('check_macro_reference_loop', + include_directories: core_inc, + sources: files('unittests' / 'check_macro_reference_loop.c'), + link_with: [ + libopensc, + libopensc_libraries + ], + dependencies: [ + depcmocka, + libopensc_dependencies + ] +) +test('check_macro_reference_loop', ut_check_macro_reference_loop) + +ut_decode_ecdsa_signature = executable('decode_ecdsa_signature', + include_directories: core_inc, + sources: files('unittests' / 'decode_ecdsa_signature.c'), + link_with: [ + libopensc, + libopensc_libraries + ], + dependencies: [ + depcmocka, + libopensc_dependencies + ] +) +test('decode_ecdsa_signature', ut_decode_ecdsa_signature) + +ut_hextobin = executable('hextobin', + include_directories: core_inc, + sources: files('unittests' / 'hextobin.c'), + link_with: libopensc, + dependencies: depcmocka +) +test('hextobin', ut_hextobin) + +ut_openpgp_tool = executable('openpgp-tool', + include_directories: core_inc, + sources: files( + 'unittests' / 'openpgp-tool.c', + '../tools/openpgp-tool-helpers.c' + ), + link_with: [ + libopensc, + libopensc_libraries + ], + dependencies: [ + depcmocka, + libopensc_dependencies + ] +) +test('openpgp-tool', ut_openpgp_tool) + +ut_pkcs15filter = executable('pkcs15filter', + include_directories: core_inc, + sources: files('unittests' / 'pkcs15-emulator-filter.c'), + link_with: [ + libopensc, + libopensc_libraries + ], + dependencies: [ + depcmocka, + libopensc_dependencies + ] +) +test('pkcs15filter', ut_pkcs15filter) + +ut_simpletlv = executable('simpletlv', + include_directories: core_inc, + sources: files('unittests' / 'simpletlv.c'), + link_with: [ + libopensc, + libopensc_libraries + ], + dependencies: [ + depcmocka, + libopensc_dependencies + ] +) +test('simpletlv', ut_simpletlv) + +ut_strip_pkcs1_2_padding = executable('strip_pkcs1_2_padding', + include_directories: core_inc, + sources: files('unittests' / 'strip_pkcs1_2_padding.c'), + link_with: [ + libopensc, + libopensc_libraries + ], + dependencies: [ + depcmocka, + libopensc_dependencies + ] +) +test('strip_pkcs1_2_padding', ut_strip_pkcs1_2_padding) + +if conf.get('ENABLE_OPENSSL') + ut_sm = executable('sm', + include_directories: core_inc, + sources: files('unittests' / 'sm.c'), + link_with: [ + libopensc, + libopensc_libraries, + libsm + ], + dependencies: [ + depcmocka, + libopensc_dependencies + ] + ) + test('sm', ut_sm) +endif + +if conf.get('ENABLE_ZLIB') + ut_compression = executable('compression', + include_directories: core_inc, + sources: files('unittests' / 'compression.c'), + link_with: [ + libopensc, + libopensc_libraries + ], + dependencies: [ + depcmocka, + libopensc_dependencies + ] + ) + test('compression', ut_compression) +endif + +################################################# +# p11test +################################################# +if conf.get('ENABLE_OPENSSL') + executable('p11test', + include_directories: core_inc, + sources: files( + 'p11test' / 'p11test.c', + 'p11test' / 'p11test_case_common.c', + 'p11test' / 'p11test_case_ec_derive.c', + 'p11test' / 'p11test_case_ec_sign.c', + 'p11test' / 'p11test_case_interface.c', + 'p11test' / 'p11test_case_mechs.c', + 'p11test' / 'p11test_case_multipart.c', + 'p11test' / 'p11test_case_pss_oaep.c', + 'p11test' / 'p11test_case_readonly.c', + 'p11test' / 'p11test_case_secret.c', + 'p11test' / 'p11test_case_usage.c', + 'p11test' / 'p11test_case_wait.c', + 'p11test' / 'p11test_case_wrap.c', + 'p11test' / 'p11test_helpers.c', + 'p11test' / 'p11test_loader.c', + ), + dependencies: [ + depcmocka, + depopenssl + ] + ) +endif + +################################################# +# Fuzzing tests +################################################# +fuzzer_main = get_option('fuzzing_libs') == ''? files('fuzzing' / 'fuzzer.c') : '' + +executable('fuzz_asn1_print', + include_directories: core_inc, + sources: [ + files('fuzzing' / 'fuzz_asn1_print.c'), + fuzzer_main + ], + link_with: [ + libopensc, + libopensc_libraries + ], + link_args: get_option('fuzzing_libs'), + dependencies: libopensc_dependencies +) + +executable('fuzz_asn1_sig_value', + include_directories: core_inc, + sources: [ + files('fuzzing' / 'fuzz_asn1_sig_value.c'), + fuzzer_main + ], + link_with: [ + libopensc, + libopensc_libraries + ], + link_args: get_option('fuzzing_libs'), + dependencies: libopensc_dependencies +) + +executable('fuzz_card', + include_directories: core_inc, + sources: [ + files( + 'fuzzing' / 'fuzz_card.c', + 'fuzzing' / 'fuzzer_reader.c' + ), + fuzzer_main + ], + link_with: [ + libopensc, + libopensc_libraries + ], + link_args: get_option('fuzzing_libs'), + dependencies: libopensc_dependencies +) + +executable('fuzz_pkcs15_crypt', + include_directories: core_inc, + sources: [ + files( + 'fuzzing' / 'fuzz_pkcs15_crypt.c', + 'fuzzing' / 'fuzzer_reader.c', + 'fuzzing' / 'fuzzer_tool.c' + ), + fuzzer_main + ], + link_with: [ + libopensc, + libopensc_libraries, + libutil + ], + link_args: get_option('fuzzing_libs'), + dependencies: libopensc_dependencies +) + +executable('fuzz_pkcs15_decode', + include_directories: core_inc, + sources: [ + files( + 'fuzzing' / 'fuzz_pkcs15_decode.c', + 'fuzzing' / 'fuzzer_reader.c' + ), + fuzzer_main + ], + link_with: [ + libopensc, + libopensc_libraries + ], + link_args: get_option('fuzzing_libs'), + dependencies: libopensc_dependencies +) + +executable('fuzz_pkcs15_encode', + include_directories: core_inc, + sources: [ + files( + 'fuzzing' / 'fuzz_pkcs15_encode.c', + 'fuzzing' / 'fuzzer_reader.c' + ), + fuzzer_main + ], + link_with: [ + libopensc, + libopensc_libraries + ], + link_args: get_option('fuzzing_libs'), + dependencies: libopensc_dependencies +) + +executable('fuzz_pkcs15_reader', + include_directories: core_inc, + sources: [ + files( + 'fuzzing' / 'fuzz_pkcs15_reader.c', + 'fuzzing' / 'fuzzer_reader.c' + ), + fuzzer_main + ], + link_with: [ + libopensc, + libopensc_libraries + ], + link_args: get_option('fuzzing_libs'), + dependencies: libopensc_dependencies +) + +executable('fuzz_pkcs15_tool', + include_directories: core_inc, + sources: [ + files( + 'fuzzing' / 'fuzz_pkcs15_tool.c', + 'fuzzing' / 'fuzzer_reader.c', + 'fuzzing' / 'fuzzer_tool.c', + '..' / 'pkcs11' / 'pkcs11-display.c' + ), + fuzzer_main + ], + link_with: [ + libopensc, + libopensc_libraries, + libutil + ], + link_args: get_option('fuzzing_libs'), + dependencies: libopensc_dependencies +) + +executable('fuzz_pkcs15init', + include_directories: core_inc, + sources: [ + files( + 'fuzzing' / 'fuzz_pkcs15init.c', + 'fuzzing' / 'fuzzer_reader.c' + ), + fuzzer_main + ], + link_with: [ + libopensc, + libopensc_libraries + ], + link_args: get_option('fuzzing_libs'), + dependencies: libopensc_dependencies +) + +executable('fuzz_scconf_parse_string', + include_directories: core_inc, + sources: [ + files('fuzzing' / 'fuzz_scconf_parse_string.c'), + fuzzer_main + ], + link_with: [ + libopensc, + libopensc_libraries + ], + link_args: get_option('fuzzing_libs'), + dependencies: libopensc_dependencies +) + +if conf.get('ENABLE_OPENSSL') + executable('fuzz_piv_tool', + include_directories: core_inc, + sources: [ + files( + 'fuzzing' / 'fuzz_piv_tool.c', + 'fuzzing' / 'fuzzer_reader.c', + 'fuzzing' / 'fuzzer_tool.c' + ), + fuzzer_main + ], + link_with: [ + libopensc, + libopensc_libraries, + libutil + ], + link_args: get_option('fuzzing_libs'), + dependencies: libopensc_dependencies + ) +endif + +if get_option('components').contains('pkcs11') + executable('fuzz_pkcs11', + include_directories: core_inc, + sources: [ + files( + 'fuzzing' / 'fuzz_pkcs11.c', + 'fuzzing' / 'fuzzer_reader.c', + 'fuzzing' / 'fuzzer_tool.c' + ), + fuzzer_main + ], + link_with: [ + libpkcs11, + libpkcs11_libraries + ], + link_args: get_option('fuzzing_libs'), + dependencies: libpkcs11_dependencies + ) +endif diff --git a/src/tests/p11test/p11test_case_common.c b/src/tests/p11test/p11test_case_common.c index 6c4e63976f..81c4926bb4 100644 --- a/src/tests/p11test/p11test_case_common.c +++ b/src/tests/p11test/p11test_case_common.c @@ -20,7 +20,7 @@ */ #include "p11test_case_common.h" -#include "../../libopensc/sc-ossl-compat.h" +#include "libopensc/sc-ossl-compat.h" /* Unsigned long can be up to 16 B long. We print also leading "0x" and we need trailing NULL byte */ #define FLAG_BUFFER_LEN 19 diff --git a/src/tools/meson.build b/src/tools/meson.build new file mode 100644 index 0000000000..dbfba3e52b --- /dev/null +++ b/src/tools/meson.build @@ -0,0 +1,346 @@ +libutil = static_library('util', + include_directories: core_inc, + sources: files( + 'fread_to_eof.c', + 'util.c' + ), + link_with: [ + libcompat, + libnotify, + libopensc + ] +) + +executable('cardos-tool', + include_directories: core_inc, + sources: files('cardos-tool.c'), + link_with: [ + libopensc, + libutil + ], + dependencies: depopenssl, + install: true +) + +executable('dnie-tool', + include_directories: core_inc, + sources: files('dnie-tool.c'), + link_with: [ + libopensc, + libutil + ], + install: true +) + +executable('dtrust-tool', + include_directories: core_inc, + sources: files('dtrust-tool.c'), + link_with: [ + libopensc, + libutil + ], + install: true +) + +executable('egk-tool', + include_directories: core_inc, + sources: files( + 'egk-tool.c', + 'egk-tool-cmdline.c' + ), + link_with: [ + libopensc, + libutil + ], + dependencies: depzlib, + install: true +) + +executable('eidenv', + include_directories: core_inc, + sources: files('eidenv.c'), + link_with: [ + libopensc, + libutil + ], + install: true +) + +executable('goid-tool', + include_directories: core_inc, + sources: files( + 'goid-tool.c', + 'goid-tool-cmdline.c' + ), + link_with: [ + libopensc, + libsmeac, + libutil + ], + dependencies: depopenpace, + install: true +) + +executable('iasecc-tool', + include_directories: core_inc, + sources: files('iasecc-tool.c'), + link_with: [ + libopensc, + libutil + ], + install: true +) + +executable('openpgp-tool', + include_directories: core_inc, + sources: files( + 'openpgp-tool.c', + 'openpgp-tool-helpers.c' + ), + link_with: [ + libcompat, + libopensc, + libutil + ], + install: true +) + +executable('opensc-asn1', + include_directories: core_inc, + sources: files( + 'opensc-asn1.c', + 'opensc-asn1-cmdline.c' + ), + link_with: [ + libopensc, + libutil + ], + install: true +) + +executable('opensc-explorer', + include_directories: core_inc, + sources: files('opensc-explorer.c'), + link_with: [ + libcompat, + libopensc, + libutil + ], + dependencies: depreadline, + install: true +) + +executable('opensc-tool', + include_directories: core_inc, + sources: files('opensc-tool.c'), + link_with: [ + libopensc, + libscconf, + libutil + ], + install: true +) + +executable('pkcs11-register', + include_directories: core_inc, + sources: files( + 'pkcs11-register.c', + 'pkcs11-register-cmdline.c' + ), + link_with: [ + libpkcs11_common, + libutil + ], + install: true +) + +pkcs11tool_libraries = [ + libcompat, + libopensc, + libpkcs11_common, + libutil +] +if conf.get('ENABLE_PKCS11') and not conf.get('HAVE_P11KIT') and not conf.get('ENABLE_SHARED') + pkcs11tool_libraries += libpkcs11 +endif + +executable('pkcs11-tool', + include_directories: core_inc, + sources: files('pkcs11-tool.c'), + link_with: pkcs11tool_libraries, + dependencies: [ + depopenssl, + depthreads + ], + install: true +) + +executable('pkcs15-crypt', + include_directories: core_inc, + sources: files('pkcs15-crypt.c'), + link_with: [ + libcompat, + libopensc, + libutil + ], + dependencies: depopenssl, + install: true +) + +executable('pkcs15-tool', + include_directories: core_inc, + sources: files( + 'pkcs15-tool.c', + '../pkcs11/pkcs11-display.c' + ), + link_with: [ + libopensc, + libutil + ], + dependencies: depopenssl, + install: true +) + +if conf.get('ENABLE_OPENSSL') + executable('cryptoflex-tool', + include_directories: core_inc, + sources: files('cryptoflex-tool.c'), + link_with: [ + libcompat, + libopensc, + libutil + ], + dependencies: depopenssl, + install: true + ) + + executable('gids-tool', + include_directories: core_inc, + sources: files('gids-tool.c'), + link_with: [ + libopensc, + libutil + ], + dependencies: depopenssl, + install: true + ) + + executable('netkey-tool', + include_directories: core_inc, + sources: files('netkey-tool.c'), + link_with: libopensc, + dependencies: depopenssl, + install: true + ) + + executable('piv-tool', + include_directories: core_inc, + sources: files('piv-tool.c'), + link_with: [ + libopensc, + libutil + ], + dependencies: depopenssl, + install: true + ) + + executable('pkcs15-init', + include_directories: core_inc, + sources: files('pkcs15-init.c'), + link_with: [ + libcompat, + libopensc, + libpkcs15init, + libutil + ], + dependencies: depopenssl, + install: true + ) + + executable('sc-hsm-tool', + include_directories: core_inc, + sources: files('sc-hsm-tool.c'), + link_with: [ + libopensc, + libutil + ], + dependencies: depopenssl, + install: true + ) + + executable('westcos-tool', + include_directories: core_inc, + sources: files('westcos-tool.c'), + link_with: [ + libopensc, + libutil + ], + dependencies: depopenssl, + install: true + ) +endif + +if conf.get('ENABLE_OPENSSL') and conf.get('ENABLE_OPENPACE') + executable('npa-tool', + include_directories: core_inc, + sources: files( + 'npa-tool.c', + 'npa-tool-cmdline.c' + ), + link_with: [ + libopensc, + libsmeac, + libutil + ], + dependencies: [ + depopenpace, + depopenssl + ], + install: true + ) +endif + +if conf.get('ENABLE_NOTIFY') + executable('opensc-notify', + include_directories: core_inc, + sources: files( + 'opensc-notify.c', + 'opensc-notify-cmdline.c' + ), + link_with: [ + libopensc, + libnotify + ], + dependencies: depthreads, + install: true + ) + + configure_file( + configuration: {'bindir': absolute_bindir}, + input: 'org.opensc.notify.desktop.in', + output: 'org.opensc.notify.desktop', + install: true, + install_dir: get_option('datadir') / 'applications' + ) +endif + +if get_option('autostart') + configure_file( + configuration: {'bindir': absolute_bindir}, + input: 'pkcs11-register.desktop.in', + output: 'pkcs11-register.desktop', + install: true, + install_dir: get_option('sysconfdir') / 'xdg' / 'autostart' + ) +endif + +executable('sceac-example.c', + include_directories: core_inc, + sources: files('sceac-example.c'), + link_with: [ + libopensc, + libsmeac, + libsmiso + ], + build_by_default: false +) diff --git a/src/tools/npa-tool.c b/src/tools/npa-tool.c index 81a90a749d..b8218485d2 100644 --- a/src/tools/npa-tool.c +++ b/src/tools/npa-tool.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/src/tools/pkcs11-tool.c b/src/tools/pkcs11-tool.c index 5b2abf590c..99032bffbd 100644 --- a/src/tools/pkcs11-tool.c +++ b/src/tools/pkcs11-tool.c @@ -88,9 +88,13 @@ #endif #endif +#ifdef ENABLE_PKCS11 +#ifndef HAVE_P11KIT #ifndef ENABLE_SHARED extern CK_FUNCTION_LIST_3_0 pkcs11_function_list_3_0; #endif +#endif +#endif #if defined(_WIN32) || defined(HAVE_PTHREAD) #define MAX_TEST_THREADS 10 @@ -1168,10 +1172,14 @@ int main(int argc, char * argv[]) opt_module = expanded_val; #endif +#ifdef ENABLE_PKCS11 +#ifndef HAVE_P11KIT #ifndef ENABLE_SHARED if (strcmp(opt_module, DEFAULT_PKCS11_PROVIDER) == 0) p11 = &pkcs11_function_list_3_0; else +#endif +#endif #endif { CK_FUNCTION_LIST_PTR p11_v2 = NULL; diff --git a/src/ui/meson.build b/src/ui/meson.build new file mode 100644 index 0000000000..1762e8bc5b --- /dev/null +++ b/src/ui/meson.build @@ -0,0 +1,10 @@ +libstrings = static_library('strings', + include_directories: core_inc, + sources: files('strings.c') +) + +libnotify = static_library('notify', + include_directories: core_inc, + sources: files('notify.c'), + dependencies: depgio2 +)