scd: Rename a shared info field name.

* scd/app-piv.c (app_select_piv):
* scd/app-common.h (struct app_ctx_s): Rename 'card_version' to
'cardversion'.  Rename all users.  Add 'appversion'.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2019-03-05 17:17:39 +01:00
parent e897e1e255
commit 64caa6a082
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 15 additions and 14 deletions

View File

@ -60,7 +60,8 @@ struct app_ctx_s {
size_t serialnolen; /* Length in octets of serialnumber. */
const char *cardtype; /* NULL or string with the token's type. */
const char *apptype;
unsigned int card_version;
unsigned int cardversion;/* Firmware version of the token or 0. */
unsigned int appversion; /* Version of the application or 0. */
unsigned int card_status;
unsigned int reset_requested:1;
unsigned int periodical_check_needed:1;

View File

@ -476,7 +476,7 @@ get_one_do (app_t app, int tag, unsigned char **result, size_t *nbytes,
for (i=0; data_objects[i].tag && data_objects[i].tag != tag; i++)
;
if (app->card_version > 0x0100 && data_objects[i].get_immediate_in_v11)
if (app->appversion > 0x0100 && data_objects[i].get_immediate_in_v11)
{
exmode = 0;
rc = iso7816_get_data (app->slot, exmode, tag, &buffer, &buflen);
@ -816,7 +816,7 @@ store_fpr (app_t app, int keynumber, u32 timestamp, unsigned char *fpr,
xfree (buffer);
tag = (app->card_version > 0x0007? 0xC7 : 0xC6) + keynumber;
tag = (app->appversion > 0x0007? 0xC7 : 0xC6) + keynumber;
flush_cache_item (app, 0xC5);
tag2 = 0xCE + keynumber;
flush_cache_item (app, 0xCD);
@ -825,7 +825,7 @@ store_fpr (app_t app, int keynumber, u32 timestamp, unsigned char *fpr,
if (rc)
log_error (_("failed to store the fingerprint: %s\n"),gpg_strerror (rc));
if (!rc && app->card_version > 0x0100)
if (!rc && app->appversion > 0x0100)
{
unsigned char buf[4];
@ -1655,7 +1655,7 @@ get_public_key (app_t app, int keyno)
m = e = NULL; /* (avoid cc warning) */
if (app->card_version > 0x0100)
if (app->appversion > 0x0100)
{
int exmode, le_value;
@ -1838,7 +1838,7 @@ do_learn_status (app_t app, ctrl_t ctrl, unsigned int flags)
do_getattr (app, ctrl, "PUBKEY-URL");
do_getattr (app, ctrl, "LOGIN-DATA");
do_getattr (app, ctrl, "KEY-FPR");
if (app->card_version > 0x0100)
if (app->appversion > 0x0100)
do_getattr (app, ctrl, "KEY-TIME");
do_getattr (app, ctrl, "CA-FPR");
do_getattr (app, ctrl, "CHV-STATUS");
@ -3699,7 +3699,7 @@ rsa_writekey (app_t app, gpg_error_t (*pincb)(void*, const char *, char **),
/* Store the key. */
err = iso7816_put_data (app->slot, 0,
(app->card_version > 0x0007? 0xE0:0xE9)+keyno,
(app->appversion > 0x0007? 0xE0:0xE9)+keyno,
template, template_len);
}
if (err)
@ -4851,7 +4851,7 @@ do_decipher (app_t app, const char *keyidstr,
if (gpg_err_code (rc) == GPG_ERR_CARD /* actual SW is 0x640a */
&& app->app_local->manufacturer == 5
&& app->card_version == 0x0200)
&& app->appversion == 0x0200)
log_info ("NOTE: Cards with manufacturer id 5 and s/n <= 346 (0x15a)"
" do not work with encryption keys > 2048 bits\n");
@ -5210,8 +5210,8 @@ app_select_openpgp (app_t app)
log_printhex (buffer, buflen, "");
}
app->card_version = buffer[6] << 8;
app->card_version |= buffer[7];
app->appversion = buffer[6] << 8;
app->appversion |= buffer[7];
manufacturer = (buffer[8]<<8 | buffer[9]);
xfree (app->serialno);
@ -5227,10 +5227,10 @@ app_select_openpgp (app_t app)
app->app_local->manufacturer = manufacturer;
if (app->card_version >= 0x0200)
if (app->appversion >= 0x0200)
app->app_local->extcap.is_v2 = 1;
if (app->card_version >= 0x0300)
if (app->appversion >= 0x0300)
app->app_local->extcap.extcap_v3 = 1;
/* Read the historical bytes. */
@ -5297,7 +5297,7 @@ app_select_openpgp (app_t app)
/* Some of the first cards accidentally don't set the
CHANGE_FORCE_CHV bit but allow it anyway. */
if (app->card_version <= 0x0100 && manufacturer == 1)
if (app->appversion <= 0x0100 && manufacturer == 1)
app->app_local->extcap.change_force_chv = 1;
/* Check optional DO of "General Feature Management" for button. */

View File

@ -3292,7 +3292,7 @@ app_select_piv (app_t app)
err = gpg_error (GPG_ERR_CARD);
goto leave;
}
app->card_version = ((s[4] << 8) | s[5]);
app->appversion = ((s[4] << 8) | s[5]);
s = find_tlv (apt, aptlen, 0x79, &n);
if (!s || n < 7)