Commit Graph

7879 Commits

Author SHA1 Message Date
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
carblue 4ad55997e0 sc_pkcs15_decode_skdf_entry: break all looping on oid match: on average better performance 2020-01-07 10:17:39 +01:00
Frank Morgner cfd5519b98 simplify PIV I/O 2020-01-07 10:06:23 +01:00
Frank Morgner 31169afb72 fixed fuzzing build
wrapping/unwrapping is hopefully correctly initialized
2020-01-06 22:34:16 +01:00
Priit Laes 0b4b7fbaf0 openssl: Drop all compatibility checks for <=openssl-1.0.0 2020-01-06 15:47:07 +01:00
Priit Laes 295cf100a8 Bump minimum required openssl version to 1.0.1
Everything older than 1.0.2 is not longer supported by the OpenSSL team.
2020-01-06 15:47:07 +01:00
Julian Strobl 6b84407c3d tcos: fix indentation and braces
Increase readability. No content-based changes.
2020-01-06 15:43:46 +01:00
Frank Morgner 45e29056cc Release 0.20.0 2019-12-29 13:42:06 +01:00
Frank Morgner a2b133ef4f Updated NEWS 2019-12-29 13:39:01 +01:00
Khem Raj 05e3f7b667 Fix misleading code indentation
Fixes
error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
         if(cipher)
         ^
../../../git/src/libopensc/card-entersafe.c:369:2: note: previous statement is here
        if(sbuf)
        ^
2019-12-28 18:18:06 +01:00
Julian Strobl e9aa163fe5 pkcs11-tool: fix output of test_decrypt
Before the output looked like this, if a public key was not found:
```
  testing key 1 (IDKey2)
    RSA-X-509: OK
    RSA-PKCS: OK
  testing key 2 (IDKey3)
couldn't find the corresponding pubkey for validation
couldn't find the corresponding pubkey for validation
    RSA-X-509:     RSA-PKCS:   testing key 3 (IDKey4)
couldn't find the corresponding pubkey for validation
couldn't find the corresponding pubkey for validation
```

Now:
```
  testing key 1 (IDKey2)
    RSA-X-509: OK
    RSA-PKCS: OK
  testing key 2 (IDKey3) -- can't find corresponding public key, skipping
  testing key 3 (IDKey4) -- can't find corresponding public key, skipping
```
2019-12-28 18:15:55 +01:00
Julian Strobl 81940e123b pkcs11-tool: align output for test_signature
Before it was a bit confusing, e.g.:
```
  testing key 1 (2048 bits, label=IDKey2) with 1 signature mechanism
    RSA-X-509: OK
couldn't find the corresponding pubkey
  testing key 2 (0 bits, label=IDKey3) with 1 signature mechanism -- can't be used to sign/verify, skipping: can't obtain modulus
```

The error message in line 3 is for IDKey3 and not for IDKey2.

With this patch the output is aligned with `test_verify`:
```
  testing key 1 (IDKey2) with 1 mechanism
    RSA-X-509: OK
  testing key 2 (IDKey3) with 1 mechanism -- can't find corresponding public key, skipping
```
2019-12-28 18:15:55 +01:00
Julian Strobl 9eed40ea31 tcos: add encryption certificate for IDKey
Fixes https://github.com/frankmorgner/OpenSCToken/issues/21
2019-12-28 18:15:55 +01:00
Frank Morgner 1cc6087126 fix buffer length for printing DFs 2019-12-19 04:44:59 +01:00
Benjamin DELPY b59456b6e4 Update card-gids.c to support 3072 & 4096 RSA key sizes 2019-12-19 04:33:14 +01:00
Julian Strobl 187d908feb tcos: allow correct input length when signing
For 2048 bit keys the padded input is 256 bytes long.

Fixes https://github.com/frankmorgner/OpenSCToken/issues/20
2019-12-19 04:30:27 +01:00
Julian Strobl 55b7a6fefd Revert "tcos: Do not advertize non-functional RSA RAW algorithms"
This reverts commit bee5c6d639.

See https://github.com/frankmorgner/OpenSCToken/issues/20#issuecomment-566455157
2019-12-19 04:30:27 +01:00
Frank Morgner 333c41c5d5 pgp: don't write beyond oid object
fixes Stack-buffer-overflow
https://oss-fuzz.com/testcase-detail/6329203163398144
2019-12-18 14:55:46 +01:00
Jakub Jelen af42a93874 tests: Add missing script to the release tarball 2019-12-17 16:09:35 +01:00
Jakub Jelen ee78b0b805 pkcs15-coolkey: Fix EC key type and fail on invalid key types
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19251
2019-12-11 09:19:45 +01:00