diff --git a/scd/ChangeLog b/scd/ChangeLog index ed6986965..68aaa2984 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,3 +1,8 @@ +2003-07-28 Werner Koch + + * app-openpgp.c (do_setattr): Change implementation. Allow all + useful DOs. + 2003-07-27 Werner Koch Adjusted for gcry_mpi_print and gcry_mpi_scan API change. diff --git a/scd/apdu.c b/scd/apdu.c index 773225415..6fec584b9 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -32,8 +32,8 @@ #define HAVE_CTAPI 1 #define MAX_READER 4 /* Number of readers we support concurrently. */ -#define CARD_CONNECT_TIMEOUT 30 /* Number of seconds to wait for - insertion of the card. */ +#define CARD_CONNECT_TIMEOUT 1 /* Number of seconds to wait for + insertion of the card (1 = don't wait). */ @@ -149,6 +149,9 @@ ct_activate_card (int reader) unsigned char dad[1], sad[1], cmd[11], buf[256]; unsigned short buflen; + if (count) + sleep (1); /* FIXME: we should use a more reliable timer. */ + /* Check whether card has been inserted. */ dad[0] = 1; /* Destination address: CT. */ sad[0] = 2; /* Source address: Host. */ @@ -203,7 +206,6 @@ ct_activate_card (int reader) return 0; } - sleep (1); /* FIXME: we should use a more reliable timer. */ } log_info ("ct_activate_card(%d): timeout waiting for card\n", reader); diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index b344d23cd..f8c13f6d2 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -541,10 +541,28 @@ do_setattr (APP app, const char *name, const unsigned char *value, size_t valuelen) { gpg_error_t rc; + int idx; + static struct { + const char *name; + int tag; + } table[] = { + { "DISP-NAME", 0x005B }, + { "LOGIN-DATA", 0x005E }, + { "DISP-LANG", 0x5F2D }, + { "DISP-SEX", 0x5F35 }, + { "PUBKEY-URL", 0x5F50 }, + { "CHV-STATUS-1", 0x00C4 }, + { "CA-FPR-1", 0x00CA }, + { "CA-FPR-2", 0x00CB }, + { "CA-FPR-3", 0x00CC }, + { NULL, 0 } + }; - log_debug ("app_openpgp#setattr `%s' value of length %u\n", - name, (unsigned int)valuelen); /* fixme: name should be - sanitized. */ + + for (idx=0; table[idx].name && strcmp (table[idx].name, name); idx++) + ; + if (!table[idx].name) + return gpg_error (GPG_ERR_INV_NAME); if (!app->did_chv3) { @@ -552,8 +570,8 @@ do_setattr (APP app, const char *name, rc = pincb (pincb_arg, "Admin PIN (CHV3)", &pinvalue); - pinvalue = xstrdup ("12345678"); - rc = 0; +/* pinvalue = xstrdup ("12345678"); */ +/* rc = 0; */ if (rc) { log_info ("PIN callback returned error: %s\n", gpg_strerror (rc)); @@ -571,32 +589,12 @@ do_setattr (APP app, const char *name, app->did_chv3 = 1; } - log_debug ("setting `%s' to `%.*s'\n", name, (int)valuelen, value); - if (!strcmp (name, "DISP-NAME")) - { - rc = iso7816_put_data (app->slot, 0x005B, value, valuelen); - if (rc) - { - /* FIXME: If this fails we should *once* try again after - doing a verify command, so that in case of a problem with - tracking the verify operation we have a fallback. */ - /* FIXME: change this when iso7816 returns correct error - codes. */ - log_error ("failed to set `Name'\n"); - rc = gpg_error (GPG_ERR_GENERAL); - } - } - else if (!strcmp (name, "PUBKEY-URL")) - { - rc = iso7816_put_data (app->slot, 0x5F50, value, valuelen); - if (rc) - { - log_error ("failed to set `Pubkey-URL'\n"); - rc = gpg_error (GPG_ERR_GENERAL); - } - } - else - rc = gpg_error (GPG_ERR_INV_NAME); + rc = iso7816_put_data (app->slot, table[idx].tag, value, valuelen); + if (rc) + log_error ("failed to set `%s': %s\n", table[idx].name, gpg_strerror (rc)); + /* FIXME: If this fails we should *once* try again after + doing a verify command, so that in case of a problem with + tracking the verify operation we have a fallback. */ return rc; } diff --git a/sm/ChangeLog b/sm/ChangeLog index f4264037d..22ed9a9c5 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,3 +1,8 @@ +2003-07-29 Werner Koch + + * gpgsm.c (main): Add secmem features and set the random seed file. + (gpgsm_exit): Update the random seed file and enable debug output. + 2003-07-27 Werner Koch Adjusted for gcry_mpi_print and gcry_mpi_scan API change. diff --git a/sm/gpgsm.c b/sm/gpgsm.c index 5157874a3..f10819388 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -1071,10 +1071,7 @@ main ( int argc, char **argv) /* set the random seed file */ if (use_random_seed) { char *p = make_filename (opt.homedir, "random_seed", NULL); -#if 0 -#warning set_random_seed_file not yet available in Libgcrypt - set_random_seed_file(p); -#endif + gcry_control (GCRYCTL_SET_RANDOM_SEED_FILE, p); xfree(p); } @@ -1342,12 +1339,7 @@ emergency_cleanup (void) void gpgsm_exit (int rc) { - #if 0 -#warning no update_random_seed_file - update_random_seed_file(); - #endif -#if 0 - /* at this time a bit annoying */ + gcry_control (GCRYCTL_UPDATE_RANDOM_SEED_FILE);update_random_seed_file(); if (opt.debug & DBG_MEMSTAT_VALUE) { gcry_control( GCRYCTL_DUMP_MEMORY_STATS ); @@ -1355,7 +1347,6 @@ gpgsm_exit (int rc) } if (opt.debug) gcry_control (GCRYCTL_DUMP_SECMEM_STATS ); -#endif emergency_cleanup (); rc = rc? rc : log_get_errorcount(0)? 2 : gpgsm_errors_seen? 1 : 0; exit (rc);