flash_unlock at the beginning

This commit is contained in:
NIIBE Yutaka
2011-05-16 10:14:09 +09:00
parent 2d07cd6f0d
commit c620b73202
4 changed files with 6 additions and 3 deletions

View File

@@ -1,5 +1,9 @@
2011-05-16 NIIBE Yutaka <gniibe@fsij.org>
* src/main.c (main): Call flash_unlock at the beginning.
(device_initialize_once): Don't call flash_unlock here.
* src/flash.c (flash_init): Likewise.
* src/openpgp.c (cmd_select_file): Don't use write_res_apdu.
(set_res_apdu): Rename from write_res_apdu. Just SW1 and SW2.

View File

@@ -206,7 +206,6 @@ flash_init (void)
keystore = p;
flash_unlock ();
return data_pool + FLASH_DATA_POOL_HEADER_SIZE;
}

View File

@@ -107,6 +107,7 @@ enum kind_of_key {
GPG_KEY_FOR_AUTHENTICATION,
};
extern void flash_unlock (void);
extern const uint8_t *flash_init (void);
extern void flash_do_release (const uint8_t *);
extern const uint8_t *flash_do_write (uint8_t nr, const uint8_t *data, int len);

View File

@@ -172,7 +172,6 @@ device_initialize_once (void)
if (p[0] == 0xff && p[1] == 0xff && p[2] == 0xff && p[3] == 0xff)
{
extern void flash_unlock (void);
/*
* This is the first time invocation.
* Setup serial number by unique device ID.
@@ -180,7 +179,6 @@ device_initialize_once (void)
const uint8_t *u = unique_device_id ();
int i;
flash_unlock ();
for (i = 0; i < 4; i++)
{
uint8_t b = u[i];
@@ -212,6 +210,7 @@ main (int argc, char **argv)
(void)argc;
(void)argv;
flash_unlock ();
device_initialize_once ();
usb_lld_init ();
USB_Init();