Commit Graph

8013 Commits

Author SHA1 Message Date
Jakub Jelen aeef29238e tests: Update tests to reflect current behavior of decompress 2020-03-04 21:27:56 +01:00
Jakub Jelen c3924859a9 Update gengetopt generated code with a new version to remove hardcoded paths 2020-03-04 21:27:56 +01:00
Jakub Jelen 44bc324864 actalis: Check return codes
CID 127776
2020-03-04 21:27:56 +01:00
Jakub Jelen e3e461aad9 coolkey: Avoid insane allocations and use correct variable type
CID 341847
2020-03-04 21:27:56 +01:00
Jakub Jelen 2a88d82cad compression: Validate inputs to decompression functions
CID 353531
CID 353530
2020-03-04 21:27:56 +01:00
Jakub Jelen 7bfca52bab iasecc: Free old driver data if the driver was initialized correctly
CID: 354007
2020-03-04 21:27:56 +01:00
Jakub Jelen 677710c72b dnie: Avoid insane memory allocations
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20916
2020-03-04 21:27:56 +01:00
Jakub Jelen 7d3b82c204 epass2003: Avoid memory leaks if no file_out is passed
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20898
2020-03-04 21:27:56 +01:00
Jakub Jelen a623226a87 Avoid memory leaks from sc_parse_ef_attr()
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20710
2020-03-04 21:27:56 +01:00
Jakub Jelen 9c0a7adbfc iasecc: Avoid memory leaks on error
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20700
2020-03-04 21:27:56 +01:00
Jakub Jelen d31ebe2fec gemsafeGPK: Fix typo in comment 2020-03-04 21:27:56 +01:00
Jakub Jelen c69add3b64 cac: Correctly avoid recursion (amends 09531d72)
Closes: #1920

Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19725
2020-03-04 21:27:56 +01:00
Frank Morgner dba0f56722 pkcs11: fixed state tracking
- when listing the slots, we don't have a hotplug slot anymore with
slot->reader == NULL. Instead, we're now using this state for any left
over slots when a reader is removed. So we don't need to include this in
the slot list

- when listing the slots, we need to remember which slots the
application has seen already, to not shrink the list of slots (which is
allowed in PKCS#11 v2.2, but NSS can't handle this)
2020-03-04 21:06:43 +01:00
Frank Morgner 2a6bf1e577 pkcs11: lower debug level of virtual slots 2020-03-04 14:29:34 +01:00
Frank Morgner 7e7458edce pkcs11: restore creating 4 virtual slots for each reader
fixes old token slot ids
(https://github.com/OpenSC/OpenSC/pull/1970#issuecomment-594400562)
2020-03-04 14:25:08 +01:00
Doug Engert 8d519ed3c4 Add calls to DEBUG_VSS
On branch PKCS11-SLOTS-2
 Changes to be committed:
	modified:   pkcs11-global.c
	modified:   slot.c
2020-03-04 13:39:12 +01:00
Doug Engert 2e89f1634f Debug PKCS11 virtual slots
Macro DEBUG_VSS and routine _debug_virtual_slots were added.

DEBUG_VSS(slot, "printf like format string" [,args...]) will print the virtual_slots
to the opensc-debug.log showing were it was called from.
If slot is not NULL and found in the table it will be highlighted
with an "*".

In gdb: call _debug_virtual_slots(slot) can be used along with
another window to tail opensc-debug.log

 On branch PKCS11-SLOTS-2

Date:      Fri Feb 21 08:19:37 2020 -0600
 Changes to be committed:
	modified:   src/pkcs11/sc-pkcs11.h
	modified:   src/pkcs11/slot.c
2020-03-04 13:37:37 +01:00
Frank Morgner 649ee272ec reader-cryptotokenkit: fixed handling of reattached reader 2020-03-03 22:55:27 +01:00
Frank Morgner 14e396273c reader-pcsc: fixed handling of detatching events
- allows re-attatching a reader to an existing reader object by
resetting the SC_READER_REMOVED flag
- readers that are flagged with SC_READER_REMOVED are not used for
SCardGetStatusChange to avoid SCARD_E_UNKNOWN_READER

fixes https://github.com/OpenSC/OpenSC/issues/1903
2020-03-03 22:55:27 +01:00
Frank Morgner 5b9af96851 pkcs11: reclaim unused slots based on reader description
When a reader is removed and reattached, this re-uses the old slot
without relying on the fact that the sc_reader_t is unchanged.
2020-03-03 22:55:27 +01:00
Frank Morgner ce704f5eb1 removed unused plug_and_play parameter
see 1fb741338a
2020-03-03 22:55:27 +01:00
Frank Morgner d54f346937 pkcs11: simpify reader removal
- reader (slot) description is already initialized init_slot_info()
- objects and logins are already released in slot_token_removed
2020-03-03 22:55:27 +01:00
Doug Engert af40303fe8 Improved Handling of PKCS11 Slots
OpenSC PKCS11 now retains slots even when the reader is removed.
It can do this because existing OpenSC reader handling in ctx.c,
reader-pcsc.c and PC/SC allow OpenSC to do this.

This simplifies the code, and allow a reader to be reinserted
and use the existing slot. This matching is actually done
in reader-pcsc.c because PC/SC returns the unique ids based on
the OS reader names. This is then used as the manufacturerID

By not deleting slots the slot list can only increase which is a
restriction of Firefox. It does not fix all the Firefox issues, but
it does not go into a loop, when all the readers are removed.

The defaults in opensc.conf for max-virtual-readers and slots-per-card
allow for 4 different readers used during one session.

 On branch PKCS11-SLOTS-3
 Changes to be committed:
	modified:   sc-pkcs11.h
	modified:   slot.c
2020-03-03 22:55:27 +01:00
Frank Morgner ad7eb834cf fixed indenting 2020-03-03 22:55:27 +01:00
Frank Morgner c212776f45 fixed dashes 2020-02-27 23:12:54 +01:00
Frank Morgner 906108bb69 dnie: fixed length checking of uncompressed data
fixes https://oss-fuzz.com/testcase-detail/5632848910614528
2020-02-27 23:12:54 +01:00
Frank Morgner 261e0b6b0d unified documentation of handling PIN/PUK on CLI 2020-02-27 23:12:54 +01:00
Frank Morgner 6b1770e7ad pkcs15-init: removed --options-file
use an environment variable to pass a hidden PIN code instead of the
options file

fixes 13814 Resource leak as reported by Coverity Scan
2020-02-27 23:12:54 +01:00
Frank Morgner dca02dd9a0 fixed 323588 Uninitialized scalar variable
accessing uninitialized data with mlock is undefined behavior
2020-02-27 23:12:54 +01:00
Peter Marschall 21ee26b070 openpgp-tool: fix key generation with non-standard exponent length
Address issue #1949 by reading non-default algorithm attributes for
key generation from the key's algorithm attributes DO, if that exists.
2020-02-27 22:59:05 +01:00
Peter Marschall 81ace3689d opensc-explorer: extend do_info()
* distinguish between Internal and Working EFs
* add information optionally available in sc_file_t
  - record_count
  - record_length
  - type_attr
* align all labelled values
2020-02-27 22:55:38 +01:00
Peter Marschall 95cae64f83 opensc-explorer: replace magic numbers by SC_MAX_PIN_SIZE
Replace magic numbers, used as size of PIN-type buffers,
with the symbolic constant SC_MAX_PIN_SIZE, fixing
- readability / understandability
- too small sizes (e.g. for GnuPG cards)
2020-02-27 22:54:50 +01:00
Frank Morgner 70716be815 macOS: register CTK driver on installation 2020-02-27 22:49:27 +01:00
Frank Morgner 6a9241b532 macOS: unregister CTK driver on uninstallation
fixes https://github.com/frankmorgner/OpenSCToken/issues/24
2020-02-27 22:49:27 +01:00
Frank Morgner 8f4a6c703b align comment with implementation order 2020-02-20 01:42:18 +01:00
Frank Morgner 31d8c2dfd1 Revert "pkcs11: fixed slotIDs when a new slot list is requested"
This reverts commit 7fb72ccf7b.
2020-02-19 16:09:20 +01:00
Peter Marschall cd5c91b8ef iso7816: extend iso7816_process_fci()
* define file type SC_FILE_TYPE_UNKNOWN
* explicitly set file->type to SC_FILE_TYPE_UNKNOWN for unkown files
* store full-length file type attributes via sc_file_set_type_attr()
* parse # of records for record-oriented EFs
* parse record length for for EFs with fixed-size records
  Note: I am not sure, parsing the record length only for EFs with fixed-
        size records is the correct approach.
        My interpretation of the norm is slightly different, but it seems
        to be in-line what's currently in opensc:
        - there's a comment hinting at that interpretation
        - otherwise variable size records fail to be read in opensc-explorer
        So I leave it this way for now.
2020-02-18 20:47:26 +01:00
Frank Morgner e0b27af205 fixed Undefined-shift
fixes https://oss-fuzz.com/testcase-detail/5644419049193472
2020-02-13 10:39:41 +01:00
Frank Morgner 6c855c561c fixed memory leak
fixes https://oss-fuzz.com/testcase-detail/5739164513599488
2020-02-12 04:48:40 +01:00
Frank Morgner 0d82c95a02 removed unused call to sc_detect_card_presence() 2020-02-12 04:34:45 +01:00
Jakub Jelen 5450f61681 Unbreak build with -fno-common (default in gcc10) 2020-02-11 07:36:31 +01:00
Frank Morgner 1fb1341389 ignore OpenPACE man page generation
fixes https://github.com/frankmorgner/OpenSCToken/issues/26
2020-02-11 04:12:10 +01:00
Frank Morgner a0e1bf7ae5 fixed compiler error 2020-02-10 10:17:16 +01:00
Frank Morgner ea2991ea69 fixed memory leak
also, use sc_file_free instead of free

fixes https://oss-fuzz.com/testcase-detail/4905082200260608
2020-02-10 10:17:16 +01:00
Frank Morgner 2493c5de07 fixed memory leak
fixes https://oss-fuzz.com/testcase-detail/6237284133502976
2020-02-10 10:17:16 +01:00
Frank Morgner d7e02d3bf5 fixed memory leak
Fixes https://oss-fuzz.com/testcase-detail/5151975710916608
2020-02-10 10:17:16 +01:00
Peter Marschall 8e466ad568 OpenPGP: add 3 more OpenPGP card vendors
* taken from GnuPG's git
2020-02-10 00:41:02 +01:00
Charlène 2f7d0cf20f Put user supplied CFLAGS on top priority 2020-02-07 08:57:26 +01:00
Jakub Jelen 34dad7f543 idprime: Add missing terminator in ATR list
Thanks oss-fuzz

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20510
2020-02-04 15:44:19 +01:00
Jakub Jelen 63435adc68 coolkey: Do not return bogus error if read already failed 2020-02-04 13:57:15 +01:00