-
Notifications
You must be signed in to change notification settings - Fork 19
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
base: master
Are you sure you want to change the base?
Conversation
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
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: |
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
This reduces the size of the OTP global config field to 16 Bytes to make room for all 19 OTP slots.
fixes #91