Commit Graph

35 Commits

Author SHA1 Message Date
Frank Morgner aed95b2f2b pkcs11: check inputs
prevents NULL pointer dereference
2019-01-30 21:57:59 +01:00
Frank Morgner 54cb1099a0 fixed warnings about precision loss 2018-11-01 00:17:22 +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
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
Frank Morgner d3c8fbcf1d fixed type of pkcs15init_initialize
regression from 95b6b4cc
2014-10-27 23:22:40 +01:00
Viktor Tarasov 10e1ad001d pkcs15init: change sc_pkcs15init_bind() prototype
Add new argument 'application-info',
that will allow to select the on-card application to by binded with.

pkcs11: use sc_pkcs15init_bind with 'AID' argument

Prototype of sc_pkcs15init_bind() has been changed to add argument with
AID of the on-card application to be binded with.
2012-05-26 09:36:25 +02:00
Viktor Tarasov 14049fb806 pkcs11: prepare internal API for multi-application mode
- simplify some of framework handles: remove from it's prototype the arguments that can be derived from the other arguments;
for exemple: foo(slot, slot->card) --> foo(slot)
- add the 'application' argument to the bind, unbind and similar handles;
- preview more then one framework data attached to the pkcs11card object.
- placehold for the future 'derive' and 'can_do' handles.
2012-05-22 17:18:00 +02:00
vtarasov 16abe7f3a7 pkcs11: Ticket #353: in pkcs15init framework allocate only one slot with uninitialized token ...
aldo, when allocating existing slot to the card, return an error if there is no more free virtual slot.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5434 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-09 17:11:13 +00:00
andre 82824402f4 framework-pkcs15init.c: Add missing initializers.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4962 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-17 16:30:12 +00:00
martin 8c9666d631 pkcs11: C_SeedRandom is not implemented by OpenSC nor most smart cards, nor does it fit well into PKCS#15 concept.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4662 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 06:23:26 +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
ludovic.rousseau 66fc414db7 Fix framework-pkcs15init.c:175: warning: initialization from
incompatible pointer type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4172 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-28 20:16:46 +00:00
viktor.tarasov 54d2b20fe2 pkcs11 framework: change prototype of the 'login' method
It gives the access to the 'slot' object inside the framework method 'login'.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4094 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-09 15:05:29 +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 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
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
ludovic.rousseau 0b239489fc completely initialize the sc_pkcs11_framework_ops structure (using NULL
for undefined callbacks)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3498 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-28 07:36:07 +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 47ee84e72d add functions
void sc_ctx_suppress_errors_on(sc_context_t *ctx);
	void sc_ctx_suppress_errors_off(sc_context_t *ctx);
to turn on/off error suppression (to avoid accessing
sc_context_t directly) and use it.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2671 c6295689-39f2-0310-b995-f0e70906c6a9
2005-10-30 19:08:06 +00:00
okir fffe5b79ef - Error logging changes: replace ctx->log_errors with ctx->suppress_errors
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1520 c6295689-39f2-0310-b995-f0e70906c6a9
2003-10-14 09:57:50 +00:00
sth 97da0b6149 Now you can specify your card profile for pkcs15init, both on the command line if you use the pkcs15init tool and in the opensc.conf file. Not specifying gives the default one, like before.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1212 c6295689-39f2-0310-b995-f0e70906c6a9
2003-06-18 08:07:12 +00:00
okir a7551e1822 - Patches from Stef implementing PKCS11 RNG related functions
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@866 c6295689-39f2-0310-b995-f0e70906c6a9
2003-01-16 20:10:28 +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 d22d1b13a4 - Another fix to mechanism handling: ripemd160 signatures should work now
- Got rid of get_mechanism_{list,info} in framework_ops, as they're not
  needed anymore.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@795 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-19 09:27:08 +00:00
okir 23158d7a96 - win32 patch from Stef Hoeben
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@769 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-10 17:47:19 +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
aet 2846d6ce3b Preliminary MacOS X build support, untested so far.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@617 c6295689-39f2-0310-b995-f0e70906c6a9
2002-06-03 15:18:47 +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 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 7e5af94455 - C_InitToken: after creating the application DF, switch to the
normal pkcs15 framework on the fly and mark all tokens as initialized.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@475 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-05 18:19:53 +00:00
aet ddb49064d6 Minor warning fixes
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@473 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-05 15:51:34 +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