Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flashimage: remove unnecessary ord() #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

osresearch
Copy link

When running with an image file there is an error in the call to ord() on the body:

% python3 dumpflash.py -i raw.rom -P 0x2000 -O 64 --bp 64 -c check_ecc
PageSize: 0x2000
OOBSize: 0x40
PagePerBlock: 0x40
BlockSize: 0x80000
RawPageSize: 0x2040
FileSize: 0x10800000
PageCount: 0x8400

Traceback (most recent call last):
  File "dumpflash.py", line 160, in <module>
    flash_image_io.check_ecc()
  File "/home/hudson/sec/nand/dumpflash/dumpflash/flashimage.py", line 73, in check_ecc
    oob_ecc0 = ord(data[self.SrcImage.PageSize])
TypeError: ord() expected string of length 1, but int found

Fixing that one produces another error in the ecc; I can't verify if this change breaks the ftdi interface:

% python3 dumpflash.py -i raw.rom -P 0x2000 -O 64 --bp 64 -c check_ecc
PageSize: 0x2000
OOBSize: 0x40
PagePerBlock: 0x40
BlockSize: 0x80000
RawPageSize: 0x2040
FileSize: 0x10800000
PageCount: 0x8400

Traceback (most recent call last):
  File "dumpflash.py", line 160, in <module>
    flash_image_io.check_ecc()
  File "/home/hudson/sec/nand/dumpflash/dumpflash/flashimage.py", line 80, in check_ecc
    (ecc0, ecc1, ecc2) = ecc_calculator.calc(body)
  File "/home/hudson/sec/nand/dumpflash/dumpflash/ecc.py", line 52, in calc
    ch = ord(body[i])
TypeError: ord() expected string of length 1, but int found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant