fix stlinkv2.py
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2012-09-18 Niibe Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
|
* tool/stlinkv2.py (stlinkv2.option_bytes_erase)
|
||||||
|
(stlinkv2.flash_erase_all, stlinkv2.flash_erase_page): : Fix
|
||||||
|
OperationFailure (was OperationError).
|
||||||
|
(main): Call option_bytes_erase if it's not 0xff.
|
||||||
|
|
||||||
2012-09-12 Niibe Yutaka <gniibe@fsij.org>
|
2012-09-12 Niibe Yutaka <gniibe@fsij.org>
|
||||||
|
|
||||||
* src/sha256.c: Include <stdint.h>.
|
* src/sha256.c: Include <stdint.h>.
|
||||||
|
|||||||
@@ -38,14 +38,12 @@ We can examine key information of gpg-agent by "KEYINFO" command.
|
|||||||
Here is my example::
|
Here is my example::
|
||||||
|
|
||||||
$ gpg-connect-agent "KEYINFO --list" /bye
|
$ gpg-connect-agent "KEYINFO --list" /bye
|
||||||
S KEYINFO 4970A0D537CA2EF7CE6A106E47AD89B0EFB684C8 D - - - - -
|
|
||||||
S KEYINFO 65F67E742101C7FE6D5B33FCEFCF4F65EAF0688C T D276000124010200F517000000010000 OPENPGP.2 - - -
|
S KEYINFO 65F67E742101C7FE6D5B33FCEFCF4F65EAF0688C T D276000124010200F517000000010000 OPENPGP.2 - - -
|
||||||
S KEYINFO 5D6C89682D07CCFC034AF508420BF2276D8018ED T D276000124010200F517000000010000 OPENPGP.3 - - -
|
|
||||||
S KEYINFO 7D180C0C2A991B25204110A92F5F92A5A509845B D - - - - -
|
|
||||||
S KEYINFO 101DE7B639FE29F4636BDEECF442A9273AFA6565 T D276000124010200F517000000010000 OPENPGP.1 - - -
|
S KEYINFO 101DE7B639FE29F4636BDEECF442A9273AFA6565 T D276000124010200F517000000010000 OPENPGP.1 - - -
|
||||||
|
S KEYINFO 5D6C89682D07CCFC034AF508420BF2276D8018ED T D276000124010200F517000000010000 OPENPGP.3 - - -
|
||||||
OK
|
OK
|
||||||
|
|
||||||
I have two local keys (in my PC) and three keys in my token.
|
I have three keys in my token.
|
||||||
|
|
||||||
With the script below, I extract public key of the keygrip
|
With the script below, I extract public key of the keygrip
|
||||||
5D6C89682D07CCFC034AF508420BF2276D8018ED into the file: 5D6C8968.bin::
|
5D6C89682D07CCFC034AF508420BF2276D8018ED into the file: 5D6C8968.bin::
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ class stlinkv2(object):
|
|||||||
|
|
||||||
self.write_memory_u32(FLASH_CR, FLASH_CR_LOCK)
|
self.write_memory_u32(FLASH_CR, FLASH_CR_LOCK)
|
||||||
if (status & FLASH_SR_EOP) == 0:
|
if (status & FLASH_SR_EOP) == 0:
|
||||||
raise OperationError("option bytes erase")
|
raise OperationFailure("option bytes erase")
|
||||||
|
|
||||||
def flash_write_internal(self, addr, data, off, size):
|
def flash_write_internal(self, addr, data, off, size):
|
||||||
prog = gen_prog_flash_write(addr,size)
|
prog = gen_prog_flash_write(addr,size)
|
||||||
@@ -415,7 +415,7 @@ class stlinkv2(object):
|
|||||||
self.write_memory_u32(FLASH_CR, FLASH_CR_LOCK)
|
self.write_memory_u32(FLASH_CR, FLASH_CR_LOCK)
|
||||||
|
|
||||||
if (status & FLASH_SR_EOP) == 0:
|
if (status & FLASH_SR_EOP) == 0:
|
||||||
raise OperationError("flash erase all")
|
raise OperationFailure("flash erase all")
|
||||||
|
|
||||||
def flash_erase_page(self, addr):
|
def flash_erase_page(self, addr):
|
||||||
self.write_memory_u32(FLASH_KEYR, FLASH_KEY1)
|
self.write_memory_u32(FLASH_KEYR, FLASH_KEY1)
|
||||||
@@ -439,7 +439,7 @@ class stlinkv2(object):
|
|||||||
self.write_memory_u32(FLASH_CR, FLASH_CR_LOCK)
|
self.write_memory_u32(FLASH_CR, FLASH_CR_LOCK)
|
||||||
|
|
||||||
if (status & FLASH_SR_EOP) == 0:
|
if (status & FLASH_SR_EOP) == 0:
|
||||||
raise OperationError("flash page erase")
|
raise OperationFailure("flash page erase")
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
mode = self.stl_mode()
|
mode = self.stl_mode()
|
||||||
@@ -564,6 +564,9 @@ def main(show_help, erase_only, no_protect, spi_flash_check,
|
|||||||
stl.setup_gpio()
|
stl.setup_gpio()
|
||||||
|
|
||||||
if unlock:
|
if unlock:
|
||||||
|
if option_bytes != 0xff:
|
||||||
|
stl.reset_sys()
|
||||||
|
stl.option_bytes_erase()
|
||||||
stl.reset_sys()
|
stl.reset_sys()
|
||||||
stl.option_bytes_write(OPTION_BYTES_ADDR,RDP_KEY)
|
stl.option_bytes_write(OPTION_BYTES_ADDR,RDP_KEY)
|
||||||
stl.usb_disconnect()
|
stl.usb_disconnect()
|
||||||
|
|||||||
Reference in New Issue
Block a user