more more small fix.

This commit is contained in:
NIIBE Yutaka
2010-11-08 09:40:31 +09:00
parent 9c7a085efb
commit 24a3430ce4
5 changed files with 15 additions and 9 deletions

View File

@@ -1,11 +1,17 @@
2010-11-08 NIIBE Yutaka <gniibe@fsij.org> 2010-11-08 NIIBE Yutaka <gniibe@fsij.org>
* src/openpgp.c (cmd_change_password, cmd_reset_user_password):
Write to APDU correctly.
* src/flash.c (flash_warning): Make it public.
* src/openpgp-do.c (do_hist_bytes, do_fp_all, do_cafp_all) * src/openpgp-do.c (do_hist_bytes, do_fp_all, do_cafp_all)
(do_kgtime_all, do_ds_count): Fix return value. (do_kgtime_all, do_ds_count): Fix return value.
(rw_pw_status): Correctly return value. (rw_pw_status): Correctly return value.
(proc_resetting_code): Change func proto. to return success/failure. (proc_resetting_code): Change func proto. to return success/failure.
(proc_key_import): Ditto. (proc_key_import): Ditto.
(gpg_do_put_data): Handle return values. (gpg_do_put_data): Handle return values.
(gpg_do_write_simple): Don't write to APDU.
2010-11-05 NIIBE Yutaka <gniibe@fsij.org> 2010-11-05 NIIBE Yutaka <gniibe@fsij.org>

View File

@@ -260,7 +260,7 @@ flash_do_write (uint8_t nr, const uint8_t *data, int len)
return p + 1; return p + 1;
} }
static void void
flash_warning (const char *msg) flash_warning (const char *msg)
{ {
(void)msg; (void)msg;

View File

@@ -285,3 +285,4 @@ extern int flash_cnt123_get_value (const uint8_t *p);
extern void flash_cnt123_increment (uint8_t which, const uint8_t **addr_p); extern void flash_cnt123_increment (uint8_t which, const uint8_t **addr_p);
extern void flash_cnt123_clear (const uint8_t **addr_p); extern void flash_cnt123_clear (const uint8_t **addr_p);
extern void flash_put_data (uint16_t hw); extern void flash_put_data (uint16_t hw);
extern void flash_warning (const char *msg);

View File

@@ -1296,14 +1296,9 @@ gpg_do_write_simple (uint8_t nr, const uint8_t *data, int size)
if (data != NULL) if (data != NULL)
{ {
*do_data_p = flash_do_write (nr, data, size); *do_data_p = flash_do_write (nr, data, size);
if (*do_data_p) if (*do_data_p == NULL)
GPG_SUCCESS (); flash_warning ("DO WRITE ERROR");
else
GPG_MEMORY_FAILURE ();
} }
else else
{ *do_data_p = NULL;
*do_data_p = NULL;
GPG_SUCCESS ();
}
} }

View File

@@ -260,6 +260,7 @@ cmd_change_password (void)
ac_reset_pso_cds (); ac_reset_pso_cds ();
gpg_reset_pw_err_counter (PW_ERR_PW1); gpg_reset_pw_err_counter (PW_ERR_PW1);
DEBUG_INFO ("Changed DO_KEYSTRING_PW1.\r\n"); DEBUG_INFO ("Changed DO_KEYSTRING_PW1.\r\n");
GPG_SUCCESS ();
} }
else if (r > 0 && who == BY_USER) else if (r > 0 && who == BY_USER)
{ {
@@ -267,6 +268,7 @@ cmd_change_password (void)
ac_reset_pso_cds (); ac_reset_pso_cds ();
gpg_reset_pw_err_counter (PW_ERR_PW1); gpg_reset_pw_err_counter (PW_ERR_PW1);
DEBUG_INFO ("Changed length of DO_KEYSTRING_PW1.\r\n"); DEBUG_INFO ("Changed length of DO_KEYSTRING_PW1.\r\n");
GPG_SUCCESS ();
} }
else /* r >= 0 && who == BY_ADMIN */ else /* r >= 0 && who == BY_ADMIN */
{ {
@@ -344,6 +346,7 @@ cmd_reset_user_password (void)
ac_reset_pso_cds (); ac_reset_pso_cds ();
gpg_reset_pw_err_counter (PW_ERR_RC); gpg_reset_pw_err_counter (PW_ERR_RC);
gpg_reset_pw_err_counter (PW_ERR_PW1); gpg_reset_pw_err_counter (PW_ERR_PW1);
GPG_SUCCESS ();
} }
else else
{ {
@@ -386,6 +389,7 @@ cmd_reset_user_password (void)
gpg_do_write_simple (NR_DO_KEYSTRING_PW1, new_ks0, KEYSTRING_SIZE_PW1); gpg_do_write_simple (NR_DO_KEYSTRING_PW1, new_ks0, KEYSTRING_SIZE_PW1);
ac_reset_pso_cds (); ac_reset_pso_cds ();
gpg_reset_pw_err_counter (PW_ERR_PW1); gpg_reset_pw_err_counter (PW_ERR_PW1);
GPG_SUCCESS ();
} }
else else
{ {