Commit Graph

67 Commits

Author SHA1 Message Date
ludovic.rousseau bcba5c94a7 Fix slot.c:151: warning: ‘p11card’ may be used uninitialized in this
function


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4171 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-28 20:09:19 +00:00
ludovic.rousseau 227cb82612 Fix slot.c:234: warning: function declaration isn’t a prototype
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4170 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-28 20:08:30 +00:00
aj 6545b42c02 cleanup of the debug code:
* reduce to a few, supported functions.
* change all functions to take the debug level as parameter.
* use symbolic names for the debug levels.
* fix tools to pass "verbose"/"opt_debug" as ctx->debug.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4118 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-15 12:17:13 +00:00
aj d22a2483c0 Header file cleanup.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4081 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-04 08:14:36 +00:00
martin 0244baa494 pkcs11:
- slots, sessions and objects are kept as lists.
  - change the way slots, cards and readers are managed.
  - re-implement C_WaitForSlotEvent(/C_Finalize) as written in PCKS#11 v2.20, canceling pending blocking calls.
  - implement a "virtual hotplug slot" with a floating slot id to keep NSS working with C_WaitForSlotEvent with a new reader.
    NSS does not call C_GetSlotList(NULL) to re-fetch the list of available slots if C_WaitForSlotEvent returns an event in an already known slot ID.
    By changing the ID of a slot whenever a reader attached  NSS/Firefox can be tricked into recognizing new readers when waiting for events with C_WaitForSlotEvent.
  - change (possibly break something) sc_to_cryptoki_error() to not have side-effects
  - Implement CKU_CONTEXT_SPECIFIC in C_Login to implement CKA_ALWAYS_AUTHENTICATE (keys with user consent) 
 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3935 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-24 20:45:02 +00:00
martin 0876222c5f Make PKCS#11 module default slot configuration more sensible:
* Increase default slot count to 16, which equals 4 concurrent readers by default
  * 2 OpenCT + 2 PC/SC on Linux for example
 * Rename num_slots to slots_per_card
 * Rename internal PKCS#11 variables, remove unneeded defines.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3619 c6295689-39f2-0310-b995-f0e70906c6a9
2009-01-16 16:44:35 +00:00
ludovic.rousseau 6b89748111 slot_get_token(): return CKR_TOKEN_NOT_PRESENT if CKF_TOKEN_PRESENT is
not set.

Thanks to Douglas E. Engert for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2008-October/011361.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3583 c6295689-39f2-0310-b995-f0e70906c6a9
2008-10-10 09:39:27 +00:00
ludovic.rousseau 001f03f18d card_removed(): warning: comparison between signed and unsigned
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3582 c6295689-39f2-0310-b995-f0e70906c6a9
2008-10-09 13:05:13 +00:00
ludovic.rousseau 6eb3ecd107 card_initialize(): correctly associate a reader to each virtual slot.
Thanks to Douglas E. Engert for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2008-October/011359.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3581 c6295689-39f2-0310-b995-f0e70906c6a9
2008-10-09 12:59:02 +00:00
alonbl e237574742 Plug&Play support
This is not the best solution, but focus on smallest code change.

Changes:

1. Add detect_readers() to reader opts, this adds new readers to the end
   of the readers list until list is full.

2. Add sc_ctx_detect_readers() that calls readers' detect_readers().

3. Fixup pcsc_lock() so that it reconnect to the card and report proper
   error so caller may be notified if session was lost.

4. Allow context to be created without readers.

5. Call sc_ctx_detect_readers() from PKCS#11 C_GetSlotList with NULL_PTR.

6. Allow no reader at detect_card, as reader my be removed.

7. Since I broke ABI, I updated the external module version requirement
   to match OpenSC version. In the future a separate version should be
   maintained for each interface, this should be unrelated to the package
   version.

Alon

---

svn merge -r 3480:3505 https://www.opensc-project.org/svn/opensc/branches/alonbl/pnp

M    src/tools/opensc-tool.c
M    src/pkcs11/pkcs11-global.c
M    src/pkcs11/slot.c
M    src/libopensc/reader-pcsc.c
M    src/libopensc/internal-winscard.h
M    src/libopensc/ctx.c
M    src/libopensc/reader-ctapi.c
M    src/libopensc/libopensc.exports
M    src/libopensc/reader-openct.c
M    src/libopensc/opensc.h


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3506 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-29 17:01:19 +00:00
alonbl 56a4322c34 Convert constant SC_PKCS11_MAX_VIRTUAL_SLOTS to configuration option.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3404 c6295689-39f2-0310-b995-f0e70906c6a9
2008-03-06 15:04:29 +00:00
aj 5db87927d4 convert to utf-8.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3086 c6295689-39f2-0310-b995-f0e70906c6a9
2006-12-19 21:33:15 +00:00
aj 198b68a6d3 shorten string, fixing #98.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3009 c6295689-39f2-0310-b995-f0e70906c6a9
2006-08-27 18:25:43 +00:00
aj b07df40932 change more opensc.org references to opensc-project.org till dns is back.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2818 c6295689-39f2-0310-b995-f0e70906c6a9
2006-01-22 21:15:07 +00:00
nils ad647c66fa use sc_ctx_get_reader
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2676 c6295689-39f2-0310-b995-f0e70906c6a9
2005-10-30 21:44:05 +00:00
nils 5123be2b85 add two new functions
sc_reader_t *sc_ctx_get_reader(sc_context_t *ctx, unsigned int i);
	unsigned int sc_ctx_get_reader_count(sc_context_t *ctx);
to access the reader_count and the sc_reader objects (to avoid accessing
the sc_context members directly).
Use these functions in src/pkcs11 + error checking to avoid accessing
invalid sc_reader objects.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2595 c6295689-39f2-0310-b995-f0e70906c6a9
2005-09-16 10:18:55 +00:00
aj bf6808e3d8 "smart card" not "smartcard" or "SmartCard".
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2354 c6295689-39f2-0310-b995-f0e70906c6a9
2005-06-16 19:35:31 +00:00
aet df5e357694 - Whitespace cleanup from me and Martin Paljak
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2181 c6295689-39f2-0310-b995-f0e70906c6a9
2005-02-11 20:09:34 +00:00
nils 14ff6bdfc5 fix indent again
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2084 c6295689-39f2-0310-b995-f0e70906c6a9
2005-01-19 19:52:08 +00:00
nils cb5d576267 some indent fixes from Martin Paljak plus some additional changes from me
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2083 c6295689-39f2-0310-b995-f0e70906c6a9
2005-01-19 18:15:43 +00:00
sth 1c51a8f0dd Fix: if a card couldnt be read (e.g. inverted upside down), allow to retry it later when asked
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1817 c6295689-39f2-0310-b995-f0e70906c6a9
2004-07-09 15:33:35 +00:00
aj 4b4c20196b better checking for null values.
found and fixed reported by Victor Tarasov <vtarasov@idealx.com>


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1777 c6295689-39f2-0310-b995-f0e70906c6a9
2004-04-21 21:11:06 +00:00
aet 763fc16704 Rename libopensc specific error/debug to sc_error/sc_debug
We should have done this ages ago.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1392 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-25 14:21:18 +00:00
sth a8724bea78 In slot_initialize(): Bugfix in a memset and added a pool_initialize()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1218 c6295689-39f2-0310-b995-f0e70906c6a9
2003-06-24 11:11:49 +00:00
sth ca6a27e429 remove/insert fix: restore the slot->reader in slot_token_removed
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@943 c6295689-39f2-0310-b995-f0e70906c6a9
2003-03-07 14:18:55 +00:00
sth 32f532a782 fix: clear the CK_SLOT_INFO flags in slot_token_removed
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@936 c6295689-39f2-0310-b995-f0e70906c6a9
2003-03-03 13:03:59 +00:00
sth 0036545ffa fix in C_GetSlotInfo that previously cleared the slotDescription and didnt clear the CKF_TOKEN_PRESENT flag
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@934 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-28 12:47:32 +00:00
okir 870d9d9f66 - made card_detect() available to everyone
- C_GetSlotInfo now always does card detection, but only for the
  reader which which the slot is associated


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@913 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-17 14:57:51 +00:00
okir cf6037314f - Introduce locks around all pkcs11 operations, in case the caller
is multithreaded and wants to access us from different threads.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@912 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-17 14:21:38 +00:00
sth 58985e51c2 reset first_free_slot during C_Initialize
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@908 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-14 16:59:23 +00:00
okir 1c66025798 - Each reader now gets a fixed range of slots
- Each slot now shows the reader name in the description field


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@903 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-10 14:08:29 +00:00
okir 4ff3821a0a - suppress bogus insertion events
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@897 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-03 12:32:43 +00:00
okir 5276bbb1c4 - merged Stef's WaitForSlotEvent patches
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@895 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-03 12:20:54 +00:00
sth 16dfb55118 the slot's slotDescription is now the reader name
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@888 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-28 15:39:47 +00:00
sth dfc01ab7ed typo fix
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@885 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-27 13:43:06 +00:00
sth a383ed91d5 added return value + fix (needed if hide_empty_slots = true
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@883 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-27 13:17:08 +00:00
okir 69f8588f47 - added card_detect_all
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@868 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-20 09:50:33 +00:00
okir 5b1eb43b93 - add some support for card removal in pkcs11
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@867 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-19 17:47:07 +00:00
okir 0af2a35b9c - Another go at the empty slot/empty token issue
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@857 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-13 21:38:43 +00:00
okir 0babb91194 - Allow the admin to configure how many slots are used per card
(opensc.conf; pkcs11.num_slots)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@804 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-21 16:45:37 +00:00
okir c3b479fc82 - in case of an invalid session/object handle, return OBJECT_HANDLE_INVALID
or SESSION_HANDLE_INVALID instead of FUNCTION_DAILED


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@721 c6295689-39f2-0310-b995-f0e70906c6a9
2002-11-22 09:10:10 +00:00
okir 1556f98ba5 - put the definition of USE_PKCS15_INIT into a place where it can actually work
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@675 c6295689-39f2-0310-b995-f0e70906c6a9
2002-08-19 17:13:46 +00:00
jey 2fc2357639 - Fixed functionality when pkcs15init is not compiled
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@674 c6295689-39f2-0310-b995-f0e70906c6a9
2002-08-08 20:53:40 +00:00
fabled e2af6a1c8e - Ported pkcs11 module to win32.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@670 c6295689-39f2-0310-b995-f0e70906c6a9
2002-06-20 13:16:22 +00:00
okir 596220e821 - pkcs15-init does not require openssl anymore
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@523 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-15 13:42:10 +00:00
okir d4ee9df5ce - added new pkcs15init framework that implements C_InitToken
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@470 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-05 15:03:03 +00:00
aet fc170197d1 Add support for config.h
Remove old, obsolete and dead code


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@392 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-25 12:39:35 +00:00
okir 5006b0d151 - added some #include string.h statements for RH 7.2
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@357 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-21 09:36:38 +00:00
aet b098c097a1 Upgrade to current OpenSC API
Compiles, so far untested


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@229 c6295689-39f2-0310-b995-f0e70906c6a9
2002-02-25 12:04:39 +00:00
fabled e6ccf518da - many bug fixes in pkcs #11 module
- pkcs #11 module now creates public key objects too


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@193 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-24 16:27:09 +00:00