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

Compile-time constant unique value #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Compile-time constant unique value #7

wants to merge 2 commits into from

Conversation

arturkow2
Copy link
Contributor

No description provided.

config TWPM_CONST_UNIQUE
bool "Set constant unique value"
help
DANGER! This is intended mostly for testing or for platform bringup.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have issue on our problems with providing a reliable unique value?
Maybe linking this issue here would also help to understand why we are doing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's described in Dasharo/twpm-docs#25. I updated commit message to point to my comment.

Allow to set constant unique value through Kconfig, the value will be
contained in binary and will be the same for all devices. This is
intented as testing or for platform bringup, where unique data cannot be
obtained through HWINFO or other interfaces.

Enable this by default on OrangeCrab as we don't support generating
per-platform unique-ID yet.

See Dasharo/twpm-docs#25 (comment)
for details.
Not failing would result in having zero seed potentially causing many
weird problems.
LOG_WRN("TwPM was built with CONFIG_TWPM_CONST_UNIQUE, the implementation is not secure!");

#define TO_STRING(x) #x
const char *const string = TO_STRING(CONFIG_TWPM_CONST_UNIQUE_VALUE);
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't do what I'd expect it to do. It creates an array of bytes with values [0-9a-f], so 16/256 possible values. Entropy is very low, OTOH it is hardcoded anyway so it probably doesn't matter. In any case, I think this should be mentioned in the description of TWPM_CONST_UNIQUE_VALUE in Kconfig, and maybe a different default (with characters different than hexadecimal) should be used as an example.

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.

4 participants