1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

scd: Split data structures into app and card related objects.

* scd/app-common.h (struct card_ctx_s): New.
(struct app_ctx_s): Factor card specific fields out to card_ctx_s.
(app_get_slot): New.
* scd/scdaemon.h (card_t): New.
(struct server_control_s): Rename field app_ctx to card_ctx and change
all users.
* scd/app-dinsig.c: Use app_get_slot and adjust for chang in card
related fields.
* scd/app-geldkarte.c: Ditto.
* scd/app-nks.c: Ditto.
* scd/app-openpgp.c: Ditto.
* scd/app-p15.c: Ditto.
* scd/app-sc-hsm.c: Ditto.
* scd/app.c: Lost of changes to adjust for the changed data
structures.  Change all callers.
(app_list_lock): Rename to card_list_lock.
(app_top): Remove.
(card_top): New.
(lock_app): Rename to lock_card and change arg type.
(unlock_app): Rename to unlock_card.
(app_dump_state): Print card and app info.
(app_reset): Rename to card_reset.
(app_new_register): Change for the new data structure.
(deallocate_card): Dealloc card and all apps.
(app_ref): Rename to card_ref.
(app_unref): Rename to card_unref.
(app_unref_locked): Rename to card_unref_locked.
(card_get_serialno): New.
* scd/command.c (cmd_pkdecrypt): Actually use the looked up card and
former app object and not the standard one from the context.
--

Although quite large, this is a straightforward change to separate
card/token related data from card application related data.  Before
this change there was a one-to-one relation between card and
application and no way to represent several applications on a card.
The new data structure will allow for such a representation.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2019-06-19 08:50:40 +02:00
parent c3dd53a65d
commit 5a5288d051
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
11 changed files with 774 additions and 617 deletions

View file

@ -84,6 +84,7 @@ struct
#define DBG_READER (opt.debug & DBG_READER_VALUE)
struct server_local_s;
struct card_ctx_s;
struct app_ctx_s;
struct server_control_s
@ -101,7 +102,7 @@ struct server_control_s
associated. Note that this is shared with the other connections:
All connections accessing the same reader are using the same
application context. */
struct app_ctx_s *app_ctx;
struct card_ctx_s *card_ctx;
/* Helper to store the value we are going to sign */
struct
@ -111,6 +112,7 @@ struct server_control_s
} in_data;
};
typedef struct card_ctx_s *card_t;
typedef struct app_ctx_s *app_t;
/*-- scdaemon.c --*/
@ -130,8 +132,8 @@ void send_keyinfo (ctrl_t ctrl, int data, const char *keygrip_str,
void popup_prompt (void *opaque, int on);
/* Take care: this function assumes that APP is locked. */
void send_client_notifications (app_t app, int removal);
/* Take care: this function assumes that CARD is locked. */
void send_client_notifications (card_t card, int removal);
void scd_kick_the_loop (void);
int get_active_connection_count (void);