Commit Graph

6561 Commits

Author SHA1 Message Date
Frank Morgner aa0592f025 travis-ci: fixed mingw cross compile build
fixes #906
2017-03-02 23:30:10 +01:00
Jakuje 777e2a3751 adding a CAC support into OpenSC (#841)
* Includes adding support for parsing extensions from a certificate.
* Move lebytes2ushort() to related functions in internals.h
* Adds Simple TLV related functions
2017-02-27 11:05:12 +01:00
Frank Morgner e8b5dcfaa6 macOS: Simplyfy installer
- integrated readme into welcome screen
- removed explicit user consent to LGPL in accordance to
  https://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.html#ClickThrough
2017-02-20 21:37:44 +01:00
Frank Morgner 25f785e482 macOS: Use a better Uninstaller
An apple script converted to an App calls the local
/usr/local/bin/opensc-uninstall
2017-02-20 21:37:44 +01:00
konstantinpersidskiy a0870826a2 card-rtecp: Fix rtecp_change_reference_data (#958)
* card-rtecp: Fix rtecp_change_reference_data (resolves #931)

* Replace filthy comment, move assert

* card-rtecp: Fix rtecp_change_reference_data (resolves #931)
2017-02-20 21:36:55 +01:00
Doug Engert 2a68395d22 Pkcs11-tool.c -t fails to for RSA-X-509 verification
The test_signature routine reuses data array and fails to reset data[0] = 0
when creating a PKCS hash to be pased to OpenSSL.

 Date:	     Mon Feb 13 11:48:00 2017 -0600

 On branch pkcs11-tool-pkcs
 Changes to be committed:
	modified:   tools/pkcs11-tool.c
2017-02-13 20:50:30 +01:00
Nuno Goncalves f1f96a6b40 pkcs15-tool: cast size_t to unsigned long (fix #965) (#966)
Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-02-12 22:47:11 +01:00
Nuno Goncalves 4202ea25d0 pteid: order objects by address (supersede #949) (#954)
* pteid: remove OID setting for data objects as they are not defined for this token

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>

* pteid: order data objects code list by address and rename new objects

The ICAO MRTD specification defines the Security Object Document
abreviation as SOd and not SOD. This is a breaking change since
the labels are case sensitive, but this object was not yet available
on the last stable release.

Trace is also not a acronym or abreviation, so it should be defined with
normal casing. Also a breaking change and also acceptable because it is
unstable code only.

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-02-09 20:54:06 +01:00
Frank Morgner 9d5fe7803d silence warning about not logging in 2017-02-08 22:19:02 +01:00
HAMANO Tsukasa 76a524544a login state preservation for JPKI card
also set pin1.logged_in and pin1.tries_left

set correct max_tries
2017-02-06 14:22:14 +01:00
Nuno Goncalves 3635dbe78a pkcs11: remove redundant validation of PIN length
PIN length validation is done at pkcs15 layer and shall be done only there.

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-02-04 22:44:26 +01:00
Nuno Goncalves ccc7e2f109 Improve pinpad use detection
Pinpad is used it it is present and if no pin string is provided (pinlen==0).

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-02-04 22:44:26 +01:00
Nuno Goncalves c6a9201b62 Validate PIN before verification
_validate_pin was not being called at all during a PIN verification.

After this tools report correctly when the PIN length is invalid, even on pkcs11 layer.

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-02-04 22:44:26 +01:00
Nuno Goncalves 9eb706ba29 Fix tools interpretation of util_getpass return value
A negative value means a error and not "No PIN entered".

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-02-04 22:44:26 +01:00
Nuno Goncalves 423375c6f8 pkcs11-tool: always authenticate when pinpad is in use
Authentication might not be required (from pkcs11 side) when
pin cache is used. This can't happen if a pinpad is used.

We were already checking for CKA_ALWAYS_AUTHENTICATE (user_consent),
now also check for CKF_PROTECTED_AUTHENTICATION_PATH (pinpad).

Also encapsulate logic in a function and provide additional checks for
redundant authentication attempts.

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-02-04 22:44:26 +01:00
Nuno Goncalves b6cb10f768 pkcs11-tool: make login checks consistent in all test functions
Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-02-04 22:44:26 +01:00
Nuno Goncalves 37844fc6c3 Revert "pkcs11-tool: re-login if pincache is disabled or expired"
This reverts commit 1bc09ddafa.

This commit had totally wrong.

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-02-04 22:44:26 +01:00
rickyepoderi c906c5e375 Use struct sm_cwa_session from sm.h in dnie (#955)
* Use cm_ctx instead of a custom cwa struct. Get rid of sc_reset.


* Use ifd.sn and icc.sn from sm_cwa_session struct too

* Minor typo with sizeof

closes https://github.com/OpenSC/OpenSC/issues/930
2017-02-04 22:32:35 +01:00
Nuno Goncalves 68f8f0bfa7 pkcs15-init,pkcs15-tool: reword --no-prompt to --use-pinpad (close #944) (#957)
* pkcs15-init,pkcs15-tool: reword --no-prompt to --use-pinpad (close #944)

Wording was confusing for a novice user. Old option is mantained as an alias,
but will print to stderr a deprecation warning.

Deprecation related code is all marked with deprecated word to easy future removal.

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>

* pkcs15-init,pkcs15-tool: document --use-pinpad

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-02-03 17:01:52 +01:00
Jakub Jelen 92765f612e iso7816: Parse TL using ASN1 parser to avoid (possibly) wrong assumptions about length of both parts 2017-01-28 01:11:54 +01:00
Jakub Jelen 7033510e44 Add ATR to detect CardOS 5.3 2017-01-28 01:11:54 +01:00
Nuno Goncalves bb905ec1ec pkcs11-tool: small format fix (#950)
Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-01-28 00:59:28 +01:00
Jakub Jelen 6aa52ce753 coolkey: Properly initialize serial length (partially resolves #943) 2017-01-23 13:31:26 +01:00
Jakub Jelen 9fd8a60cfa mcrd: Clean up drv_data in case of failure during initialization (partly resolves #943) 2017-01-23 13:31:26 +01:00
Nuno Goncalves 4b93f447d5 pteid: support iso7816 logged_in
Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-01-13 15:46:05 +01:00
Frank Morgner 81d16fcc27 iso7816: propagate the PIN status on verify/change 2017-01-10 13:00:26 +01:00
Frank Morgner b577e8edbc card-cardos: Support PIN queries for CardOS 5 2017-01-10 13:00:26 +01:00
Frank Morgner 5a9d7e1c42 pkcs15-init: Fixed segfault
regression introduced in de7aaa4197

fixes https://github.com/OpenSC/OpenSC/issues/934
closes https://github.com/OpenSC/OpenSC/pull/935
2017-01-10 12:57:53 +01:00
Michał Trojnara 645780e6d4 NULL parameter check moved to sc_file_free()
This fixes numerous issues where the check is *not* performed,
and also simplifies the code.
2017-01-10 12:46:44 +01:00
Jakub Jelen 2c6dadfb44 Fix Coolkey memory management around SimCLists 2017-01-10 12:42:27 +01:00
Frank Morgner 24b7507a69 pkcs11: don't shrink the number of slots
... as required by PKCS#11 2.30, if the application doesn't call
`C_GetSlotList` with `NULL`.

Fixes ghost tokens in Firefox when detaching a reader that contained a
card.

Fixes https://github.com/OpenSC/OpenSC/issues/629
2017-01-09 08:35:42 +01:00
Frank Morgner 7e6dc25c40 remove all login states when the token was removed 2017-01-09 08:35:42 +01:00
ricky 42a9df3bd9 Avoid warning because no dnie_match_card 2017-01-08 17:13:13 +01:00
ricky 39f619fbb3 Disable dnie if not defined ENABLE_SM (issue #927) 2017-01-08 17:13:13 +01:00
Nuno Goncalves ebf0a8b9f5 Do not print data to terminal when output file is given.
This brings --read-data-object behavior in line with
--read-certificate, which only print the object to
stdout if no output file is given.

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
2017-01-08 17:10:33 +01:00
Jakub Jelen b3f047619d Prevent leaking memory from PIV readers 2017-01-05 16:34:40 +01:00
Viktor Tarasov b4cfb14e4c asn1: print in log part of raw data to decode
closes #926
2017-01-01 13:58:48 +01:00
Hannu Honkanen cd621531be card-dnie: Fix to dnie_ask_user_consent. Undefined flag caused a compilation error. 2017-01-01 13:58:48 +01:00
Hannu Honkanen 7598c822ed myeid: added card capabilities check to ...
... correctly determine which algorithms and key sizes are supported.
2017-01-01 13:58:07 +01:00
Martin Paljak 27c9daeede opensc-tool: only show the card name if present, to avoid "(null)"
Before:

$ opensc-tool -lv

Nr.  Card  Features  Name
0    No              FujitsuTechnologySolutions GmbH SmartCase KB SCR eSIG [SmartCase Smartcard Reader] 00 00
1    Yes             ACS ACR 38U-CCID 01 00
     3b:6e:00:00:80:31:80:66:b0:84:0c:01:6e:01:83:00:90:00 (null)

After:

$ opensc-tool -lv

Nr.  Card  Features  Name
0    No              FujitsuTechnologySolutions GmbH SmartCase KB SCR eSIG [SmartCase Smartcard Reader] 00 00
1    Yes             ACS ACR 38U-CCID 01 00
     3b:6e:00:00:80:31:80:66:b0:84:0c:01:6e:01:83:00:90:00

Change-Id: Id2cb858897cd845d93609e28019c94736b04fa93

closes #921
2017-01-01 13:40:39 +01:00
Peter Popovec 539c89e581 opensc-explorer: show tag 0x82 for unknown files
For reserved/unknown file type print value of 0x82 tag, instead of "???" string.

closes #918
2016-12-18 12:50:11 +01:00
Frank Morgner e7f118d797 config: added disable_popups for internal UI
closes #916
2016-12-18 12:38:28 +01:00
ricky b97efe1374 cwa-dnie is empty if openssl not defined
closes #914
2016-12-18 12:21:58 +01:00
ricky 06292563bc dnie: force caching of pin if DNIe is version 3.0 2016-12-18 12:21:46 +01:00
ricky e1b4bf4d2c dnie: lost change in the previous pull request ...
... and disable SM mode too.
2016-12-18 12:21:02 +01:00
Viktor Tarasov f0f453781e tools: fix segfault with verbose log into 'stderr'
Issue #824

In Windows, file handles (including 'stderr', 'stdout') can not be shared
between DLL-s, and so, the log handle (File *), defined in one module, cannot
be reused in another.

That is the situation when, for example, the SM is processed
in external, dynamically loadable module as it currently implemented for
IAS/ECC card.

That's for the configuration option 're-open of log file on each message' was
introduced.

This 're-open' logic has not been tested in the particular case of opensc-*
tools used with verbose log into 'stderr' -- in dynamically loaded module the
'stderr' handle, defined in the 'main' module, was not recognized as 'stderr'
and there was an attempt to close it.

closes #910
2016-12-18 11:31:00 +01:00
Viktor Tarasov f6a5885348 travis: allow failed cross-builds
closes #911
2016-12-18 11:29:06 +01:00
Frank Morgner dce379b43d pkcs11-tool: fixed missing newline in test output
regression of 4441efa6da
2016-12-14 21:18:58 +01:00
Pieter Naaijkens 13463e2d18 Add missing comma to fix segfault when pkcs11-tool is called without arguments 2016-12-14 19:47:24 +01:00
Frank Morgner 9e6dddb7dd pkcs15-tool: workaround for Apple stupidity
Fixes https://github.com/OpenSC/OpenSC/issues/886
2016-11-29 21:56:52 +01:00