fix scripts

This commit is contained in:
NIIBE Yutaka
2016-10-15 20:14:18 +09:00
parent 27bd37781a
commit d2261d53e3
4 changed files with 7 additions and 0 deletions

View File

@@ -1,5 +1,9 @@
2016-10-15 Niibe Yutaka <gniibe@fsij.org> 2016-10-15 Niibe Yutaka <gniibe@fsij.org>
* tool/gnuk_put_binary_libusb.py (main): Likewise.
* tool/upgrade_by_passwd.py (main): Add call of cmd_select_openpgp
method.
* src/openpgp.c (gpg_init): flash_init_keys shoule be after * src/openpgp.c (gpg_init): flash_init_keys shoule be after
gpg_data_scan since flash_init_keys accesses Data Object for gpg_data_scan since flash_init_keys accesses Data Object for
key attributes. key attributes.

View File

@@ -49,6 +49,7 @@ def main(fileid, is_update, data, passwd):
raise ValueError("No ICC present") raise ValueError("No ICC present")
elif gnuk.icc_get_status() == 1: elif gnuk.icc_get_status() == 1:
gnuk.icc_power_on() gnuk.icc_power_on()
gnuk.cmd_select_openpgp()
gnuk.cmd_verify(BY_ADMIN, passwd.encode('UTF-8')) gnuk.cmd_verify(BY_ADMIN, passwd.encode('UTF-8'))
gnuk.cmd_write_binary(fileid, data, is_update) gnuk.cmd_write_binary(fileid, data, is_update)
gnuk.cmd_select_openpgp() gnuk.cmd_select_openpgp()

View File

@@ -46,6 +46,7 @@ def main(passwd):
raise ValueError("No ICC present") raise ValueError("No ICC present")
elif gnuk.icc_get_status() == 1: elif gnuk.icc_get_status() == 1:
gnuk.icc_power_on() gnuk.icc_power_on()
gnuk.cmd_select_openpgp()
gnuk.cmd_verify(BY_ADMIN, passwd.encode('UTF-8')) gnuk.cmd_verify(BY_ADMIN, passwd.encode('UTF-8'))
gnuk.cmd_select_openpgp() gnuk.cmd_select_openpgp()
gnuk.cmd_put_data_remove(0x00, 0xc7) # FP_SIG gnuk.cmd_put_data_remove(0x00, 0xc7) # FP_SIG

View File

@@ -44,6 +44,7 @@ def main(wait_e, keyno, passwd, data_regnual, data_upgrade):
rsa_raw_pubkey = rsa.get_raw_pubkey(rsa_key) rsa_raw_pubkey = rsa.get_raw_pubkey(rsa_key)
gnuk = get_gnuk_device() gnuk = get_gnuk_device()
gnuk.cmd_select_openpgp()
gnuk.cmd_verify(BY_ADMIN, passwd.encode('UTF-8')) gnuk.cmd_verify(BY_ADMIN, passwd.encode('UTF-8'))
gnuk.cmd_write_binary(1+keyno, rsa_raw_pubkey, False) gnuk.cmd_write_binary(1+keyno, rsa_raw_pubkey, False)