Commit Graph

211 Commits

Author SHA1 Message Date
Pierre-Louis Palant b0241eefa1 Integrated virt_CACard in CI jobs (#1757)
Was: "Implement OpenSC CI without HW cards" (https://github.com/OpenSC/OpenSC/pull/1757)
2019-08-20 15:17:14 +02:00
Frank Morgner 8f838bc1e0 fixed passing LIB_FUZZING_ENGINE 2019-08-19 16:44:54 +02:00
Frank Morgner 755ac78a02 added fuzzing with libFuzzer and OSS-Fuzz
makes cmocka detection not required for building tests
2019-07-26 15:23:02 +02:00
Frank Morgner 1423c6bb90 CI: integrate clang-tidy (disabled)
files that have warnings are currently excluded
2019-05-21 19:34:46 +02:00
Raul Metsma 3d22d04113 No need link to libssl
Signed-off-by: Raul Metsma <raul@metsma.ee>
2019-04-25 14:52:43 +02:00
Frank Morgner 6f9b58af72 added pkcs11-register 2019-04-08 11:16:13 +02:00
Frank Morgner f1e9108502 fix cygwin build
fixes https://github.com/OpenSC/OpenSC/issues/607
2019-04-01 12:54:06 +02:00
Frank Morgner fc9277b778 use compat_getopt_long if getopt_long is not available
uses the autoconf way for replacing getopt.h

fixes https://github.com/OpenSC/OpenSC/issues/1527
2019-03-25 14:30:09 +01:00
Frank Morgner 993f6f5cc6 Use opensc-pkcs11.so for static build of pkcs11-tool
Statically link opensc-pkcs11 into pkcs11-tool with --disable-shared
2019-01-30 21:57:59 +01:00
Jakub Jelen 8fb611bb1c Move the test into separate directory
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2018-12-06 09:27:50 +01:00
Frank Morgner 027ccad439 allow specifying the size of OpenSSL secure memory
... and set it for builds where we're linking OpenSSL statically (i.e.
Windows and macOS)

fixes https://github.com/OpenSC/OpenSC/issues/1515
2018-11-13 15:50:17 +01:00
Priit Laes 1f06a76b1a openssl: Bump openssl requirement to 0.9.8 2018-09-14 08:21:40 +02:00
Priit Laes 9fa730bb95 openssl: PKG_CHECK_MODULES can take a list of packages. Use this for openssl 2018-09-14 08:21:40 +02:00
Priit Laes 9d16e6e177 openssl: Use define for openssl minimum version specification 2018-09-14 08:21:40 +02:00
asc 0ab5b92dc5 Allow building tests on Ubuntu 16.04, which has libcmocka 1.0.1 (#1405) 2018-08-30 13:27:36 +02:00
Frank Morgner b5a6f9aa6e prepare 0.19.0 2018-08-27 13:40:20 +02:00
Frank Morgner a0b6643fa7 Use hard coded default SM module (path)
- avoids the need to set this default in opensc.conf
- fixes loading of (unknown) local library
- removes some unused defines from config.h
2018-07-17 14:49:27 +02:00
Frank Morgner 47ee3a3978 added manual page opensc.conf(5)
splits the HTML documentation into files.html and tools.html
2018-07-17 14:49:27 +02:00
Frank Morgner 376de5bd4c make bash completion directory configurable 2018-07-11 21:55:05 +02:00
Jakub Jelen e9314adf4b Testsuite also depends on openssl, use correct variables for linking 2018-07-11 10:48:10 +02:00
Stanislav Brabec b0a20fa7ca Use correct bash-completion path
Recent versions of bash is leaving /etc/bash_completion.d. The correct
directory is specified by pkg-config --variable completionsdir
bash-completion.

Fixes https://github.com/OpenSC/OpenSC/issues/1403
2018-07-04 09:50:07 +02:00
Jakub Jelen f9f3bc3ae0 configure: Check for cmocka header file 2018-06-21 12:48:57 +02:00
Jakub Jelen 3998fffbdc configure: Use correct variables for testsuite 2018-06-21 12:48:57 +02:00
Peter Marschall cedc5a1cf6 configure.ac: remove references to help2man
Now that we have proper DocBook sources for all man pages formerly
generated using help2man, it is not needed anymore.
2018-06-06 22:43:46 +02:00
Peter Marschall 59a7478011 configure.ac: extend AC_INIT
Define macro PRODUCT_URL and use it as additional argument to AC_INIT().
2018-05-21 20:45:04 +02:00
Peter Marschall c57c743ed0 configure.ac: stop including version.m4
Do not blindly override already defined variables or macros with
outdated values by including version.m4

This makes sure the definitions of variables or macros defined earlier
in configure.ac remain intact; e.g. it keeps the macro PRODUCT_BUGREPORT
set to the GitHub URL instead of pointing to a SourceForge mail address.
2018-05-21 20:45:04 +02:00
Jakub Jelen 9858d05589 PKCS#11 testsuite (#1224)
* Initial version of pkcs11 testsuite

* Refactor test cases to several files, clean up awful and unused stuff

* Static mechanism list based on the actual token offer

* Get rid of magic numbers

* Documentation

* License update based on the original project

* Verbose readme

* Cleanup unused code, long lines and method order

* Typo; More verbose errors

* Use fallback mechanisms

* Refactor object allocation and certificate search

* PKCS11SPY mentioned, more TODO

* add SHA mechanisms

* Do not try to Finalize already finalized cryptoki

* Add more flags and mechanisms

* Do not list table for no results

* Logical order of the tests (regression last)

* read ALWAYS_AUTHENTICATE from correct place

* ALWAYS_AUTHENTICATE for decryption

* Test EC key length signature based on the actual key length

* Shorten CKM_ list output, add keygen types detection

* Skip decrypting on non-supported mechanisms

* Fail hard if the C_Login fails

* Reorganize local FLAGS_ constants

* Test RSA Digest mechanisms

* Correct mechanisms naming, typos

* Do not attempt to do signature using empty keys

* CKM_ECDSA_SHA1 support

* Correct type cast when getting attributes

* Report failures from all mechanisms

* Standardize return values, eliminate complete fails, documentation interface

* Wait for slot event test

* Add switch to allow interaction with a card (WaitForSlotEvent)

* At least try to verify using C_Verify, if it fails, fall back to openssl

* Get rid of function_pointers

* Get rid of additional newline

* Share always_authenticate() function between the test cases

* Refactor Encrypt&decrypt test to functions

* Do not overwrite bits if they are not provided by CKA, indentation

* Cleanup and Break to more functions Sign&Verify test

* CKM_RSA_X_509 sign and verify with openssl padding

* More TODO's

* Proper abstracted padding with RSA_X_509 mechanism

* Add ongoing tasks from different TODO list

* Update instructions. Another todo

* Variables naming

* Increase mechanism list size, use different static buffers for flags and mechanism names

* nonstandard mechanism CKM_SHA224_RSA_PKCS supported by some softotkens

* Get rid of loop initial declarations

* Loop initial declaration, typos, strict warnings

* Move the p11test to the new folder to avoid problems with dynamically linked opensc.so

* Update path in README

* Possibility to validate the testsuite agains software tokens

* Add possibility to select slot ID on command-line (when there are more cards present)

* Clean up readme to reflect current options and TODOs

* Do not attempt to use keys without advertised sign&verify bits to avoid false positives

* Get and present more object attributes in readonly test; refactor table

* New test checking if the set of attributes (usage flags) is reasonable

* Test multipart signatures. There is not reasonable mechanism supporting multipart encryption

* Use PKCS#11 encryption if possible (with openssl fallback)

* Identify few more mechanisms (PSS) in the lest

* Resize table to fit new mechanisms

* Remove initial loop declaration from multipart test

* Use pkcs11-tool instead of p11tool form most of the operations (master have most of the features)

* Preparation for machine readable results

* Refactor log variables out of the main context, try to export generic data

* Do not write to non-existing FD if not logging

* Export missing data into the log file in JSON

* Store database in json

* Sanity check

* Avoid uninitialized structure fields using in state structure

* Dump always_authenticate attribute too

* Manual selection of slots with possibility to use slots without tokens

* Do not free before finalizing

* Proper cleanup of message in all cases

* Proper allocation and deallocation of messages

* Sanitize missing cases (memory leaks)

* Suppressions for testing under valgrind

* Better handling message_lengt during sign&verify (avoid invalid access)

* Suppress another PCSC error

* Do not use default PIN. Fail if none specified

* Sanitize initialization. Skip incomplete key pairs

* Add missing newline in errors

* Fix condition for certificate search

* Avoid several calls for attributes of zero length

* Handle if the private key is not present on the card

* Improve memory handling, silent GCC warning of 'unused' variable

* Fail early with missing private key, cleanup the messages

* Use correct padding for encryption

* Cache if the card supports Verify/Encrypt and avoid trying over and over again

* Loosen the condition for the Usage flags

* OpenSSL 1.1.0 compatibility

* Add missing mechanisms

* Do not require certificates on the card and pass valid data for RSA_PKCS mechanisms

* Add missing PIN argument in runtest.sh

* Add OpenSSL < 1.1 comatible bits

* Add SHA2 ECDSA mechanisms handling

* Use public key from PKCS#11 if the certificate is missing (or compare it with certificate)

* Avoid long definitions in OpenSSL compat layer

* In older OpenSSL, the header file is ecdsa.h

* Add missing config.h to apply compat OpenSSL layer

* ASN1_STRING_get0_data() is also new in 1.1.0

* Return back RSA_X_509 mechanism

* Drop bogus CKM_* in the definitions

* Drop CKM_SHA224_RSA_PKCS as it is already in pkcs11.h

* Update documentation

* Use NDEBUG as intended

* typos, cleanup

* Typos, cleanup, update copyright

* Additional check for OpenCryptoki, generate more key types on soft tokens

* Prepare for RSA-PSS and RSA-OAEP

* Use usage&result flags for the tests, gracefully ignore PSS&OAEP

* pkcs11.h: Add missing definitions for PSS

* PSS and OAEP tests

readonly: Typos, reformat

* Working version, memory leak

* Tweak message lengths for OAEP and PSS

* Skip tests that are not aplicable for tokens

* configure.ac: New switch --enable-tests

Do not attempt to build tests if cmocka is not available or
--enable-tests is provided. It makes also more lightweight release
builds out of the box (or with --disable-tests).

* travis: Install cmocka if not available

* Do not build tests on Windows and make dist pass

* Try to install cmocka from apt and from brew

* Do not require sudo (cmocka from apt and brew works)
2018-05-18 12:31:55 +02:00
Frank Morgner b4bc6de81b prepare 0.18.0 2018-04-13 18:43:18 +02:00
Frank Morgner 74bdcad4e8 fixed description of --disable-strict 2018-04-06 12:20:32 +02:00
Igor Castañeda Ferreira 5d5caecfab Fix DNIe UI integration (#1280) 2018-03-09 14:37:38 +01:00
Frank Morgner 3f0d5ce336 opensc-notify: register a desktop menu entry
- fixes showing notifications in gnome-shell via gio2
- removes gdbus interface for notifications
- fixes https://github.com/OpenSC/OpenSC/issues/1186
2017-11-21 13:01:12 +01:00
Frank Morgner 7d0f05b247 removed unused compile options 2017-11-09 12:42:29 +01:00
Frank Morgner 08ca27197a treat warnings as errors 2017-11-09 12:42:29 +01:00
Frank Morgner 04a7075290 fixed compiler warnings 2017-11-09 12:42:29 +01:00
Frank Morgner 498aedd165 Merge remote-tracking branch 'upstream/master' into winui 2017-10-16 15:16:34 +02:00
Frank Morgner 172f320c9a win32: Dedicated md/pkcs11 installation folders
Don't install non-permanent files (md/pkcs11) to system folder anymore.
2017-08-22 23:41:29 +02:00
Frank Morgner 7bc070ac67 win32: Load notification icons from Windows DLLs
fixes showing wrong icons when loaded as PKCS#11 module
2017-08-03 00:19:26 +02:00
Frank Morgner ce3f27ff54 opensc-notify: notify for card events
... manually or in daemon mode

fixes compilation in MinGW/Travis CI
2017-08-02 19:04:09 +02:00
Frank Morgner cd62c6cdf5 Linux: Added support for notifications 2017-08-02 19:02:21 +02:00
Frank Morgner bf828014e5 macOS: Added support for notifications
- adds framework for user defined message strings
- automatically determine the system's language
2017-08-02 19:02:05 +02:00
Frank Morgner 1258aa87a7 fixed library name of smm-local 2017-06-22 10:36:08 +02:00
Frank Morgner 91ed248e6f updated required PCSC-Lite version
Fixes https://github.com/OpenSC/OpenSC/issues/1065
2017-06-15 23:38:57 +02:00
Frank Morgner 3a299eb2bf 0.17.0 version bump 2017-06-13 13:23:53 +02:00
Frank Morgner 74ec7b04ff sc-hsm: Add support for SoC
- eac: allow CA without EF.CardSecurity
- sc-hsm: implemented CA based on document PKI
- sc-hsm: adds receive limit for SoC card
- introduces dedicated card type for SoC card
- md: integrate card's PIN pad capabilities
- installer: added SC-HSM SoC card to registry
- pkcs15-tool: Added support for PIN entry on card
- change/unblock PIN: add support for PIN entry on card
- added OpenPACE to macOS build
- travis-ci: install gengetopt/help2man via brew
- sc-hsm: Cache EF.C_DevAut
- sc-hsm: Prevent unnecessary applet selection and state resets
- sc-hsm: added support for session pin
- sc-hsm: avoid multiple AID selection
- sc-hsm: Use the information from match_card for all subsequent selections of the applet
- sc-hsm: cache optional files as empty files (Decoding the files will reveal that they were not existing prior caching. This avoids selecting the file though we have already tried to cache the file before.)
- use dedicated directory for CVC trust anchors
- appveyor: added OpenPACE to windows build
2017-05-22 16:25:08 +02:00
Frank Morgner 013bdcb264 macOS: added support for access via CryptoTokenKit
Binaries still need to be signed with the com.apple.security.smartcard
entitlement. The command should look something like this:

codesign --force --entitlements MacOSX/pcsc.entitlements --sign "Mac Developer" target/Library/OpenSC/bin/*
codesign --force --entitlements MacOSX/pcsc.entitlements --sign "Mac Developer" target/Library/OpenSC/lib/*.dylib
codesign --force --entitlements MacOSX/pcsc.entitlements --sign "Mac Developer" --deep target/Library/OpenSC/lib/opensc-pkcs11.bundle
codesign --force --entitlements MacOSX/pcsc.entitlements --sign "Mac Developer" --deep target/Library/Security/tokend/OpenSC.tokend
2017-04-03 12:30:03 +02:00
Maciej S. Szmigiero da6815d542 Use built-in formatted output functions on mingw
Mingw currently links to msvcrt.dll as C runtime.
This library is documented by Microsoft as off-limits to applications and
its feature set vary between Windows versions.

Due to this, presence of particular printf() format string directives
depends on which Windows version the code is run.

This is, naturally, bad, so mingw developers introduced ability to replace
formatted output functions with built-in equivalents with defined feature
set by setting "__USE_MINGW_ANSI_STDIO" macro to 1.
There are, however, no built-in equivalents for "_s" suffixed functions.
Fortunately, they are used only a few times in minidriver so let's simply
replace them with equivalent code using standard functions.

This also allows skipping "MINGW_HAS_SECURE_API" macro definition so any
future uses will be caught by compiler.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +02:00
Maciej S. Szmigiero 20f781de28 Move SM test in configure.ac after LIB_PRE and DYN_LIB_EXT assignment
SM test in configure.ac makes use of LIB_PRE and DYN_LIB_EXT variables so
let's move it further down in this file, just after these variables are
assigned.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +02:00
Maciej S. Szmigiero 1b4c626d78 Make minidriver buildable again on mingw
Currently, minidriver build is broken on mingw. Let's make it work again.

For this, include adapted cardmod-mingw-compat.h with few function argument
decorations from Alon Bar-Lev's old build repository to make mingw build
almost self-contained - still requires cardmod.h from CNG, however.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 10:57:21 +02:00
Maciej S. Szmigiero 64f56b83d0 Make minidriver installer custom action library optional
Minidriver installer custom action library needs WiX SDK to build.

Since installer is an optional component anyway let's detect whether WiX
SDK is present on build platform and then decide whether to build installer
custom action library or not.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 10:57:21 +02:00
Frank Morgner a4f64d9439 Added (external) card driver for German ID card
(Imported libcardnpa from https://github.com/frankmorgner/vsmartcard)

- Added generic SM implementation of ISO/IEC 7816-8
- Added implementation of extended access control as defined by
  - BSI TR-03110
  - ICAO Doc 9303
  - ISO/IEC 7501
- Added tool for German ID card (and other EAC tokens)
- renamed folder libsm to sm
2017-03-20 21:28:48 +01:00