Commit Graph

807 Commits

Author SHA1 Message Date
Nikos Mavrogiannopoulos 2059f79793 install opensc.pc
This allows applications to detect opensc version, as well as
link against opensc's pkcs11 library if needed.
2016-09-20 01:47:37 +02:00
Frank Morgner 526ae18696 PKCS#11: Don't use ':' in the token name
Fixes https://github.com/OpenSC/OpenSC/issues/849
2016-09-01 01:25:29 +02:00
carblue 1ab99f3756 pkcs11-tool: in 4rd test use other signature keys
also increase signature buffer in framework-pkcs15

closes #814
2016-07-24 19:26:10 +02:00
Frank Morgner 2f10de4f5c use sc_pkcs15_get_pin_info in C_GetTokenInfo
introduced paramter to signal back the login state
- used for the pin command SC_PIN_CMD_GET_INFO
- implemented in accordance to ISO 7816-4; all other implementations
  are currently set to an unknown login state

implemented and exporeted sc_pkcs15_get_pin_info

use sc_pkcs15_get_pin_info in C_GetTokenInfo

C_GetSessionInfo: Check whether a logout was done

Closes https://github.com/OpenSC/OpenSC/pull/624

rebased by @viktorTarasov
2016-07-17 14:07:43 +02:00
Frank Morgner 1c661ca023 Merge pull request #732 from metsma/P11Label
Move PIN type label front of description
2016-07-08 01:34:37 +02:00
David von Oheimb 4441efa6da pkcs11-tool: various improvements, extensions, fixes, cleanup
========================================
rebased by VTA -- commits are forged to one,
excluding the following chunk
(reason -- if not explicitely indicated, the mechanism has to be found out using the mechanism flags):

@@ -1713,8 +1713,9 @@ static int gen_keypair(CK_SLOT_ID slot, CK_SESSION_HANDLE session,
                        int ii;

                        if (!opt_mechanism_used)
+                               opt_mechanism = CKM_EC_KEY_PAIR_GEN;
                                if (!find_mechanism(slot, CKF_GENERATE_KEY_PAIR, mtypes, mtypes_num, &opt_mechanism))
-                                       util_fatal("Generate EC key mechanism not supported\n");
+                                       util_warn("Generate EC key mechanism not listed as supported");

                        for (ii=0; ec_curve_infos[ii].name; ii++)   {
                                if (!strcmp(ec_curve_infos[ii].name, type + 3))

will close PR #747
2016-06-29 14:18:56 +02:00
Frank Morgner 0898d06944 fixed and cleaned up nmake Makefiles 2016-06-23 07:35:53 +02:00
Frank Morgner 25b52f6ada don't use a def file for PKCS#11 modules
exports are already declared in pkcs11.h. declaring them twice will
yield LNK4197.
2016-06-14 14:58:11 +02:00
Raul Metsma 22f9ad704a Move PIN type label front of description
With very long labels it is unable identify which PIN Firefox is asking.
PKCS11 label is 32 char's and it gets truncated.

Current format "LABEL (PIN1)"
New format "PIN1: LABEL"
2016-04-13 13:57:32 +03:00
viktorTarasov a5550f980b Merge pull request #706 from frankmorgner/npa-generic
generic changes from #611
2016-03-10 11:04:12 +01:00
Viktor Tarasov 1fb741338a pkcs11: remove hot-plug-anb-play
updated version of PR #687

Discussion and motivation in PR #687 and PR #704

Fix #687
Fix #704
2016-03-10 10:43:18 +01:00
Frank Morgner 5403899444 use SCardGetAttrib to initialize reader's metadata 2016-03-07 10:39:42 +01:00
Frank Morgner 415f15e3e2 use autoconf metadata for PKCS#11 library 2016-03-07 10:39:42 +01:00
Frank Morgner c3527f4a5b fixed dylib extensions 2016-03-07 10:39:42 +01:00
Ludovic Rousseau 89ec66fbe8 framework-pkcs15.c: fix compiler warning
framework-pkcs15.c:706:1: warning: unused function
      '__pkcs15_create_secret_key_object' [-Wunused-function]
__pkcs15_create_secret_key_object(struct pkcs15_fw_data *fw_data,
^
2016-02-29 20:19:42 +01:00
Ludovic Rousseau 80a313fb2a pkcs11-spy.c: fix 1 warning
pkcs11-spy.c:259:49: warning: format specifies type 'long' but the argument has
      type 'int' [-Wformat]
        fprintf(spy_output, "%s.%03ld\n", time_string, tv.tv_usec / 1000);
                                ~~~~~                  ^~~~~~~~~~~~~~~~~
                                %03d
2016-02-29 20:19:42 +01:00
Frank Morgner ceb913a7bb Merge pull request #679 from l1k/master
GemSAFE ATR + format string fixes
2016-02-25 16:35:53 +01:00
Viktor Tarasov b8c3722bf5 pkcs11/framework: no more 'for-applications' mode for slot creation
Simplify create tokens rules, no need to manipulate applications in
'pkcs11' configuration part,
applications can be enabled/disabled on the 'pkcs15' one.

Fix the possibility to expose only 'sign' PIN
2016-02-24 13:39:27 +01:00
Lukas Wunner a020e1f7d4 pkcs11: Fix signedness issues in debug messages
Use the appropriate printf conversion for data->buffer_len which is
an unsigned int.
2016-02-20 14:27:27 +01:00
Frank Morgner 89f9d9e85d add compatibility implementation for strnlen
fixes https://github.com/OpenSC/OpenSC/issues/660
2016-01-20 10:47:27 +01:00
Frank Morgner e8d8f9f2bb Merge pull request #650 from vletoux/pkcs11-crash-when-read-public-key-fails
fix a pkcs11 crash when the public key reading fails

fixes #649
2016-01-06 07:30:15 +01:00
LE TOUX Vincent 6e5ae841eb fix a pkcs11 crash when the public key reading fails 2016-01-02 09:31:36 +01:00
Uri Blumenthal 76ed06981b Made sure attribute CKA_TOKEN is set to TRUE. 2015-12-22 13:31:42 -05:00
Uri Blumenthal 2b6b0ee05a According to PKCS#11 standard, public key should not have the
attribute CKA_SENSITIVE set to TRUE. This attribute is for
private and secret keys only.
2015-12-21 12:11:48 -05:00
Frank Morgner 5129c5a060 Fixed memory leaks 2015-12-09 08:22:45 +01:00
Frank Morgner 3384113616 reset `login_user` with `reset_login_state` 2015-12-06 10:42:45 +01:00
Frank Morgner b43ea19320 reset login_user on CKR_USER_NOT_LOGGED_IN 2015-12-06 10:42:45 +01:00
Frank Morgner 83ef753799 Implemented atomic PKCS#11 transactions 2015-12-06 10:42:45 +01:00
Michał Trojnara fa9da7ad01 configurable OS thread locking 2015-12-01 09:19:03 +01:00
Frank Morgner f13da8abfa removed unsupported opensc_pkcs11_install.js 2015-11-02 23:51:28 +01:00
Frank Morgner d6cea60500 Merge pull request #600 from vletoux/patch_openSSL
win32: link OpenSSL statically again
2015-11-01 20:59:49 +01:00
vletoux 8a47f238de win32: link OpenSSL statically again 2015-11-01 13:35:05 +01:00
Frank Morgner ad5d16927c fixed cflags for onepin module 2015-10-30 16:45:22 +01:00
Petr Spacek 52b6505909 export all C_* symbols
Header files distributed with PKCS#11 v2.30 define all functions as
extern and some applications (like BIND 9.10) do not work without all
functions.
2015-10-22 18:07:26 +02:00
Frank Morgner 851e0a24ff Merge pull request #571 from frankmorgner/label
Fixes accessing fixed size arrays
2015-10-14 18:56:29 +02:00
Olaf Kirch f42a1c2563 Replace outdated address okir@lst.de -> okir@suse.de
Signed-off-by: Olaf Kirch <okir@suse.de>
2015-10-05 14:07:28 +02:00
Frank Morgner 1046d951ba framework-pkcs15.c: fixed accessing label in sc_pkcs15_object_t 2015-10-04 17:33:14 +02:00
Frank Morgner f252277fab Add configuration for sloppy PKCS#11 initialization 2015-10-01 12:44:41 +02:00
Frank Morgner 3307dd6f45 implemented sloppy initialization for C_GetSlotInfo
Makes things work for Java and closes #523
2015-10-01 12:44:41 +02:00
Frank Morgner d551f9a8e0 avoid registering pkcs11 mechanisms multiple times
fixes #349
2015-09-07 09:53:02 +02:00
Martin Paljak 8da31d271e Fix for #183: export more symbols
- also export C_Initialize and C_Finalize to please vmware-view
- have a single pkcs11.exports file for both pkcs11-spy and opensc-pkcs11
2015-08-30 18:58:00 +03:00
Frank Morgner d7d64ee8d4 Merge pull request #494 from frankmorgner/fork
After a fork do not release resources shared with parent
2015-08-04 10:32:01 +02:00
Frank Morgner b3dc5ea32a fixed segfault for uninitialized IsoApplet
fixes #400
2015-07-27 18:43:51 +02:00
Frank Morgner 6cfd71c387 avoid double detecting card on uninitialized reader
initialize_reader already calls detect_card
2015-07-27 16:15:33 +02:00
Frank Morgner 7cec500e54 added flags to sc_context_t
- is initialized in sc_context_create with parm->flags
- removes members paranoid_memory and enable_default_driver
2015-07-22 17:30:21 +02:00
Frank Morgner edc839e072 restrict access to card handles after fork
fixes #333
closes #493
2015-07-22 16:46:04 +02:00
Doug Engert b48fa70308 sc_pkcs11_card improvements
This is name change only fix.

    The variable name "card" was being used to refer to a struct sc_card or a struct sc_pkcs11_card
    in some files including sc_pkcs11.h. In other files the variable name "p11card" is used for struct sc_pkcs11_card.
    This creates hard to read code, such as: slot->card->card.

    All definitations of sc_pkcs11_card *card now use p11card as the variable name.

Fix #471
2015-05-24 11:41:29 +02:00
Philip Wendland 78e434da93 register EC mechanisms with flags independent of RSA flags
Prior to this commit, all hashes registered for RSA or other key types were
registered for ECDSA as well.

register ECDH mechanism only when supported by card

ECDH should only be registered if the card driver sets the
SC_ALGORITHM_ECDH_CDH_RAW flag.

register software PKCS#1 (1.5) padding only when RAW RSA is supported by card

If OpenSC supports PSS/OAEP padding or other padding mechanisms in
future, and there would be a card that enforces hardware PSS/OAEP
padding, the PKCS#1 v1.5 padding mechanism should not be registered.
2015-05-08 20:45:27 +02:00
Frank Morgner ef4edb74ba fixed invalid free
We duplicate mechanisms based on OpenSSL so that they can be freed along
all the card's algorithms created via sc_pkcs11_new_fw_mechanism. Fixes
regression from eaf548aa3dab80a9bbf51da8291e7db978e3a2ad
2015-05-08 09:11:55 +02:00
Frank Morgner e338b7c1ab framework-pkcs15: fixed memory leak when encoding pubkey 2015-05-08 09:11:55 +02:00