Commit Graph

7898 Commits

Author SHA1 Message Date
Jakub Jelen 1ed9c7483d tests: Skip most of the broken tests on current Ubuntu 2020-01-08 14:32:41 +01:00
Jakub Jelen c8e40a19db If make check does not pass, do not continue with other tests and dump logs 2020-01-08 12:57:35 +01:00
Jakub Jelen 3b40018f4d tests: Skip the allowed_mechanisms test on Ubuntu 2020-01-08 12:23:06 +01:00
Jakub Jelen 60e7b49027 tests: Add path to softhsm pkcs11 module for Ubuntu 2020-01-08 12:23:06 +01:00
Jakub Jelen b52e6db353 tests: Enable allowed_mechanisms test as the SoftHSM is already updated in Fedora 31 2020-01-08 12:22:45 +01:00
Jakub Jelen 0fe341c34e Add missing dist file for tests 2020-01-07 17:18:05 +01:00
Jakub Jelen 23fcccecf4 reader-pcsc: Add a way to create corpus files for fuzzing 2020-01-07 17:18:05 +01:00
Jakub Jelen 1742dfc045 fuzzing: Add corpus file from my cards
The corpus is generated using a local build with

    #define APDU_LOG_FILE "apdulog"

and by running:

    ./src/tools/pkcs11-tool -L --module ./src/pkcs11/.libs/opensc-pkcs11.s

cb50689bf49ccb45a2af690848517305dcf1e429 -- my Yubikey
830e1bf4c7f0c539e9686bc1517d6f87907d4bf8 -- PIV Test Card 14
9ad3fc3cb11967be927bad9263d326783c450e37 -- CAC card
b2b75c07a2c427c15ecd40ce47a9814279745b7d -- old CAC card
7cf8e9b31dcee040ee438441aca2aecb523ed5e9 -- CardOS 5.x
741a0aae7b5b08c0ad2822ede5b3364302b28b31 -- CAC Alt token
de913ba454f894cfc38a16dd122ad673d32ac480 -- coolkey
2020-01-07 17:18:05 +01:00
Jakub Jelen d1db793211 fuzz_pkcs15_reader: Record the ATR in fuzzer 2020-01-07 17:18:05 +01:00
Jakub Jelen a1b5feea96 pkcs15-coolkey: Improve logging and formatting 2020-01-07 17:18:05 +01:00
Jakub Jelen 82ba7f311f pkcs15-syn: Improve logging 2020-01-07 17:18:05 +01:00
Jakub Jelen 900cf7aca9 coolkey: Improve logging 2020-01-07 17:18:05 +01:00
Jakub Jelen cae3b71d75 gp: Define the structure packed, as it is used directly to read data inside 2020-01-07 17:18:05 +01:00
Jakub Jelen 4fd34e28ea unittests: Add coverage for simpletlv parsers 2020-01-07 17:07:48 +01:00
Jakub Jelen 8fd5ffd54e simpletlv: Avoid writing before all sanity checks in sc_simpletlv_put_tag() 2020-01-07 17:07:48 +01:00
Jakub Jelen b0d3a70b91 coolkey: Improve logging of return codes 2020-01-07 17:07:48 +01:00
Jakub Jelen a4cd265e7c unittests: Cover the decompression API with tests 2020-01-07 17:07:48 +01:00
Jakub Jelen 90aaa9e083 unittests: Increase coverage of decode_entry() 2020-01-07 17:07:48 +01:00
Jakub Jelen 586f0a3e42 unittests: Reproducer for empty OCTET STRINGs calling malloc(0) 2020-01-07 17:07:48 +01:00
Jakub Jelen 9a6cf6af3e configure: Add option to generate code coverage (for unit tests)
./configure --enable-code-coverage --disable-optimization
make check
make code-coverage-capture
lcov --summary OpenSC-*-coverage.info

This does not work well with Windows so on windows it should be disabled (WIP)
2020-01-07 17:07:48 +01:00
Jakub Jelen e8af4fc167 unittests: Add more coverage corner cases for BIT STRINGs 2020-01-07 14:50:48 +01:00
Jakub Jelen 8ddfafe057 asn1: Empty bit string requires empty zero-bits indicator 2020-01-07 14:50:48 +01:00
Jakub Jelen 3af6d7999e unittests: Add tests for non-minimal OBJECT ID encoding
Thanks @hkario for suggestions
2020-01-07 14:50:48 +01:00
Jakub Jelen 2c913155a2 asn1: Do not accept non-minimal encoding of OBJECT IDs 2020-01-07 14:50:48 +01:00
Jakub Jelen 37c8c46623 unittests: Simplify the OBJECT ID tests 2020-01-07 14:50:48 +01:00
Jakub Jelen 1e2b0fe45f unittests: Restructure the BIT STRING tests 2020-01-07 14:50:48 +01:00
Jakub Jelen 71e45bb5a7 unittest: Rewrite the INTEGER unittests to use macros and avoid code duplication 2020-01-07 14:50:47 +01:00
Jakub Jelen aaa302ca35 asn1: Allow non-strict INTEGER parsing for other code paths (FCI parsing) 2020-01-07 14:50:47 +01:00
Jakub Jelen fefff2e462 asn1: Simplify the OID decoding 2020-01-07 14:50:47 +01:00
Jakub Jelen 4569009418 unittests: Improve test coverage mostly with negative test cases
Thanks @hkario for review
2020-01-07 14:50:47 +01:00
Jakub Jelen 89ed273e81 cac1: Simplify the cycle definintion 2020-01-07 14:50:47 +01:00
Jakub Jelen 4faf517af4 asn1: Handle more corner cases of OBJECT ID parsing 2020-01-07 14:50:47 +01:00
Jakub Jelen c449aa4430 asn1: Reject integers with bogus zero/non-zero bytes on left 2020-01-07 14:50:47 +01:00
Jakub Jelen d3e9b55223 asn1: Distinguish error codes for invalid objects from implementation limitation (integer size) 2020-01-07 14:50:47 +01:00
Jakub Jelen 1271299955 ans1: Verify the padding in BIT STRING contains only zero bits 2020-01-07 14:50:47 +01:00
Jakub Jelen 611d1cea4c unittests: Verify BIT STRING parsing as integers 2020-01-07 14:50:47 +01:00
Jakub Jelen c1814571bd asn1: Avoid invalid unused bits values 2020-01-07 14:50:47 +01:00
Jakub Jelen 8d49e4a305 unittests: Test encoding of OIDs and integers 2020-01-07 14:50:47 +01:00
Jakub Jelen 61af2c1d0a asn1: Add support for encoding large values in OIDs 2020-01-07 14:50:47 +01:00
Jakub Jelen 7971bfded3 unittests: Verify parsing of more OIDs 2020-01-07 14:50:47 +01:00
Jakub Jelen 19501715d7 asn1: Correctly handle OIDs with second octet > 39 2020-01-07 14:50:47 +01:00
Jakub Jelen b6b9a886f9 unittests: Verify negative ASN1 integeres parsing 2020-01-07 14:50:47 +01:00
Jakub Jelen 8e6d2e251d unittests: Reproducer for undefined shift in ASN1 parser 2020-01-07 14:50:47 +01:00
Frank Morgner fe44567d2b avoid redefinition of NDEBUG
fixes https://github.com/OpenSC/OpenSC/issues/1799
2020-01-07 11:27:57 +01:00
Peter Marschall 4d2b860c7f OpenPGP: add ATR for Yubikey 5 2020-01-07 11:09:00 +01:00
Peter Marschall 31b8c7a404 OpenPGP: first steps at supporting OpenPGP card spec 3.4 2020-01-07 11:09:00 +01:00
alex-nitrokey 3af3d0ecee openpgp: add nistp256 and secp251k1 curves for gnuk devices 2020-01-07 11:08:25 +01:00
carblue f14043aad6 opensc-explorer get: prevent sc_read_binary applied on record-based files 2020-01-07 10:35:39 +01:00
carblue c1fb5b130e opensc-tool print_file: fix addressing records 2020-01-07 10:24:10 +01:00
carblue 5dd9fcb25c Fix asn1.c:print_tags_recursive 2020-01-07 10:18:46 +01:00