Commit Graph

145 Commits

Author SHA1 Message Date
martin 113dfda494 EstEID: add support for v 3.0 cards with 2048b keys
* Detect different cards based on ATR-s and on card objects
 * Set the card name from the ATR table
 * Conditionally add support for 2048b keys
 * Add workarounds for broken MULTOS and JavaCard cards.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4893 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 14:22:01 +00:00
martin 8af1b60afd PC/SC: temporarily disable blocking C_WaitForSlotEvent until a checked version for pcsc-lite 1.5.3-1.6.4 exists.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4835 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-28 13:33:50 +00:00
martin 8156095b46 FIXME: Don't issue SCardCancel unless the environment is known not to hang (part 1)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4833 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-28 09:44:22 +00:00
martin 528b7ae7c7 pkcs11: move around CKR_ARGUMENTS_BAD check
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4749 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:40 +00:00
martin 93da2252c7 pkcs11: #250: refresh PIN counters and associated token flags on every call to C_GetTokenInfo
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4692 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 16:53:08 +00:00
martin 4f03502b60 pkcs11: check PKCS#11 function parameters for obvious errors and return CKR_ARGUMENTS_BAD early without locking the module.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4647 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-23 14:47:14 +00:00
ludovic.rousseau f47416d60e Do not cast the return value of malloc(3) and calloc(3)
From http://en.wikipedia.org/wiki/Malloc#Casting_and_type_safety
" Casting and type safety

malloc returns a void pointer (void *), which indicates that it is a
pointer to a region of unknown data type. One may "cast" (see type
conversion) this pointer to a specific type, as in

int *ptr = (int*)malloc(10 * sizeof (int));

When using C, this is considered bad practice; it is redundant under the
C standard. Moreover, putting in a cast may mask failure to include the
header stdlib.h, in which the prototype for malloc is found. In the
absence of a prototype for malloc, the C compiler will assume that
malloc returns an int, and will issue a warning in a context such as the
above, provided the error is not masked by a cast. On certain
architectures and data models (such as LP64 on 64 bit systems, where
long and pointers are 64 bit and int is 32 bit), this error can actually
result in undefined behavior, as the implicitly declared malloc returns
a 32 bit value whereas the actually defined function returns a 64 bit
value. Depending on calling conventions and memory layout, this may
result in stack smashing.

The returned pointer need not be explicitly cast to a more specific
pointer type, since ANSI C defines an implicit conversion between the
void pointer type and other pointers to objects. An explicit cast of
malloc's return value is sometimes performed because malloc originally
returned a char *, but this cast is unnecessary in standard C
code.[4][5] Omitting the cast, however, creates an incompatibility with
C++, which does require it.

The lack of a specific pointer type returned from malloc is type-unsafe
behaviour: malloc allocates based on byte count but not on type. This
distinguishes it from the C++ new operator that returns a pointer whose
type relies on the operand. (see C Type Safety). "

See also
http://www.opensc-project.org/pipermail/opensc-devel/2010-August/014586.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4636 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-18 15:08:51 +00:00
martin ea7a0ac9a1 pkcs11: move the slot list size check to slot creation.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4419 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-16 13:43:10 +00:00
martin 02f4507564 pkcs11: Patch from Andre Zepezauer to remove max_virtual_slots allocation.
See http://www.opensc-project.org/pipermail/opensc-devel/2010-June/014356.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4417 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-16 13:42:59 +00:00
ludovic.rousseau e6803d9ca0 Use CK_RV (defined as unsigned long) instead of int for the type the
return code of C_* functions

Thanks to Martin Vogt for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2010-June/014351.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4415 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-16 11:43:10 +00:00
ludovic.rousseau eab7adea12 pkcs11-global.c: In function ‘C_WaitForSlotEvent’:
pkcs11-global.c:624: warning: unused variable ‘ii’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4414 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-16 11:32:21 +00:00
s c5c649e0ea fix: memory leak
example:

int main()
{
        C_Initialize(NULL);
        C_Finalize(NULL);
        return 0;
}

==4625== 592 (504 direct, 88 indirect) bytes in 1 blocks are definitely lost
in loss record 9 of 10
==4625==    at 0x4C24137: calloc (vg_replace_malloc.c:418)
==4625==    by 0x407FD9: create_slot (slot.c:80)
==4625==    by 0x40452C: C_Initialize (pkcs11-global.c:243)
==4625==    by 0x40342A: main
==4625==
==4625== 4,736 (4,032 direct, 704 indirect) bytes in 8 blocks are definitely
lost in loss record 10 of 10
==4625==    at 0x4C24137: calloc (vg_replace_malloc.c:418)
==4625==    by 0x407FD9: create_slot (slot.c:80)
==4625==    by 0x408102: initialize_reader (slot.c:108)
==4625==    by 0x4044E0: C_Initialize (pkcs11-global.c:247)
==4625==    by 0x40342A: main
==4625==
==4625== LEAK SUMMARY:
==4625==    definitely lost: 4,536 bytes in 9 blocks



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4386 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-30 07:31:31 +00:00
viktor.tarasov 73c516a7a0 pkcs11: resolve 'endless polling' in C_WaitForSlotEvent()
http://www.opensc-project.org/pipermail/opensc-devel/2010-April/013947.html

Tested with Firefox 3.6.3 in WinXP SP3 .




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4363 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-19 09:18:38 +00:00
viktor.tarasov 0400a2dc35 pkcs11: make possible context dependent 'sc' to 'cryptoki' error conversion
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4262 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-21 10:51:13 +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 b9f844c367 [PKCS#11] use combined constants for events
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3989 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-03 10:10:43 +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 56fb57603b Merge [3758:3783/trunk]
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3785 c6295689-39f2-0310-b995-f0e70906c6a9
2009-10-22 09:18:16 +00:00
martin 446fe0f18d PKCS#11: Spec does not allow CKR_DEVICE_ERROR from C_Initialize
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3725 c6295689-39f2-0310-b995-f0e70906c6a9
2009-09-14 08:59:58 +00:00
martin d672fde449 Remove sc_error and sc_ctx_suppress_errors_* in favor of sc_debug/fprintf
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3721 c6295689-39f2-0310-b995-f0e70906c6a9
2009-09-14 08:46:59 +00:00
alonbl 17cf43eeb1 Rename PKCS#11 v2_20_mode option to plug_and_play
As it is the only feature it controls.
Also, change the default to true.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3637 c6295689-39f2-0310-b995-f0e70906c6a9
2009-01-23 09:14:15 +00:00
alonbl fbd51c705e Revert 3630
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3631 c6295689-39f2-0310-b995-f0e70906c6a9
2009-01-20 08:42:47 +00:00
alonbl ce5c5f3ae9 Add SCARD_E_NO_SERVICE to internal-winscard.h
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3630 c6295689-39f2-0310-b995-f0e70906c6a9
2009-01-19 19:43:19 +00:00
martin c58bcfab84 Configurable for PKCS#11 v2.20 related changes.
- Correctly report Cryptoki version if v2.20 is used.
 - Consistently report no version for hardware/software we know no version information about.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3627 c6295689-39f2-0310-b995-f0e70906c6a9
2009-01-19 12:06:38 +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
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 e4eeba26cd Fix MSVC compiler error
http://www.opensc-project.org/pipermail/opensc-devel/2008-April/010997.html

Thanks to Douglas E. Engert


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3459 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-04 16:21:08 +00:00
alonbl 0a809dd5cb Complete rewrite of OpenSC build system.
1.  Build system now supports MinGW (Windows) compilation using msys and cross compilation.
2.  Ability to explicitly disable and enable dependencies of the package.
3.  openct, pcsc and nsplugins features are disabled by default.
4.  Modified pcsc driver to use pcsc dynamically, no compile time dependency is required.
5.  --enable-pcsc-lite configuration option renamed to --enable-pcsc.
6.  Install opensc.conf file (as opensc.conf.new if opensc.conf exists).
7.  Add--enable-doc configuration option, allow installing documentation into target.
8.  Add --disable-man configuration option, allow msys mingw32 users to
    build from svn without extra dependencies.
9.  Add export files to each library in order to export only required symbols.
    Windows native build may use these files instead of scanning objects' symbols.
10. Add opensc-tool --info to display some general information about the build.
11. Create compatibility library to be linked against library instread of recompiling the
    same source files in different places.
12. Add different win32 version resource to each class of outputs.
13. Make xsl-stylesheets location selectable.
14. Some win32 fixups.
15. Some warning fixups.
16. Many other autoconf/automake cleanups.

Alon Bar-Lev

svn diff -r 3315:3399 https://www.opensc-project.org/svn/opensc/branches/alonbl/mingw

_M   .
D    configure.in
_M   src
_M   src/openssh
M    src/openssh/Makefile.am
_M   src/tools
M    src/tools/rutoken-tool.c
M    src/tools/opensc-tool.c
M    src/tools/cardos-info.c
M    src/tools/pkcs15-crypt.c
M    src/tools/pkcs15-init.c
M    src/tools/piv-tool.c
M    src/tools/netkey-tool.c
M    src/tools/eidenv.c
M    src/tools/cryptoflex-tool.c
M    src/tools/util.c
M    src/tools/pkcs11-tool.c
M    src/tools/pkcs15-tool.c
M    src/tools/util.h
M    src/tools/opensc-explorer.c
M    src/tools/Makefile.am
_M   src/pkcs11
M    src/pkcs11/pkcs11-global.c
M    src/pkcs11/framework-pkcs15.c
M    src/pkcs11/mechanism.c
M    src/pkcs11/pkcs11-display.c
M    src/pkcs11/pkcs11-object.c
A    src/pkcs11/opensc-pkcs11.exports
M    src/pkcs11/sc-pkcs11.h
M    src/pkcs11/pkcs11-spy.c
M    src/pkcs11/openssl.c
M    src/pkcs11/Makefile.am
A    src/pkcs11/pkcs11-spy.exports
_M   src/tests
_M   src/tests/regression
M    src/tests/regression/Makefile.am
M    src/tests/sc-test.c
M    src/tests/pintest.c
M    src/tests/Makefile.am
_M   src/include
_M   src/include/opensc
M    src/include/opensc/Makefile.am
A    src/include/opensc/svnignore
M    src/include/Makefile.am
_M   src/signer
_M   src/signer/npinclude
M    src/signer/npinclude/Makefile.am
M    src/signer/Makefile.am
A    src/signer/signer.exports
_M   src/common
A    src/common/compat_dummy.c
D    src/common/getopt.txt
D    src/common/strlcpy.c
D    src/common/LICENSE
A    src/common/compat_getopt.txt
A    src/common/compat_strlcpy.c
A    src/common/LICENSE.compat_getopt
A    src/common/compat_getopt.c
D    src/common/strlcpy.h
D    src/common/ChangeLog
D    src/common/getpass.c
D    src/common/my_getopt.c
A    src/common/compat_strlcpy.h
A    src/common/compat_getpass.c
A    src/common/compat_getopt.h
A    src/common/ChangeLog.compat_getopt
D    src/common/README.strlcpy
D    src/common/my_getopt.h
A    src/common/compat_getpass.h
A    src/common/README.compat_strlcpy
D    src/common/strlcpy.3
A    src/common/README.compat_getopt
D    src/common/getopt.3
D    src/common/README.my_getopt
A    src/common/compat_strlcpy.3
A    src/common/compat_getopt.3
M    src/common/Makefile.am
M    src/Makefile.am
_M   src/pkcs15init
M    src/pkcs15init/pkcs15-oberthur.c
M    src/pkcs15init/profile.c
M    src/pkcs15init/pkcs15-lib.c
M    src/pkcs15init/pkcs15-rutoken.c
A    src/pkcs15init/pkcs15init.exports
M    src/pkcs15init/pkcs15-gpk.c
M    src/pkcs15init/Makefile.am
_M   src/scconf
M    src/scconf/Makefile.am
M    src/scconf/parse.c
A    src/scconf/scconf.exports
_M   src/libopensc
M    src/libopensc/card-rutoken.c
M    src/libopensc/compression.c
M    src/libopensc/sc.c
M    src/libopensc/card-piv.c
M    src/libopensc/pkcs15-openpgp.c
M    src/libopensc/pkcs15-postecert.c
M    src/libopensc/pkcs15-tcos.c
M    src/libopensc/opensc-config.in
M    src/libopensc/reader-pcsc.c
A    src/libopensc/internal-winscard.h
M    src/libopensc/ctx.c
A    src/libopensc/libopensc.exports
M    src/libopensc/pkcs15-piv.c
M    src/libopensc/pkcs15-infocamere.c
M    src/libopensc/internal.h
M    src/libopensc/pkcs15-actalis.c
M    src/libopensc/pkcs15-starcert.c
M    src/libopensc/card-oberthur.c
M    src/libopensc/pkcs15-atrust-acos.c
M    src/libopensc/p15card-helper.c
D    src/libopensc/part10.h
M    src/libopensc/ui.c
M    src/libopensc/card-gpk.c
M    src/libopensc/pkcs15-wrap.c
M    src/libopensc/pkcs15-gemsafeGPK.c
M    src/libopensc/log.c
M    src/libopensc/pkcs15-esteid.c
M    src/libopensc/pkcs15-prkey-rutoken.c
M    src/libopensc/log.h
M    src/libopensc/Makefile.am
M    src/libopensc/reader-openct.c
_M   aclocal
M    aclocal/Makefile.am
_M   win32
M    win32/Makefile.am
A    win32/versioninfo.rc.in
A    win32/ltrc.inc
A    configure.ac
_M   doc
_M   doc/tools
M    doc/tools/pkcs15-profile.xml
D    doc/changelog.sh
D    doc/export-wiki.xsl
_M   doc/api
_M   doc/api/file
M    doc/api/man.xsl
_M   doc/api/asn1
_M   doc/api/apps
_M   doc/api/init
_M   doc/api/types
_M   doc/api/card
M    doc/api/html.xsl
_M   doc/api/misc
_M   doc/api/util
M    doc/Makefile.am
D    doc/export-wiki.sh
AM   doc/nonpersistent
A    doc/nonpersistent/export-wiki.xsl
A    doc/nonpersistent/Makefile.am
A    doc/nonpersistent/export-wiki.sh
A    doc/nonpersistent/svn2cl.xsl
D    doc/generate-man.sh
D    doc/svn2cl.xsl
M    Makefile.am
A    svnignore
_M   etc
M    etc/opensc.conf.in
M    etc/Makefile.am
D    man
_M   solaris
M    solaris/Makefile



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3405 c6295689-39f2-0310-b995-f0e70906c6a9
2008-03-06 16:06:59 +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
alonbl 1875a25c40 PKCS#11 "Application and processes" instructs the sequence
that should be taken after fork().
Applications should call C_Initialize() immediately after fork()
to reinitialize the provider.

The change monitor the pid that calls C_Initialize(), if it is
different than previous C_Finalize() is called.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3402 c6295689-39f2-0310-b995-f0e70906c6a9
2008-03-06 14:56:31 +00:00
aj 4f0329cd18 silence more gcc/sparse warnings.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3180 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 12:01:39 +00:00
nils ef7d8ffa86 bugfix: don't use the size of a void pointer, thanks to Carl Przybylek <crprzyby@gmail.com>
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3146 c6295689-39f2-0310-b995-f0e70906c6a9
2007-04-01 17:03:08 +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
nils 65658db6e4 make the decision which locking functions to use more explicit; patch supplied by Martin
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3040 c6295689-39f2-0310-b995-f0e70906c6a9
2006-10-02 17:26:48 +00:00
ludovic.rousseau 3e2e82dde9 C_GetInfo(): use "OpenSC (www.opensc-project.org)" instead of
"OpenSC Project (www.opensc-project.org)" for the manufacturerID to
avoid a truncation at 32 characters


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3012 c6295689-39f2-0310-b995-f0e70906c6a9
2006-09-14 08:55:06 +00:00
martin 9213a29a34 Small fixes for windows compilation (Visual Studio Express 2005)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2855 c6295689-39f2-0310-b995-f0e70906c6a9
2006-02-23 11:02:24 +00:00
nils 8e77e87551 sc_mutex_destroy should have a return value
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2832 c6295689-39f2-0310-b995-f0e70906c6a9
2006-02-05 19:35:55 +00:00
nils 5c3aed1189 - remove dependence on a specific threading library
- add two new structures: sc_thread_context_t which let
  the user specify the mutex functions to use and
  sc_context_param_t to specify parameters for the sc_context_t
  creation (including mutex functions) using sc_create_context()
- add new function sc_context_create()  
- remove timestamp code from libopensc


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2829 c6295689-39f2-0310-b995-f0e70906c6a9
2006-02-01 22:59:42 +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
sth 551bcc89fa Referted the 'Fireofox 1.5' fix in log.c and replaced it by letting a blocking C_WaitForSlotEvent() return CKR_FUNCTION_NOT_SUPPORTED. This isn't a solution for the multihread problems (things hang or try to log to a released context) but at least it solves the Ff 1.5 problems
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2777 c6295689-39f2-0310-b995-f0e70906c6a9
2005-12-23 10:15:17 +00:00
sth 912946bf3f Fix for ticket #45: Firefox 1.5 and new Mozilla's crash when they are closed because there's a blocking C_WaitForSlotEvent() called from another thread then the 'main' thread that calls C_Finalize(); and this cause C_WaitForSlotEvent() to log to a NULL context -> assertion failure.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2762 c6295689-39f2-0310-b995-f0e70906c6a9
2005-12-08 20:25:54 +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
aj 7133146d28 put new version in pkcs11-global.c, too.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2259 c6295689-39f2-0310-b995-f0e70906c6a9
2005-03-23 22:37:06 +00:00
bert eb4717ea17 API fixup: use defined type instead of struct for exposed structs (part 2)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2233 c6295689-39f2-0310-b995-f0e70906c6a9
2005-03-09 00:04:44 +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 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
nils 3931ee708d cleanup ...
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2041 c6295689-39f2-0310-b995-f0e70906c6a9
2004-12-22 10:17:00 +00:00
nils bfd5b49436 pkcs15-init etc. support for pkcs15 data objects
patch supplied by Victor Tarasov <vtarasov@idealx.com>


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1877 c6295689-39f2-0310-b995-f0e70906c6a9
2004-07-26 18:47:23 +00:00
aet 603ccec619 - Fixed nightly snapshot generation
- Link keycache.h to src/include/opensc
- Move mutex function declarations to opensc.h


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1525 c6295689-39f2-0310-b995-f0e70906c6a9
2003-10-14 21:56:56 +00:00
aet 6857ffa11a Update PKCS#11 library version to 0.8.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1443 c6295689-39f2-0310-b995-f0e70906c6a9
2003-09-12 10:36:23 +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
aet 2b3db944e0 - Rename sysdep_timestamp_t to sc_timestamp_t
- Add missing function prototype for sc_current_time


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1384 c6295689-39f2-0310-b995-f0e70906c6a9
2003-08-18 14:54:37 +00:00
sth f417883e15 Avoid an Assertion Failed (ctx!=NULL) in log.c if sc_establish_context() fails in C_Initialize()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1075 c6295689-39f2-0310-b995-f0e70906c6a9
2003-04-28 09:55:36 +00:00
sth 2698dc6cec Have a compile option to enable PTHREAD locking at the pkcs11 level
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1070 c6295689-39f2-0310-b995-f0e70906c6a9
2003-04-24 07:03:48 +00:00
sth a9692c9c46 Disabled OS thread locking on OSes with PTHREAD due to closing problems with Mozilla
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1067 c6295689-39f2-0310-b995-f0e70906c6a9
2003-04-23 09:52:09 +00:00
sth b05aadce59 Have a sec delay in C_GetSlotInfo() per reader instead of a global delay
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1048 c6295689-39f2-0310-b995-f0e70906c6a9
2003-04-18 11:58:11 +00:00
sth f801d14ffd Removed some errors that occured with unsupported cards
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@996 c6295689-39f2-0310-b995-f0e70906c6a9
2003-04-11 14:22:52 +00:00
sth ac4b6dc45f Fix: card detection in C_GetSlotInfo is done at most once a second
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@969 c6295689-39f2-0310-b995-f0e70906c6a9
2003-04-02 06:59:19 +00:00
okir 66a8076baa - more robust handling of concurrent WaitForSlotEvent vs Finalize
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@937 c6295689-39f2-0310-b995-f0e70906c6a9
2003-03-03 13:07:28 +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
sth 5c1ae16ac8 fixed wrong return value in C_Finalize
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@931 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-23 20:10:24 +00:00
sth 49760f9cfb fixed some thread dead-lock bugs
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@930 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-23 19:38:50 +00:00
sth d9e99b0e17 little fix in C_GetInfo
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@927 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-21 15:40:06 +00:00
sth b75ea0a0b2 more parameter checks + fix in previous checks
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@917 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-19 21:10:39 +00:00
sth 958658102d added check for NULL pointers and uninitialized pkcs11 lib
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@916 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-19 13:44:36 +00:00
sth c05cef9678 correct behaviour of C_GetSlotInfo at empty slots
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@914 c6295689-39f2-0310-b995-f0e70906c6a9
2003-02-17 16:53:49 +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 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
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 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 1c22c55655 - Try to fix pkcs11.hide_empty_slots
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@818 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-03 11:40:11 +00:00
okir d1fa35e1d0 - slightly changed previous patch; new flag hide_empty_slots
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@805 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-22 11:50:41 +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 21dfabee27 - New mechanism framework
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@775 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-17 11:49:12 +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
aet 3dccd63989 - C++ support. Compiles with gcc/g++ for Linux, otherwise
completely untested.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@574 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-19 14:23:31 +00:00
okir 53a112eda2 - implemented C_InitPIN (based on pkcs15init)
- C_Login now understands the SO PIN.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@502 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-08 15:51:19 +00:00
okir d28bb6082a - Added C_Initialize
- Minor bugfix in C_Finalize


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@468 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-05 15:02:18 +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
aet ec6f8961b0 Don't hardcode initial debugging level and error/debug_file
pointers to the code, get the values from opensc.conf instead.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@386 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-24 21:56:13 +00:00
aet 0cad904c86 Move opensc/src/scldap/etc to opensc/etc
SCLDAP_CONFIG -> SCLDAP_CONF_PATH
Upgrade the rest of the programs to use new core API


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@380 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-24 15:41:33 +00:00
jey f21926af00 - Started to add configuration file support to
libopensc
- Added typedefs for some basic structs (e.g.
  struct sc_card --> sc_card_t)
- Added a second argument to sc_establish_context()
  to identify the calling application
- Renamed sc_destroy_context() to sc_release_context()


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@378 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-24 14:12:38 +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
okir 6d4988f12a - set debug log file and libopensc debug level via environment vars
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@334 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-15 11:41:16 +00:00
jey c1cac5f311 - bumped up version number in preparation of the new release
- unified PKCS #15 DF decoding
- added PKCS #15 file caching


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@191 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-24 16:02:54 +00:00
aet ec83c728ad Silence debug messages by default for upcoming release
README update


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@190 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-24 12:56:08 +00:00
jey cfa366d7e6 - fixed a few typos
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@188 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-22 16:43:38 +00:00
fabled 82a2d72e6a Many bugfixes including segfault in card detection and C_GetSlotInfo
now detects the cards too.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@185 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-22 14:44:56 +00:00
jey f1582007f6 - improved file selection on Cryptoflex cards
- fixed an incompatability in PKCS #11 module


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@178 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-21 09:05:22 +00:00
aet a55a073636 README cleanups
Fix compiler warnings


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@174 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-17 12:05:44 +00:00
fabled 6e6d7177f0 Rewritten implementation of pkcs#11 module. Semiworking.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@164 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-16 22:49:03 +00:00