Re: [opensc-commits] svn opensc changed [2480] initialize sc_pkcs15init_operations at compile time

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [opensc-commits] svn opensc changed [2480] initialize sc_pkcs15init_operations at compile time

Stef Hoeben
Hi Nils,

the . initialisation doesn't work on MS Visual Studio 6.0
(not the latest compiler) but still much used..

Cheers,
Stef

[hidden email] wrote:

>Revision: 2480
>Author:   nils
>Date:     2005-08-10 21:31:18 +0000 (Wed, 10 Aug 2005)
>
>Log Message:
>-----------
>initialize sc_pkcs15init_operations at compile time
>
>Modified Paths:
>--------------
>    trunk/src/pkcs15init/pkcs15-cflex.c
>    trunk/src/pkcs15init/pkcs15-etoken.c
>    trunk/src/pkcs15init/pkcs15-gpk.c
>    trunk/src/pkcs15init/pkcs15-jcop.c
>    trunk/src/pkcs15init/pkcs15-miocos.c
>    trunk/src/pkcs15init/pkcs15-oberthur.c
>    trunk/src/pkcs15init/pkcs15-starcos.c
>Modified: trunk/src/pkcs15init/pkcs15-cflex.c
>===================================================================
>--- trunk/src/pkcs15init/pkcs15-cflex.c 2005-08-10 21:00:52 UTC (rev 2479)
>+++ trunk/src/pkcs15init/pkcs15-cflex.c 2005-08-10 21:31:18 UTC (rev 2480)
>@@ -855,46 +855,41 @@
>         return 0;
> }
>
>-static struct sc_pkcs15init_operations sc_pkcs15init_cryptoflex_operations;
>-static struct sc_pkcs15init_operations sc_pkcs15init_cyberflex_operations;
>+static struct sc_pkcs15init_operations sc_pkcs15init_cryptoflex_operations = {
>+ .erase_card = cflex_erase_card,
>+ .init_card = cryptoflex_init_card,
>+ .create_dir = cflex_create_dir,
>+ .create_domain = cflex_create_domain,
>+ .select_pin_reference = cflex_select_pin_reference,
>+ .create_pin = cflex_create_pin,
>+ .create_key = cflex_create_key,
>+ .generate_key = cflex_generate_key,
>+ .store_key = cflex_store_key,
>+ .encode_private_key = cryptoflex_encode_private_key,
>+ .encode_public_key = cryptoflex_encode_public_key
>+};
>
>+static struct sc_pkcs15init_operations sc_pkcs15init_cyberflex_operations = {
>+ .erase_card = cflex_erase_card,
>+ .create_dir = cflex_create_dir,
>+ .create_domain = cflex_create_domain,
>+ .select_pin_reference = cflex_select_pin_reference,
>+ .create_pin = cflex_create_pin,
>+ .create_key = cflex_create_key,
>+ .generate_key = cflex_generate_key,
>+ .store_key = cflex_store_key,
>+ .encode_private_key = cyberflex_encode_private_key,
>+ .encode_public_key = cyberflex_encode_public_key
>+};
>+
> struct sc_pkcs15init_operations *
> sc_pkcs15init_get_cryptoflex_ops(void)
> {
>- struct sc_pkcs15init_operations *ops;
>-
>- ops = &sc_pkcs15init_cryptoflex_operations;
>- ops->erase_card = cflex_erase_card;
>- ops->init_card = cryptoflex_init_card;
>- ops->create_dir = cflex_create_dir;
>- ops->create_domain = cflex_create_domain;
>- ops->select_pin_reference = cflex_select_pin_reference;
>- ops->create_pin = cflex_create_pin;
>- ops->create_key = cflex_create_key;
>- ops->generate_key = cflex_generate_key;
>- ops->store_key = cflex_store_key;
>- ops->encode_private_key = cryptoflex_encode_private_key;
>- ops->encode_public_key = cryptoflex_encode_public_key;
>-
>- return ops;
>+ return &sc_pkcs15init_cryptoflex_operations;
> }
>
> struct sc_pkcs15init_operations *
> sc_pkcs15init_get_cyberflex_ops(void)
> {
>- struct sc_pkcs15init_operations *ops;
>-
>- ops = &sc_pkcs15init_cyberflex_operations;
>- ops->erase_card = cflex_erase_card;
>- ops->create_dir = cflex_create_dir;
>- ops->create_domain = cflex_create_domain;
>- ops->select_pin_reference = cflex_select_pin_reference;
>- ops->create_pin = cflex_create_pin;
>- ops->create_key = cflex_create_key;
>- ops->generate_key = cflex_generate_key;
>- ops->store_key = cflex_store_key;
>- ops->encode_private_key = cyberflex_encode_private_key;
>- ops->encode_public_key = cyberflex_encode_public_key;
>-
>- return ops;
>+ return &sc_pkcs15init_cyberflex_operations;
> }
>
>Modified: trunk/src/pkcs15init/pkcs15-etoken.c
>===================================================================
>--- trunk/src/pkcs15init/pkcs15-etoken.c 2005-08-10 21:00:52 UTC (rev 2479)
>+++ trunk/src/pkcs15init/pkcs15-etoken.c 2005-08-10 21:31:18 UTC (rev 2480)
>@@ -611,19 +611,19 @@
> return 0;
> }
>
>-static struct sc_pkcs15init_operations sc_pkcs15init_etoken_operations;
>+static struct sc_pkcs15init_operations sc_pkcs15init_etoken_operations = {
>+ .erase_card = etoken_erase,
>+ .create_dir = etoken_create_dir,
>+ .select_pin_reference = etoken_select_pin_reference,
>+ .create_pin = etoken_create_pin,
>+ .select_key_reference = etoken_select_key_reference,
>+ .create_key = etoken_create_key,
>+ .store_key = etoken_store_key,
>+ .generate_key = etoken_generate_key
>+};
>
> struct sc_pkcs15init_operations *
> sc_pkcs15init_get_etoken_ops(void)
> {
>- sc_pkcs15init_etoken_operations.erase_card = etoken_erase;
>- sc_pkcs15init_etoken_operations.create_dir = etoken_create_dir;
>- sc_pkcs15init_etoken_operations.select_pin_reference = etoken_select_pin_reference;
>- sc_pkcs15init_etoken_operations.create_pin = etoken_create_pin;
>- sc_pkcs15init_etoken_operations.select_key_reference = etoken_select_key_reference;
>- sc_pkcs15init_etoken_operations.create_key = etoken_create_key;
>- sc_pkcs15init_etoken_operations.store_key = etoken_store_key;
>- sc_pkcs15init_etoken_operations.generate_key = etoken_generate_key;
>-
> return &sc_pkcs15init_etoken_operations;
> }
>
>Modified: trunk/src/pkcs15init/pkcs15-gpk.c
>===================================================================
>--- trunk/src/pkcs15init/pkcs15-gpk.c 2005-08-10 21:00:52 UTC (rev 2479)
>+++ trunk/src/pkcs15init/pkcs15-gpk.c 2005-08-10 21:31:18 UTC (rev 2480)
>@@ -1116,17 +1116,17 @@
> return 0;
> }
>
>-static struct sc_pkcs15init_operations sc_pkcs15init_gpk_operations;
>+static struct sc_pkcs15init_operations sc_pkcs15init_gpk_operations = {
>+ .erase_card = gpk_erase_card,
>+ .create_dir = gpk_create_dir,
>+ .select_pin_reference = gpk_select_pin_reference,
>+ .create_pin = gpk_create_pin,
>+ .create_key = gpk_create_key,
>+ .generate_key = gpk_generate_key,
>+ .store_key = gpk_store_key
>+};
>
> struct sc_pkcs15init_operations *sc_pkcs15init_get_gpk_ops(void)
> {
>- sc_pkcs15init_gpk_operations.erase_card = gpk_erase_card;
>- sc_pkcs15init_gpk_operations.create_dir = gpk_create_dir;
>- sc_pkcs15init_gpk_operations.select_pin_reference = gpk_select_pin_reference;
>- sc_pkcs15init_gpk_operations.create_pin = gpk_create_pin;
>- sc_pkcs15init_gpk_operations.create_key = gpk_create_key;
>- sc_pkcs15init_gpk_operations.generate_key = gpk_generate_key;
>- sc_pkcs15init_gpk_operations.store_key = gpk_store_key;
>-
> return &sc_pkcs15init_gpk_operations;
> }
>
>Modified: trunk/src/pkcs15init/pkcs15-jcop.c
>===================================================================
>--- trunk/src/pkcs15init/pkcs15-jcop.c 2005-08-10 21:00:52 UTC (rev 2479)
>+++ trunk/src/pkcs15init/pkcs15-jcop.c 2005-08-10 21:31:18 UTC (rev 2480)
>@@ -343,18 +343,18 @@
>
>
>
>-static struct sc_pkcs15init_operations sc_pkcs15init_jcop_operations;
>+static struct sc_pkcs15init_operations sc_pkcs15init_jcop_operations = {
>+ .erase_card = jcop_erase_card,
>+ .init_app   = jcop_init_app,
>+ .select_pin_reference = jcop_select_pin_reference,
>+ .create_pin = jcop_create_pin,
>+ .create_key = jcop_create_key,
>+ .store_key  = jcop_store_key,
>+ .generate_key = jcop_generate_key
>+};
>
> struct sc_pkcs15init_operations *sc_pkcs15init_get_jcop_ops(void)
> {
>-     sc_pkcs15init_jcop_operations.erase_card = jcop_erase_card;
>-     sc_pkcs15init_jcop_operations.init_app = jcop_init_app;
>-     sc_pkcs15init_jcop_operations.select_pin_reference = jcop_select_pin_reference;
>-     sc_pkcs15init_jcop_operations.create_pin = jcop_create_pin;
>-     sc_pkcs15init_jcop_operations.create_key = jcop_create_key;
>-     sc_pkcs15init_jcop_operations.store_key = jcop_store_key;
>-     sc_pkcs15init_jcop_operations.generate_key = jcop_generate_key;
>-    
>      return &sc_pkcs15init_jcop_operations;
> }
>
>
>Modified: trunk/src/pkcs15init/pkcs15-miocos.c
>===================================================================
>--- trunk/src/pkcs15init/pkcs15-miocos.c 2005-08-10 21:00:52 UTC (rev 2479)
>+++ trunk/src/pkcs15init/pkcs15-miocos.c 2005-08-10 21:31:18 UTC (rev 2480)
>@@ -201,14 +201,14 @@
> return r;
> }
>
>-static struct sc_pkcs15init_operations sc_pkcs15init_miocos_operations;
>+static struct sc_pkcs15init_operations sc_pkcs15init_miocos_operations = {
>+ .init_app = miocos_init_app,
>+ .new_pin = miocos_new_pin,
>+ .new_key = miocos_new_key,
>+ .new_file = miocos_new_file
>+};
>
> struct sc_pkcs15init_operations *sc_pkcs15init_get_miocos_ops(void)
> {
>- sc_pkcs15init_miocos_operations.init_app = miocos_init_app;
>- sc_pkcs15init_miocos_operations.new_pin = miocos_new_pin;
>- sc_pkcs15init_miocos_operations.new_key = miocos_new_key;
>- sc_pkcs15init_miocos_operations.new_file = miocos_new_file;
>-
> return &sc_pkcs15init_miocos_operations;
> }
>
>Modified: trunk/src/pkcs15init/pkcs15-oberthur.c
>===================================================================
>--- trunk/src/pkcs15init/pkcs15-oberthur.c 2005-08-10 21:00:52 UTC (rev 2479)
>+++ trunk/src/pkcs15init/pkcs15-oberthur.c 2005-08-10 21:31:18 UTC (rev 2480)
>@@ -686,33 +686,20 @@
> }
>
>
>-struct sc_pkcs15init_operations sc_pkcs15init_oberthur_operations;
>+static struct sc_pkcs15init_operations sc_pkcs15init_oberthur_operations = {
>+ .erase_card = cosm_erase_card,
>+ /* NEW */
>+ .select_pin_reference = cosm_select_pin_reference,
>+ .create_pin = cosm_create_pin,
>+ /* OLD */
>+ .init_app = cosm_init_app,
>+ .new_key = cosm_new_key,
>+ .new_file = cosm_new_file,
>+ .old_generate_key = cosm_old_generate_key
>+};
>
> struct sc_pkcs15init_operations *
> sc_pkcs15init_get_oberthur_ops(void)
> {  
>- struct sc_pkcs15init_operations *ops = &sc_pkcs15init_oberthur_operations;
>-
>- ops->erase_card = cosm_erase_card;
>-
>-/* NEW */
>- ops->create_dir = NULL;
>- ops->create_domain = NULL;
>- ops->select_pin_reference = cosm_select_pin_reference;
>- ops->create_pin = cosm_create_pin;
>- ops->select_key_reference = NULL;
>- ops->create_key = NULL;
>- ops->store_key = NULL;
>- ops->generate_key = NULL;
>- ops->encode_private_key = NULL;
>- ops->encode_public_key = NULL;
>-
>-/* OLD */
>- ops->init_app = cosm_init_app;
>- ops->new_pin = NULL;
>- ops->new_key = cosm_new_key;
>- ops->new_file = cosm_new_file;
>- ops->old_generate_key = cosm_old_generate_key;
>-
>- return ops;
>+ return &sc_pkcs15init_oberthur_operations;
> }
>
>Modified: trunk/src/pkcs15init/pkcs15-starcos.c
>===================================================================
>--- trunk/src/pkcs15init/pkcs15-starcos.c 2005-08-10 21:00:52 UTC (rev 2479)
>+++ trunk/src/pkcs15init/pkcs15-starcos.c 2005-08-10 21:31:18 UTC (rev 2480)
>@@ -913,20 +913,20 @@
> return r;
> }
>
>-static struct sc_pkcs15init_operations sc_pkcs15init_starcos_operations;
>+static struct sc_pkcs15init_operations sc_pkcs15init_starcos_operations = {
>+ .erase_card = starcos_erase_card,
>+ .init_card  = starcos_init_card,
>+ .create_dir = starcos_create_dir,
>+ .select_pin_reference = starcos_pin_reference,
>+ .create_pin = starcos_create_pin,
>+ .select_key_reference = starcos_key_reference,
>+ .create_key = starcos_create_key,
>+ .store_key  = starcos_store_key,
>+ .generate_key = starcos_generate_key,
>+ .finalize_card = starcos_finalize_card
>+};
>
> struct sc_pkcs15init_operations *sc_pkcs15init_get_starcos_ops(void)
> {
>- sc_pkcs15init_starcos_operations.erase_card = starcos_erase_card;
>- sc_pkcs15init_starcos_operations.init_card  = starcos_init_card;
>- sc_pkcs15init_starcos_operations.create_dir = starcos_create_dir;
>- sc_pkcs15init_starcos_operations.select_pin_reference = starcos_pin_reference;
>- sc_pkcs15init_starcos_operations.create_pin = starcos_create_pin;
>- sc_pkcs15init_starcos_operations.select_key_reference = starcos_key_reference;
>- sc_pkcs15init_starcos_operations.create_key = starcos_create_key;
>- sc_pkcs15init_starcos_operations.store_key  = starcos_store_key;
>- sc_pkcs15init_starcos_operations.generate_key = starcos_generate_key;
>- sc_pkcs15init_starcos_operations.finalize_card = starcos_finalize_card;
>-
> return &sc_pkcs15init_starcos_operations;
> }
>
>
>
>_______________________________________________
>opensc-commits mailing list
>[hidden email]
>http://opensc.org/cgi-bin/mailman/listinfo/opensc-commits
>
>  
>

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Re: [opensc-commits] svn opensc changed [2480] initialize sc_pkcs15init_operations at compile time [u]

Andreas Jellinghaus-2
On Thursday 11 August 2005 23:21, Stef Hoeben wrote:
> Hi Nils,
>
> the . initialisation doesn't work on MS Visual Studio 6.0
> (not the latest compiler) but still much used..

ah, I remember. I tried c99 style initialization once too,
and was told visual c can't do that.

guess we need to revert
        .erase_card = etoken_erase,
style to the old style
        etoken_erase, ... , ..., ....
(yes, the one that breaks horribly if the structure
is changed in the middle somewhere).

Andreas
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Re: [opensc-commits] svn opensc changed [2480] initialize sc_pkcs15init_operations at compile time

Nils Larsch
In reply to this post by Stef Hoeben
Stef Hoeben wrote:
> Hi Nils,
>
> the . initialisation doesn't work on MS Visual Studio 6.0
> (not the latest compiler) but still much used..

please do a "svn update" and test again.

Nils
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel