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

NV items naming error. #233

Closed
hacker-cb opened this issue Oct 8, 2020 · 1 comment
Closed

NV items naming error. #233

hacker-cb opened this issue Oct 8, 2020 · 1 comment

Comments

@hacker-cb
Copy link
Contributor

Currently we are working for backup migration 2538 <-> 2652 and seems that we found some naming error.

LEGACY_TCLK_TABLE_START = 257, // Valid for <= Z-Stack 3.0.x

257 = 0x101

ZComDef.h from the TI Z-Stack 1.2

// NV Items Reserved for Trust Center Link Key Table entries
// 0x0101 - 0x01FF
#define ZCD_NV_TCLK_TABLE_START           0x0101
#define ZCD_NV_TCLK_TABLE_END             0x01FF

TI Z-Stack 3.0:

// NV Items Reserved for Trust Center Link Key Table entries
// 0x0101 - 0x01FF
#define ZCD_NV_TCLK_SEED                  0x0101  //Seed
#define ZCD_NV_TCLK_JOIN_DEV              0x0102  //Nv Id where Joining device store their APS key. Key is in plain text.
#define ZCD_NV_TCLK_DEFAULT               0x0103  //Not accually a Nv Item but Id used by SecMgr

#define ZCD_NV_TCLK_IC_TABLE_START        0x0104  //IC keys, refered with shift byte
#define ZCD_NV_TCLK_IC_TABLE_END          0x0110

#define ZCD_NV_TCLK_TABLE_START           0x0111  //Entries to store users of the keys
#define ZCD_NV_TCLK_TABLE_END             0x01FF

I Z-Stack 3.x

// NV Items Reserved for Trust Center Link Key Table entries
// 0x0101 - 0x01FF
#define ZCD_NV_TCLK_SEED                  0x0101  //Seed
#define ZCD_NV_TCLK_JOIN_DEV              0x0102  //Nv Id where Joining device store their APS key. Key is in plain text.
#define ZCD_NV_TCLK_DEFAULT               0x0103  //Not accually a Nv Item but Id used by SecMgr

#define ZCD_NV_LEGACY_TCLK_IC_TABLE_START 0x0104  // Deprecated. Refer to ZCD_NV_EX_TCLK_IC_TABLE
#define ZCD_NV_LEGACY_TCLK_IC_TABLE_END   0x0110  // IC keys, refered with shift byte

#define ZCD_NV_LEGACY_TCLK_TABLE_START    0x0111  // Deprecated. Refer to ZCD_NV_EX_TCLK_TABLE
#define ZCD_NV_LEGACY_TCLK_TABLE_END      0x01FF

Also currently for 3.0 you backup table 0x0101 with length 16 bytes instead of backup table 0x0111 with length 19 bytes.
@Koenkk which table we need to really backup in your opinion? 0x0101 or 0x0111?

We will prepare fix with names.

@hacker-cb
Copy link
Contributor Author

Fixed in #234

Koenkk pushed a commit that referenced this issue Oct 9, 2020
* Fix error for LEGACY_TCLK_TABLE_START item ID.
#233

* Fix tests

* Fix LEGACY_TCLK_TABLE_START 511 -> 273 (mistake during convert from hex)

* Added ZCD_NV_TCLK_SEED to backup. Previously it was ZCD_NV_LEGACY_TCLK_TABLE_START with wrong ID

* Fix tests

* Fix ZCD_NV_EX_TCLK_TABLE and ZCD_NV_LEGACY_TCLK_TABLE_START tables in backup data in restore tests

* Added LEGACY_TCLK_TABLE_START_12 to avoid break on 1.2 Stack

* Rename Items.tcLinkKey -> Items.tcLinkKey12 to make clear it's for Zstack 12 only.

* Remove TCLK_SEED from backup
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

No branches or pull requests

1 participant