pkcs15init create_key patch proposal

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pkcs15init create_key patch proposal

Tarasov Viktor
Hi,

there is a patch proposal,
that permits to the create_key pkcs15init operation
to differenciate the 'key generate' and 'key store' operations.

Kind wishes,
Viktor.

diff -NaurbB /home/vtarasov/cvs/opensc.trunk.orig/src/libopensc/pkcs15.h /home/vtarasov/cvs/opensc.trunk/src/libopensc/pkcs15.h
--- /home/vtarasov/cvs/opensc.trunk.orig/src/libopensc/pkcs15.h 2005-08-22 11:41:13.000000000 +0200
+++ /home/vtarasov/cvs/opensc.trunk/src/libopensc/pkcs15.h 2005-08-22 12:09:25.000000000 +0200
@@ -241,6 +241,9 @@
 #define SC_PKCS15_PRKEY_ACCESS_NEVEREXTRACTABLE 0x08
 #define SC_PKCS15_PRKEY_ACCESS_LOCAL 0x10
 
+#define SC_PKCS15_PRKEY_CREATION_STORE 0x01
+#define SC_PKCS15_PRKEY_CREATION_GENERATE 0x02
+
 struct sc_pkcs15_prkey_info {
  struct sc_pkcs15_id id; /* correlates to public certificate id */
  unsigned int usage, access_flags;
diff -NaurbB /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-cflex.c /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-cflex.c
--- /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-cflex.c 2005-08-22 11:40:57.000000000 +0200
+++ /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-cflex.c 2005-08-22 12:04:34.000000000 +0200
@@ -248,7 +248,8 @@
  * Create a new key file
  */
 static int
-cflex_create_key(sc_profile_t *profile, sc_card_t *card, sc_pkcs15_object_t *obj)
+cflex_create_key(sc_profile_t *profile, sc_card_t *card, sc_pkcs15_object_t *obj
+ unsigned int create_flag)
 {
  sc_pkcs15_prkey_info_t *key_info = (sc_pkcs15_prkey_info_t *) obj->data;
  sc_file_t *prkf = NULL, *pukf = NULL;
diff -NaurbB /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-etoken.c /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-etoken.c
--- /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-etoken.c 2005-08-22 11:40:57.000000000 +0200
+++ /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-etoken.c 2005-08-22 12:05:05.000000000 +0200
@@ -246,7 +246,7 @@
  */
 static int
 etoken_create_key(sc_profile_t *profile, sc_card_t *card,
- sc_pkcs15_object_t *obj)
+ sc_pkcs15_object_t *obj, unsigned int create_flag)
 {
  return 0;
 }
diff -NaurbB /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-gpk.c /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-gpk.c
--- /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-gpk.c 2005-08-22 11:40:57.000000000 +0200
+++ /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-gpk.c 2005-08-22 12:05:29.000000000 +0200
@@ -370,7 +370,8 @@
  * Create a key file
  */
 static int
-gpk_create_key(sc_profile_t *profile, sc_card_t *card, sc_pkcs15_object_t *obj)
+gpk_create_key(sc_profile_t *profile, sc_card_t *card,
+ sc_pkcs15_object_t *obj, unsigned int create_flag)
 {
  sc_pkcs15_prkey_info_t *key_info = (sc_pkcs15_prkey_info_t *) obj->data;
  struct sc_file *keyfile = NULL;
diff -NaurbB /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-init.h /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-init.h
--- /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-init.h 2005-08-22 11:40:57.000000000 +0200
+++ /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-init.h 2005-08-22 12:06:10.000000000 +0200
@@ -78,7 +78,7 @@
  * @key_info should be filled in by the function
  */
  int (*create_key)(sc_profile_t *, sc_card_t *,
- sc_pkcs15_object_t *o);
+ sc_pkcs15_object_t *o, unsigned int);
 
  /*
  * Store a key on the card
diff -NaurbB /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-jcop.c /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-jcop.c
--- /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-jcop.c 2005-08-22 11:40:56.000000000 +0200
+++ /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-jcop.c 2005-08-22 12:06:48.000000000 +0200
@@ -139,8 +139,8 @@
  * Create a new key file
  */
 static int
-jcop_create_key(sc_profile_t *profile, sc_card_t *card, sc_pkcs15_object_t *obj
-)
+jcop_create_key(sc_profile_t *profile, sc_card_t *card,
+ sc_pkcs15_object_t *obj, unsigned int create_flag)
 {
         sc_pkcs15_prkey_info_t *key_info = (sc_pkcs15_prkey_info_t *) obj->data;
         sc_file_t  *keyfile = NULL;
diff -NaurbB /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-lib.c /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-lib.c
--- /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-lib.c 2005-08-22 11:40:57.000000000 +0200
+++ /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-lib.c 2005-08-22 12:07:48.000000000 +0200
@@ -1130,7 +1130,8 @@
  /* Generate the private key on card */
  if (profile->ops->create_key) {
  /* New API */
- r = profile->ops->create_key(profile, p15card->card, object);
+ r = profile->ops->create_key(profile, p15card->card, object,
+ SC_PKCS15_PRKEY_CREATION_GENERATE);
  if (r < 0)
  return r;
 
@@ -1230,7 +1231,8 @@
  if (!(keyargs->flags & SC_PKCS15INIT_EXTRACTABLE)) {
  if (profile->ops->create_key) {
  /* New API */
- r = profile->ops->create_key(profile, p15card->card, object);
+ r = profile->ops->create_key(profile, p15card->card, object,
+ SC_PKCS15_PRKEY_CREATION_STORE);
  if (r < 0)
  return r;
  r = profile->ops->store_key(profile, p15card->card,
diff -NaurbB /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-starcos.c /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-starcos.c
--- /home/vtarasov/cvs/opensc.trunk.orig/src/pkcs15init/pkcs15-starcos.c 2005-08-22 11:40:57.000000000 +0200
+++ /home/vtarasov/cvs/opensc.trunk/src/pkcs15init/pkcs15-starcos.c 2005-08-22 12:08:57.000000000 +0200
@@ -710,7 +710,7 @@
 }
 
 static int starcos_create_key(sc_profile_t *profile, sc_card_t *card,
- sc_pkcs15_object_t *obj)
+ sc_pkcs15_object_t *obj, unsigned int create_flag)
 {
  int r, pin_id;
  u8 akd = 0, state;

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