Skip to content

Commit

Permalink
Add fourth memory page for HOTP
Browse files Browse the repository at this point in the history
  • Loading branch information
NKelias committed Jul 2, 2019
1 parent ddd440f commit 7b54cba
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/HighLevelFunctions/HiddenVolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions src/OTP/hotp.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ Page 506 - 508 : 0x800_3F400 : Backup pages, used for temporary backup of data
Page 509 : 0x800_3FA00 : TOTP time, stores the Unix timestamp from the last set_time operation
*/
#define FLASH_START 0x80000000
#define OTP_FLASH_START_PAGE 499
#define SLOTS_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*0))
#define SLOT1_COUNTER_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*3))
#define SLOT2_COUNTER_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*4))
#define SLOT3_COUNTER_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*5))
#define SLOT4_COUNTER_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*6))
#define BACKUP_PAGE_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*7))
#define TIME_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*10))
#define OTP_FLASH_START_PAGE 497
#define SLOTS_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*0)) // 497
#define SLOT1_COUNTER_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*4)) // 501
#define SLOT2_COUNTER_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*5)) // 502
#define SLOT3_COUNTER_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*6)) // 503
#define SLOT4_COUNTER_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*7)) // 504
#define BACKUP_PAGE_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*8)) // 505
#define TIME_ADDRESS (FLASH_START + OTP_FLASH_START_PAGE * FLASH_PAGE_SIZE + (FLASH_PAGE_SIZE*12)) // 509

/* Backup page layout:
0x800_3F400 - 0x800_3F7F4 : 1524 Bytes : Backup Memory
Expand All @@ -85,9 +85,9 @@ Page 509 : 0x800_3FA00 : TOTP time, stores the Unix timestamp from the la
#define NUMBER_OF_HOTP_SLOTS 4
#define NUMBER_OF_TOTP_SLOTS 15

/* OTP Global Configuration: 16 Bytes at beginning of Slot pages: */
/* OTP Global Configuration: 64 Bytes at beginning of Slot pages: */
#define GLOBAL_CONFIG_OFFSET 0
#define GLOBAL_CONFIG_SIZE 16
#define GLOBAL_CONFIG_SIZE 64
/*
global config slot:
Expand Down
6 changes: 3 additions & 3 deletions src/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@

// Flash map (Block 0 - 511)
// Bootloader / flash loader block 0 - 16 8 KB
// Programm code block 16 - 497
// Hidden volume setup data block 498 - 499 HV_FLASH_START_PAGE (block 499 is free for extensions)
// OTP data block 500 - 510 OTP_FLASH_START_PAGE
// Programm code block 16 - 494
// Hidden volume setup data block 495 - 496 HV_FLASH_START_PAGE (block 496 is free for extensions)
// OTP data block 497 - 510 OTP_FLASH_START_PAGE
// Password safe data block 510 - 511 PWS_FLASH_START_PAGE
//
// Warning flash data starts at block 498 > space for program code + bootloader is 254976 byte
Expand Down

0 comments on commit 7b54cba

Please sign in to comment.