Commit Graph

431 Commits

Author SHA1 Message Date
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
martin 04942bb4f6 * Correctly return CKR_PIN_INCORRECT if PIN is out of range.
* By Alon Bar-Lev from svn diff -r 3397:3398 https://www.opensc-project.org/svn/opensc/branches/alonbl/pkcs11-login-rv



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3400 c6295689-39f2-0310-b995-f0e70906c6a9
2008-02-29 10:18:51 +00:00
ludovic.rousseau 91288d4955 remove $(pkcs11dir)/opensc-pkcs11.so so that creating the symbolink link
does not fail if the file already exists.

Thanks to Jean-Pierre Szikora for the bug report


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3314 c6295689-39f2-0310-b995-f0e70906c6a9
2008-01-11 16:28:00 +00:00
ludovic.rousseau bf9d6beaac new patch for ruToken support
Thanks to Andrew V. Stepanov
http://www.opensc-project.org/pipermail/opensc-devel/2007-December/010631.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3310 c6295689-39f2-0310-b995-f0e70906c6a9
2008-01-03 08:59:14 +00:00
ludovic.rousseau 0ecc294ed8 add support of ruToken
Thanks to Andrew V. Stepanov for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2007-December/010617.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3304 c6295689-39f2-0310-b995-f0e70906c6a9
2007-12-17 13:39:20 +00:00
ludovic.rousseau 4bf320b304 add support of /usr/lib/pkcs11/ directory. See
http://wiki.cacert.org/wiki/Pkcs11TaskForce

Thanks to Alon Bar-Lev for the better patch


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3300 c6295689-39f2-0310-b995-f0e70906c6a9
2007-11-13 09:38:18 +00:00
aj 177ff402f3 fix typo, found by Gürer Özen.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3259 c6295689-39f2-0310-b995-f0e70906c6a9
2007-08-28 20:34:42 +00:00
aj 9a10cdeebd add cflags for ltdl.h where needed.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3245 c6295689-39f2-0310-b995-f0e70906c6a9
2007-08-13 19:10:26 +00:00
ludovic.rousseau 345ce22c63 use LTLIB_CFLAGS and LTLIB_LIBS instead of the global LIBS to find and use
libltdl

thanks to Alon Bar-Lev for the patch


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3243 c6295689-39f2-0310-b995-f0e70906c6a9
2007-08-13 08:30:19 +00:00
aj dea6f8b090 update pkcs11.h header file from scute.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3196 c6295689-39f2-0310-b995-f0e70906c6a9
2007-07-03 14:14:58 +00:00
aj 4ca4eba365 silence more warnings by gcc/sparse.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3189 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 13:58:38 +00:00
aj 0c604cb294 silence more warnings.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3183 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 12:58:57 +00:00
aj c66889dc9e fix broken changes.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3182 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 12:14:50 +00:00
aj de0ca91355 make sc_pkcs11_print_attrs non static.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3181 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 12:06:33 +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
aj 4cc1a50a49 Alessandro Premoli:
add support for reading, writing and deleting private (require cache_pins) and
public data objects in PKCS11. updated the pkcs11-tool and fixed a few
bugs in the code. Tested on an aladdin etoken.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3176 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 09:37:18 +00:00
aj a4cd33e77f Douglas E. Engert:
Looking at framework-pkcs11.c, it looks like there is a bug in the handling of
auth_count, if there is more then one pin, and one of the pins is a
SC_PKCS15_PIN_FLAG_SO_PIN. 

The for loop at line 767 will add a slot for each non SO_PIN or UNBLOCKING_PIN.
But at line 812, the auth_count is still set to the number of pins, even though
the SO_PIN did not cause a new slot to be allocated and thus the test of
hide_empty_tokens will not be used. 

With the attached patch, I can get the expected behavior when hide_empty_tokens
= yes in the opensc.conf from pkcs11-tool -L, pkcs11-tool -O and pkcs11-tool -O
-l 

There is only 1 slot allocated, the pkcs11-tool -O shows all the public
objects, and pkcs11-tool -O -l (after PIN) shows all the objects, and Heimdal
PKINIT still runs. 

I still think that if two or more slots need to be allocated for multiple auth
pins, then all the public objects should be added to each. I have an additional
mod for this too. 

Since the cards I am working with only have 1 pin, the attached mods works for
me. Note it looks like the pkcs15-openpgp.c might also be affected by this
change as it defines two pins an auth pin and a SO_PIN, much like the PIV card
does.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3175 c6295689-39f2-0310-b995-f0e70906c6a9
2007-06-21 07:11:21 +00:00
aj f065546ccd The framework-pkcs15 will filed the modulus in a certificate and copy it to a
pubkey or from apubkey to a privkey object. But it does not copy the
modulus_len. 

This patch will look at pub_info->modulus_len and prv_info->modulus_len and
copy the modulus_len while copying the modulus.  This will be used with the
pkcs15-piv code when it creates pub and priv objects, as it has no way other
then from the certificates to know the modulus_len.

By  Douglas E. Engert.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3171 c6295689-39f2-0310-b995-f0e70906c6a9
2007-05-25 20:06:59 +00:00
aj e3935077e1 enable pin caching by default.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3158 c6295689-39f2-0310-b995-f0e70906c6a9
2007-04-24 07:54:18 +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
martin d0a0103c70 Build a pkcs11 module with only one pin exposed to overcome issues described in #132. Closes #132
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3145 c6295689-39f2-0310-b995-f0e70906c6a9
2007-03-29 10:25:16 +00:00
aj eab8ade2ec changes by Douglas E. Engert:
change the do_decompress* to sc_decompress* and the initialize_* to
sc_pkcs15emu_initialize_* in the new code.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3126 c6295689-39f2-0310-b995-f0e70906c6a9
2007-03-12 20:15:39 +00:00
nils a2f622a215 implement support for SHA2 (still experimental)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3115 c6295689-39f2-0310-b995-f0e70906c6a9
2007-02-02 22:15:14 +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 d537651ab7 update to latest pkcs11.h version.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3075 c6295689-39f2-0310-b995-f0e70906c6a9
2006-12-18 07:42:06 +00:00
nils f23ddbdba1 make it work with my compiler, add missing parenthesis
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3074 c6295689-39f2-0310-b995-f0e70906c6a9
2006-12-10 13:33:34 +00:00
aj 9aa18ea1ce update to latest pkcs11.h from Marcus.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3073 c6295689-39f2-0310-b995-f0e70906c6a9
2006-12-10 07:57:22 +00:00
aj 44d54b68dd pkcs11.h with updates from Alon.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3071 c6295689-39f2-0310-b995-f0e70906c6a9
2006-12-09 15:41:27 +00:00
aj b9daff9b28 replace rsa pkcs#11 header files with rewrite.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3066 c6295689-39f2-0310-b995-f0e70906c6a9
2006-11-30 08:11:58 +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
nils a946dc98bf set CKF_USER_PIN_INITIALIZED only if we really have a pin object
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3033 c6295689-39f2-0310-b995-f0e70906c6a9
2006-09-27 22:10:12 +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
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 4608716c53 Douglas E. Engert:
Change PKCS11-Spy so it looks in HKEY_LOCAL_MACHINE, before
HKEY_LOCAL_USER.

This should not cause any problems, as the HKEY_LOCAL_MACHINE,
"Software\PKCS11-Spy" would not normally be set, accept while
the sysadmin of the machine as trying to debug a login type problem. 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3006 c6295689-39f2-0310-b995-f0e70906c6a9
2006-08-13 21:20:05 +00:00
nils aec987df38 build fixes for win; patch supplied by Douglas E. Engert <deengert@anl.gov>
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3005 c6295689-39f2-0310-b995-f0e70906c6a9
2006-08-03 21:05:59 +00:00
nils 42ad6be451 win build fixes; patch supplied by Douglas E. Engert <deengert@anl.gov>
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3003 c6295689-39f2-0310-b995-f0e70906c6a9
2006-08-02 19:31:34 +00:00
nils 6df2a05975 bring implementation in accordance with the docu in opensc.conf
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2976 c6295689-39f2-0310-b995-f0e70906c6a9
2006-06-21 20:05:17 +00:00
aj f9dd89e53b sprintf bad. maybe even potential exploitable?
bug found by ville skytta using pscan.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2964 c6295689-39f2-0310-b995-f0e70906c6a9
2006-05-23 20:53:15 +00:00
aj 0f64e9d3f1 make objects on piv card public.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2957 c6295689-39f2-0310-b995-f0e70906c6a9
2006-05-20 16:06:42 +00:00
aj c7a5ce3b50 revert prior change as it breaks the regression tests.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2956 c6295689-39f2-0310-b995-f0e70906c6a9
2006-05-20 16:05:14 +00:00
nils bfe05f31dc check for existing public key before creating one from the certificate; patch supplied by Albert Solana <asb@c3po.es>
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2953 c6295689-39f2-0310-b995-f0e70906c6a9
2006-05-15 18:48:30 +00:00
aj 45007b3da7 compile fixes for win32.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2949 c6295689-39f2-0310-b995-f0e70906c6a9
2006-05-12 20:01:26 +00:00
nils b28f8ed9c4 improve buffer length check
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2943 c6295689-39f2-0310-b995-f0e70906c6a9
2006-05-09 21:35:07 +00:00
nils 0c39b21b99 set the default for lock_login to false (as documented in opensc.conf)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2941 c6295689-39f2-0310-b995-f0e70906c6a9
2006-05-05 10:35:02 +00:00
aj 449a1841b1 free(data)
(allocated by sc_pkcs15_read_data_object, no reference kept anywhere).


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2930 c6295689-39f2-0310-b995-f0e70906c6a9
2006-05-01 10:20:22 +00:00
aj ab0066b0d7 fix printf size_t problem with "%lu" and (unsigned long) cast.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2923 c6295689-39f2-0310-b995-f0e70906c6a9
2006-05-01 10:02:50 +00:00
aj 41ff15ec1f fix signed and size_t warnings.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2916 c6295689-39f2-0310-b995-f0e70906c6a9
2006-04-26 11:41:57 +00:00
aj beb55b8104 not sure it is a good idea to ignore the return value.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2898 c6295689-39f2-0310-b995-f0e70906c6a9
2006-04-26 10:00:23 +00:00
aj 347c5b0496 remove a function that is no longer used at all.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2888 c6295689-39f2-0310-b995-f0e70906c6a9
2006-04-18 15:15:45 +00:00
nils b791b1d6bc check the private flag of public key objects; patch supplied by Albert Solana <asb@c3po.es>
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2879 c6295689-39f2-0310-b995-f0e70906c6a9
2006-03-24 10:55:33 +00:00