mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-23 10:29:58 +01:00
* gpgsm.c (main): Add secmem features and set the random seed file.
(gpgsm_exit): Update the random seed file and enable debug output. * g10.c (main): Add secmem features and set the random seed file. (g10_exit): Update the random seed file. * parse-packet.c (parse_signature,read_protected_v3_mpi) (parse_key): Fixed use of mpi_set_opaque. * keygen.c (gen_card_key): Ditto.
This commit is contained in:
parent
860f56b089
commit
97d3ea897f
@ -1,3 +1,8 @@
|
|||||||
|
2003-07-28 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* app-openpgp.c (do_setattr): Change implementation. Allow all
|
||||||
|
useful DOs.
|
||||||
|
|
||||||
2003-07-27 Werner Koch <wk@gnupg.org>
|
2003-07-27 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
Adjusted for gcry_mpi_print and gcry_mpi_scan API change.
|
Adjusted for gcry_mpi_print and gcry_mpi_scan API change.
|
||||||
|
@ -32,8 +32,8 @@
|
|||||||
#define HAVE_CTAPI 1
|
#define HAVE_CTAPI 1
|
||||||
|
|
||||||
#define MAX_READER 4 /* Number of readers we support concurrently. */
|
#define MAX_READER 4 /* Number of readers we support concurrently. */
|
||||||
#define CARD_CONNECT_TIMEOUT 30 /* Number of seconds to wait for
|
#define CARD_CONNECT_TIMEOUT 1 /* Number of seconds to wait for
|
||||||
insertion of the card. */
|
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 char dad[1], sad[1], cmd[11], buf[256];
|
||||||
unsigned short buflen;
|
unsigned short buflen;
|
||||||
|
|
||||||
|
if (count)
|
||||||
|
sleep (1); /* FIXME: we should use a more reliable timer. */
|
||||||
|
|
||||||
/* Check whether card has been inserted. */
|
/* Check whether card has been inserted. */
|
||||||
dad[0] = 1; /* Destination address: CT. */
|
dad[0] = 1; /* Destination address: CT. */
|
||||||
sad[0] = 2; /* Source address: Host. */
|
sad[0] = 2; /* Source address: Host. */
|
||||||
@ -203,7 +206,6 @@ ct_activate_card (int reader)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep (1); /* FIXME: we should use a more reliable timer. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info ("ct_activate_card(%d): timeout waiting for card\n", reader);
|
log_info ("ct_activate_card(%d): timeout waiting for card\n", reader);
|
||||||
|
@ -541,10 +541,28 @@ do_setattr (APP app, const char *name,
|
|||||||
const unsigned char *value, size_t valuelen)
|
const unsigned char *value, size_t valuelen)
|
||||||
{
|
{
|
||||||
gpg_error_t rc;
|
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
|
for (idx=0; table[idx].name && strcmp (table[idx].name, name); idx++)
|
||||||
sanitized. */
|
;
|
||||||
|
if (!table[idx].name)
|
||||||
|
return gpg_error (GPG_ERR_INV_NAME);
|
||||||
|
|
||||||
if (!app->did_chv3)
|
if (!app->did_chv3)
|
||||||
{
|
{
|
||||||
@ -552,8 +570,8 @@ do_setattr (APP app, const char *name,
|
|||||||
|
|
||||||
rc = pincb (pincb_arg, "Admin PIN (CHV3)",
|
rc = pincb (pincb_arg, "Admin PIN (CHV3)",
|
||||||
&pinvalue);
|
&pinvalue);
|
||||||
pinvalue = xstrdup ("12345678");
|
/* pinvalue = xstrdup ("12345678"); */
|
||||||
rc = 0;
|
/* rc = 0; */
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_info ("PIN callback returned error: %s\n", gpg_strerror (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;
|
app->did_chv3 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug ("setting `%s' to `%.*s'\n", name, (int)valuelen, value);
|
rc = iso7816_put_data (app->slot, table[idx].tag, value, valuelen);
|
||||||
if (!strcmp (name, "DISP-NAME"))
|
|
||||||
{
|
|
||||||
rc = iso7816_put_data (app->slot, 0x005B, value, valuelen);
|
|
||||||
if (rc)
|
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
|
/* FIXME: If this fails we should *once* try again after
|
||||||
doing a verify command, so that in case of a problem with
|
doing a verify command, so that in case of a problem with
|
||||||
tracking the verify operation we have a fallback. */
|
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);
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2003-07-29 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* 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 <wk@gnupg.org>
|
2003-07-27 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
Adjusted for gcry_mpi_print and gcry_mpi_scan API change.
|
Adjusted for gcry_mpi_print and gcry_mpi_scan API change.
|
||||||
|
13
sm/gpgsm.c
13
sm/gpgsm.c
@ -1071,10 +1071,7 @@ main ( int argc, char **argv)
|
|||||||
/* set the random seed file */
|
/* set the random seed file */
|
||||||
if (use_random_seed) {
|
if (use_random_seed) {
|
||||||
char *p = make_filename (opt.homedir, "random_seed", NULL);
|
char *p = make_filename (opt.homedir, "random_seed", NULL);
|
||||||
#if 0
|
gcry_control (GCRYCTL_SET_RANDOM_SEED_FILE, p);
|
||||||
#warning set_random_seed_file not yet available in Libgcrypt
|
|
||||||
set_random_seed_file(p);
|
|
||||||
#endif
|
|
||||||
xfree(p);
|
xfree(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1342,12 +1339,7 @@ emergency_cleanup (void)
|
|||||||
void
|
void
|
||||||
gpgsm_exit (int rc)
|
gpgsm_exit (int rc)
|
||||||
{
|
{
|
||||||
#if 0
|
gcry_control (GCRYCTL_UPDATE_RANDOM_SEED_FILE);update_random_seed_file();
|
||||||
#warning no update_random_seed_file
|
|
||||||
update_random_seed_file();
|
|
||||||
#endif
|
|
||||||
#if 0
|
|
||||||
/* at this time a bit annoying */
|
|
||||||
if (opt.debug & DBG_MEMSTAT_VALUE)
|
if (opt.debug & DBG_MEMSTAT_VALUE)
|
||||||
{
|
{
|
||||||
gcry_control( GCRYCTL_DUMP_MEMORY_STATS );
|
gcry_control( GCRYCTL_DUMP_MEMORY_STATS );
|
||||||
@ -1355,7 +1347,6 @@ gpgsm_exit (int rc)
|
|||||||
}
|
}
|
||||||
if (opt.debug)
|
if (opt.debug)
|
||||||
gcry_control (GCRYCTL_DUMP_SECMEM_STATS );
|
gcry_control (GCRYCTL_DUMP_SECMEM_STATS );
|
||||||
#endif
|
|
||||||
emergency_cleanup ();
|
emergency_cleanup ();
|
||||||
rc = rc? rc : log_get_errorcount(0)? 2 : gpgsm_errors_seen? 1 : 0;
|
rc = rc? rc : log_get_errorcount(0)? 2 : gpgsm_errors_seen? 1 : 0;
|
||||||
exit (rc);
|
exit (rc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user