Commit Graph

104 Commits

Author SHA1 Message Date
Frank Morgner 74ec7b04ff sc-hsm: Add support for SoC
- eac: allow CA without EF.CardSecurity
- sc-hsm: implemented CA based on document PKI
- sc-hsm: adds receive limit for SoC card
- introduces dedicated card type for SoC card
- md: integrate card's PIN pad capabilities
- installer: added SC-HSM SoC card to registry
- pkcs15-tool: Added support for PIN entry on card
- change/unblock PIN: add support for PIN entry on card
- added OpenPACE to macOS build
- travis-ci: install gengetopt/help2man via brew
- sc-hsm: Cache EF.C_DevAut
- sc-hsm: Prevent unnecessary applet selection and state resets
- sc-hsm: added support for session pin
- sc-hsm: avoid multiple AID selection
- sc-hsm: Use the information from match_card for all subsequent selections of the applet
- sc-hsm: cache optional files as empty files (Decoding the files will reveal that they were not existing prior caching. This avoids selecting the file though we have already tried to cache the file before.)
- use dedicated directory for CVC trust anchors
- appveyor: added OpenPACE to windows build
2017-05-22 16:25:08 +02:00
Frank Morgner 6bfb39454b Fix missing error handling of memory allocation (#1020)
* libopensc: handle allocation errors
* handle more faults during memory allocation

fixes several situations that cause segmentation fault
2017-04-20 21:08:49 +02:00
Frank Morgner fcc8ea5939 reader-pcsc: removed cardmod driver
- pcsc driver takes over all the functionality
- no dedicated reader driver config values for cardmod, use application
  specific blocks to define a different behavior for the pcsc reader if
  needed
- removes legacy code; requiring at least libpcsclite 1.6.5

Fixes https://github.com/OpenSC/OpenSC/issues/892
2017-04-20 10:29:30 +02:00
Maciej S. Szmigiero 428b134776 Minidriver CardReadFile() parameters are optional
According to minidriver specs CardReadFile() method output parameters are
optional so don't return SCARD_E_INVALID_PARAMETER when they are NULL.

Also, use this opportunity to walk through this function helpers to make
sure they correctly return error status.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:09:38 +02:00
Maciej S. Szmigiero d203ad76a4 Minidriver CardGetChallenge() parameters are output only
According to minidriver specs CardGetChallenge() method parameters
are purely for output and do not have a meaning of requested challenge
length, so remove a misleading log line.

There is also no need to have a special case for pcbChallengeData being
NULL since in this case the function would have exited early anyway with
SCARD_E_INVALID_PARAMETER (also, it was just dereferenced in the previous
code line).

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +02:00
Maciej S. Szmigiero 56f880613a Fix minidriver log messages format and parameter issues flagged by GCC
Since last commit GCC warns us about problems with format strings and their
arguments in minidriver, so let's fix these warnings just as we did in rest
of the OpenSC code.

Most of these warnings were about DWORDs being printed as ints, there were
also some format directives and size_t size specifiers missing and various
misc format / parameter disagreements.

Attempt was made to keep log strings as-is, only the most obvious typos
were fixed.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +02:00
Maciej S. Szmigiero 1a073d5683 Add GCC format checking attributes to minidriver logging function
Commit "Add GCC format checking attributes to log functions" added format
and parameter checking to OpenSC log functions.
Minidriver, however, logs most of its output via a dedicated log function,
so this function needs such attributes, too.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +02:00
Maciej S. Szmigiero da6815d542 Use built-in formatted output functions on mingw
Mingw currently links to msvcrt.dll as C runtime.
This library is documented by Microsoft as off-limits to applications and
its feature set vary between Windows versions.

Due to this, presence of particular printf() format string directives
depends on which Windows version the code is run.

This is, naturally, bad, so mingw developers introduced ability to replace
formatted output functions with built-in equivalents with defined feature
set by setting "__USE_MINGW_ANSI_STDIO" macro to 1.
There are, however, no built-in equivalents for "_s" suffixed functions.
Fortunately, they are used only a few times in minidriver so let's simply
replace them with equivalent code using standard functions.

This also allows skipping "MINGW_HAS_SECURE_API" macro definition so any
future uses will be caught by compiler.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +02:00
Maciej S. Szmigiero 1c40426421 Support PIN unblocking in minidriver via PUK as response to challenge
Minidriver currently has basic support for unblocking card PIN by providing
PUK as an administrator password to CardUnblockPin() function.

However, this doesn't work for example when trying to unblock PIN via
system smartcard PIN unblock screen accessible after pressing Ctrl+Alt+Del
as it wants to use challenge / response authentication.
MS Smart Card Minidriver specification (version 7.07) explicitly says that
challenge / response is the only authentication mode that Windows uses to
authenticate an administrator.
Unfortunately, this way of unblocking PIN seems to not be widely supported
by cards.

However, we can simply treat the provided response to challenge as PUK.
Because (at least) Ctrl+Alt+Del PIN unblock screen accepts only hex string,
every PUK digit X has to be input as '3X' (without quotes) there.
Also the response string is not hidden behind asterisks on this screen as
it should been.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +02:00
Maciej S. Szmigiero f91fc3d338 Remove logprintf() mingw hack in minidriver
Minidriver contained a hack since commit 7ef766b785 in 2010 to print to
debug file directly under mingw (instead of using normal OpenSC logging
system), as there was problem with "%S" format specifier then.

However, on recent mingw versions "%S" format works fine so let's remove
this hack.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +02:00
Maciej S. Szmigiero 7f778ccff8 Fix most of warnings shown when building on Linux and mingw
This commit fixes most of warnings shown by GCC on 64-bit Linux, 32-bit and
64-bit mingw builds (with SM and OpenSSL enabled).

These warnings were mostly caused by missing casts.

In minidriver there was also a bit of unused variables and dead code.

Remaining warnings on mingw are mostly caused by GCC not recognizing on
this platform "ll" size specifier (present at least since
Visual Studio 2005, also in mingw own CRT) and "z" size specifier (this one
will be fixed in next commits).

There is also a warning about pointer truncation on Win64 when making
PKCS#11 object handle from pointer to this object.
This is a legitimate warning, since it could result in the same handles
being generated from different pointers and so from different objects.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 10:58:26 +02:00
Maciej S. Szmigiero 1b4c626d78 Make minidriver buildable again on mingw
Currently, minidriver build is broken on mingw. Let's make it work again.

For this, include adapted cardmod-mingw-compat.h with few function argument
decorations from Alon Bar-Lev's old build repository to make mingw build
almost self-contained - still requires cardmod.h from CNG, however.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 10:57:21 +02:00
HAMANO Tsukasa 638a69a2ab MD: add and read msroots file 2017-03-20 23:05:09 +01:00
Frank Morgner e7f118d797 config: added disable_popups for internal UI
closes #916
2016-12-18 12:38:28 +01:00
Frank Morgner 9983c4185f fixed incompatible types ('DWORD *' to 'size_t *') 2016-06-14 14:11:26 +02:00
Jakub Jelen ae47e06d57 Typos 2016-05-16 10:58:22 +02:00
Viktor Tarasov 09cbcd80f4 md: use register to enable debug log 2016-04-17 12:43:27 +02:00
Viktor Tarasov 89a5b5893b md: use GUID without frame 2016-04-08 11:02:53 +02:00
Viktor Tarasov 5bbc86eb39 md: replace card specific with pkcs15 'aux-data' facilities 2016-04-08 11:02:53 +02:00
vletoux 57e05d3359 minidriver: use sc_logout for CardDeauthenticate 2015-12-12 02:28:01 +01:00
Frank Morgner 0ca46910f7 use tabs only for indenting 2015-10-16 09:58:01 +02:00
vletoux 35175a814c minidriver: fix according to frank's comments 2015-10-15 22:40:36 +02:00
vletoux fed64b0636 minidriver: fixes according to Frank's comments 2015-10-14 22:48:41 +02:00
vletoux 75d76f5ce4 Merge branch 'master' of https://github.com/OpenSC/OpenSC into OpenSC-master
Conflicts:
	src/minidriver/minidriver.c
2015-10-14 22:22:19 +02:00
vletoux 747678c83d minidriver: remove unnecessary logs on console (certutil -scinfo) 2015-10-11 18:51:36 +02:00
vletoux b968fcfb1f minidriver: Windows x509 enrollment works
Removed cmap_record in sc_pkcs15_prkey_info (not used by any driver nor code)
Remove cardcf specific code (cardcf neutralized by CP_CACHE_MODE_NO_CACHE and it maintened by the Base CSP/KSP, not the minidriver)
Add conversion code for Windows GUID / OpenSC self computed GUID
2015-10-11 15:20:04 +02:00
vletoux bee1a450c9 minidriver: modified configuration functions 2015-10-11 10:39:02 +02:00
vletoux 7551baafbd minidriver: add crt secure functions (*_s) 2015-10-10 22:07:49 +02:00
vletoux ebfb76d311 minidriver: fix library import for guid & one compilation warning 2015-10-10 19:01:14 +02:00
vletoux 8f4420cb78 minidriver: factorize container naming code 2015-10-10 15:39:27 +02:00
vletoux 227f48d7b0 minidriver: replace one sprintf by sprintf_s 2015-10-10 14:15:23 +02:00
Frank Morgner a6b36507a3 removed unused parent in md directory/file 2015-10-06 22:49:32 +02:00
Frank Morgner d18ddcb446 fixed accessing fixed size md file/directory name 2015-10-06 22:49:16 +02:00
Frank Morgner 6c61bf6815 fixed accessing fixed size guid 2015-10-06 22:49:16 +02:00
vletoux 811a86e72a fix: set the container name as the id if md_guid_as_label is set 2015-10-04 19:49:31 +02:00
Frank Morgner c56fe19b31 minidriver.c: fixed accessing label in sc_pkcs15_object_t 2015-10-04 17:33:14 +02:00
vletoux c3f2cb142f fix "use guid as label"
Allow to use as pkcs15 label the windows container name (max: 39 characters)
2015-10-03 18:59:52 +02:00
vletoux b667645797 fix compilation warning 2015-10-03 18:56:19 +02:00
vletoux a9897f9956 First implementation of CardDeleteContainer
Container now can be created, deleted, in short, a read write card
2015-09-30 22:52:37 +02:00
vletoux 67740fb955 quality improvement of CardDeriveKey 2015-09-30 22:49:41 +02:00
vletoux 9a590d64e4 do not reset the authentication state before each operation 2015-09-30 22:47:16 +02:00
vletoux c00f9830ba force recompilation on integration plateforms 2015-09-25 22:56:26 +02:00
vletoux 6cbeea3942 First ECC support for the minidriver 2015-09-25 22:22:29 +02:00
Andreas Kemnade 6a6ef61d1a some more error checks in minidriver in regards to card ejects 2015-05-13 10:11:05 +02:00
Viktor Tarasov 72b5d8fe9a md: use 'store-or-update' store certificate mode 2015-05-10 15:04:44 +02:00
vletoux 8ec000e80d minidriver: change the icon of the pinpad dialog 2015-05-10 15:04:44 +02:00
vletoux ac82a96ccc minidriver: add my name in the author list
setup: change the url to match the new one
2015-05-10 15:04:44 +02:00
vletoux aede9b164b minidriver: fix compilation warnings on x64 (size_t <> DWORD) 2015-05-10 15:04:44 +02:00
vletoux 33cf161941 minidriver: pinpad authentication is now working for smart card logon !!! (still needs 5 pinpad entries)
minidriver: minor fixes
2015-05-10 15:04:41 +02:00
vletoux 6127fe6b77 minidriver: change the UI (remplace a messagebox by a nice dialog) ; add a translation function for errors 2015-05-10 15:04:41 +02:00