Commit Graph

8038 Commits

Author SHA1 Message Date
Frank Morgner b89fbce9f2 make OPENSSL_DIR configurable 2020-03-05 12:04:58 +01:00
Raul Metsma 7fb0696a29 Upgrade OpenSSL to 1.1.1
Version 1.0.2 is deprecated

Signed-off-by: Raul Metsma <raul@metsma.ee>
2020-03-05 12:04:58 +01:00
Frank Morgner 8551e84d74 fixed https://github.com/OpenSC/OpenSC/issues/1948
closes https://github.com/OpenSC/OpenSC/pull/1958
2020-03-04 23:11:03 +01:00
Peter Marschall 44c22b7820 opensc-explorer: re-factor do_put()
* replace magic magic number used as potentially too small buffer size
  by SC_MAX_EXT_APDU_DATA_SIZE
* start error message with upper-case letter
2020-03-04 21:59:38 +01:00
Peter Marschall b2f86b3997 opensc-explorer: re-factor read_and_print_record_file()
* replace magic magic number used as potentially too small buffer size
  by SC_MAX_EXT_APDU_RESP_SIZE
* start error message with upper-case letter
* return 0 on success
2020-03-04 21:59:38 +01:00
Peter Marschall 9b0983e96d opensc-explorer: re-factor do_random()
* use braces after sizeof, i.e. sizeof(X) instead of sizeof X
2020-03-04 21:59:38 +01:00
Peter Marschall b9d4f0c7d8 opensc-explorer: re-factor & fix do_update_record()
* bug fix: pass correct buffer length to sc_update_record()
* bug fix: report correct number of bytes written
* bug fix: check for offs to be small enough
* replace magic magic number used as potentially too small buffer size
  by SC_MAX_EXT_APDU_DATA_SIZE
* remove print() statement that looks suspiciously like a leftover from debugging
* start error messages with upper-case letters
* use sc_strerror(r) instead of plain numeric r in error messages
* fix spaces before opening curly braces
2020-03-04 21:59:38 +01:00
Peter Marschall be152f78b4 opensc-explorer: re-factor do_update_binary()
* replace magic magic number used as potentially too small buffer size
  by SC_MAX_EXT_APDU_DATA_SIZE
* remove print() statement that looks suspiciously like a leftover from debugging
* start error messages with upper-case letters
* use sc_strerror(r) instead of plain numeric r in error message
* fix spaces before opening curly braces
2020-03-04 21:59:38 +01:00
Peter Marschall c2a8102615 opensc-explorer: re-factor do_get()
* replace magic number used as potentially too small buffer size
  by SC_MAX_EXT_APDU_RESP_SIZE
* start error messages with upper-case letters
2020-03-04 21:59:38 +01:00
Peter Marschall b77e0faadb opensc-explorer: re-factor do_ls()
* replace magic magic number used as potentially too small buffer size
  by SC_MAX_EXT_APDU_RESP_SIZE
* replace magic number for filename by SC_MAX_PATH_STRING_SIZE
* start error messages with upper-case letters
* use braces after sizeof, i.e. sizeof(X) instead of sizeof X
* fix indentation
2020-03-04 21:59:38 +01:00
Peter Marschall f1d46401cb opensc-explorer: re-factor do_put_data()
* determine DO ID/tag the same way as do_find_tags()
* start error message with upper-case letter
* use sc_strerror(r) instead of plain numeric r in error message
* adapt size of buffer to SC_MAX_EXT_APDU_DATA_SIZE
2020-03-04 21:59:38 +01:00
Peter Marschall 968815e6ef opensc-explorer: re-factor do_get_data()
* determine DO ID/tag the same way as do_find_tags()
* replace magic magic number used as potentially too small buffer size
  by SC_MAX_EXT_APDU_RESP_SIZE
* change buffer type from unsigned char to u8 for consistency with
  do_put_data() & do_find_tags()
* give ID/tag of DO in error message
* open target file in binary mode
2020-03-04 21:59:38 +01:00
Peter Marschall f556c275f7 opensc-explorer: re-factor do_find_tags()
* set default values for variables at declaration time
* replace magic number used as potentially too small buffer size
  by SC_MAX_EXT_APDU_RESP_SIZE
* use braces after sizeof, i.e. sizeof(X) instead of sizeof X
2020-03-04 21:59:38 +01:00
Peter Marschall b6febc0c7a opensc-explorer: re-factor do_find()
* set default values for variables at declaration time
* use sizeof(fid) instead of magic number
* use braces after sizeof, i.e. sizeof(X) instead of sizeof X
* start error message with upper-case letter
2020-03-04 21:59:38 +01:00
Peter Marschall 4abacbf5c1 opensc-explorer: re-factor read_and_print_binary_file()
* rename from read_and_util_print_binary_file(); adapt callers
* use large enough buffer size SC_MAX_EXT_APDU_RESP_SIZE
  instead of potentially too small magic number
* fix spaces before opening curly braces
* avoid special casing SC_CARD_TYPE_BELPIC_EID: a successful read
  of an empty file is still a success, even if nothing can get printed
2020-03-04 21:59:38 +01:00
Peter Marschall f20b646a97 opensc-explorer: re-factor do_cd()
* do not fail on SC_FILE_TYPE_UNKNOWN: be more flexible w.r.t accepting
  unknown file types when the preceding card operations succeeded
* fix spaces before opening curly braces
2020-03-04 21:59:38 +01:00
Peter Marschall 78c79c0efb opensc-explorer: refactor arg_to_path()
* fix indentation
* fix spaces before opening curly braces
2020-03-04 21:59:38 +01:00
Jakub Jelen 88dce12181 gids-tool: Remove empty condition
Empty block without comment

Thanks lgtm
2020-03-04 21:27:56 +01:00
Jakub Jelen e429fe03c5 cardos: Avoid always-true condition
Comparison is always true because offset >= 1.

Thanks lgtm
2020-03-04 21:27:56 +01:00
Jakub Jelen 15b1e93b51 cac: Avoid always-true condition
Comparison is always true because pathlen >= 3.

Thanks lgtm
2020-03-04 21:27:56 +01:00
Jakub Jelen 5721961be2 pkcs11-tool: Properly report invalid signatures
Comparison is always false because rv <= 0.

Thanks lgtm
2020-03-04 21:27:56 +01:00
Jakub Jelen 6638949513 goid-tool: Fix wrong printf arguments
This argument should be of type 'wchar_t *' but is of type 'unsigned short *'

Thanks lgtm
2020-03-04 21:27:56 +01:00
Jakub Jelen 0a610319bd pkcs11-tool: Fix wrong printf arguments
This argument should be of type 'unsigned int' but is of type 'unsigned long'

Thanks lgtm
2020-03-04 21:27:56 +01:00
Jakub Jelen f301ec98b6 travis-ci: There is no files option in cache
The error was

cache: unknown key files (isetup-5.5.6.exe)
2020-03-04 21:27:56 +01:00
Jakub Jelen b8d9b840ee travis-ci: Remove deprecated sudo option
The warning was

jobs.include: deprecated key sudo (The key `sudo` has no effect anymore.)
2020-03-04 21:27:56 +01:00
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