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

Add additional memory page for OTP slots #93

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

NKelias
Copy link
Contributor

@NKelias NKelias commented Jun 25, 2019

This reduces the size of the OTP global config field to 16 Bytes to make room for all 19 OTP slots.

fixes #91

Size of OTP config is reduced to 16 Bytes to allow for storage of 19 OTP
slots in the currently allocated 3 memory pages
Add the extra memory page used by HOTP verification slot to
documentation
This puts the various OTP slot configuration defintions into one place
of the file for better readability
This makes the size of the config a global define and adds an additional
check to prevent `cmd_write_config` from overwriting slot contents
@szszszsz szszszsz added this to the v0.55 milestone Jun 28, 2019
@NKelias NKelias changed the title Reduce size of OTP global config to 16 Bytes Add additional memory page for OTP slots Jul 2, 2019
@NKelias
Copy link
Contributor Author

NKelias commented Jul 2, 2019

Solution now changed from reduced Config page size to previous Config page size and additional memory page for OTP data (four pages in total now).

Available flash memory size in Linker Script was reduced to prevent corruption of firmware by Flash Data and vice versa.

closes #92

Updated Firmware:
storage-firmware-V0.54-6-g4b40a1a.zip

Copy link

@LennardBoediger LennardBoediger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything seems to be fine, but some comments are outdated.
Also the LENGTH = 0x0003DE00 in 4b40a1a points to page 123,75 -> not a valid page

Accepting all my comments will merge without conflicts and results in this Firmware:
nitrokey-storage-V0.55-7.zip

@@ -34,7 +34,7 @@



#define HV_FLASH_START_PAGE 497
#define HV_FLASH_START_PAGE 495
#define HV_MAGIC_NUMBER_SIZE 4
#define HV_SALT_SIZE 32
#define HV_MAGIC_NUMBER_ADDRESS (FLASH_START + HV_FLASH_START_PAGE * FLASH_PAGE_SIZE) // 0x8003e400

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#define HV_MAGIC_NUMBER_ADDRESS (FLASH_START + HV_FLASH_START_PAGE * FLASH_PAGE_SIZE)// 0x8003E200

Comment on lines +58 to 61
Page 499 - 501 : 0x800_3E600 : OTP Slots data, contains the handling structs for each OTP slot
Page 502 - 505 : 0x800_3EC00 : HOTP Slot counters, contains one offset counter per page for each of the HOTP slots
Page 506 - 508 : 0x800_3F400 : Backup pages, used for temporary backup of data to flash memory
Page 509 : 0x800_3FA00 : TOTP time, stores the Unix timestamp from the last set_time operation

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Page 497 - 500 : 0x800_3E200 : OTP Slots data, contains the handling structs for each OTP slot
Page 501 - 504 : 0x800_3EA00 : HOTP Slot counters, contains one offset counter per page for each of the HOTP slots
Page 505 - 508 : 0x800_3F200 : Backup pages, used for temporary backup of data to flash memory
Page 509 : 0x800_3FA00 : TOTP time, stores the Unix timestamp from the last set_time operation

@@ -48,7 +48,7 @@ ENTRY(_start)

MEMORY
{
FLASH (rxai!w) : ORIGIN = 0x80000000, LENGTH = 0x00040000
FLASH (rxai!w) : ORIGIN = 0x80000000, LENGTH = 0x0003DE00

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FLASH (rxai!w) : ORIGIN = 0x80000000, LENGTH = 0x0003D800

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FLASH (rxai!w) : ORIGIN = 0x80000000, LENGTH = 0x0003D800
0x0003DE00 links to page 123,75 -> 0x0003D800 will link to a full page (123)

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.

Writing TOTP15 overwrites HOTP1
3 participants