-
Notifications
You must be signed in to change notification settings - Fork 3k
DeviceKey Root of Trust generation refactored. #12385
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
Conversation
@tymoteuszblochmobica, thank you for your changes. |
Uhh I guess you meant @teetak01 |
@yogpan01 and @JammuKekkonen This is now the change we talked about. This basically breaks existing client test applications which assume RoT to be autogenerated, and therefore should only be pushed to Mbed OS 6.0. Please review and comment. To properly get this working, the new API has to be adopted in client test applications. |
@@ -259,22 +246,22 @@ int DeviceKey::get_derived_key(uint32_t *ikey_buff, size_t ikey_size, const unsi | |||
return DEVICEKEY_SUCCESS; | |||
} | |||
|
|||
int DeviceKey::generate_key_by_random(uint32_t *output, size_t size) | |||
int DeviceKey::device_generate_root_of_trust() |
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.
I know I proposed this name, but I'm starting to wonder.. is there and extra "device" in the DeviceKey::device_do_something...
Maybe the DeviceKey::generate_root_of_trust()
should be enough.
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.
Renamed
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.
Change looks good. Just minor change requested.
This need OK from client team before merge.
@@ -283,7 +270,7 @@ int DeviceKey::generate_key_by_random(uint32_t *output, size_t size) | |||
|
|||
mbedtls_entropy_free(entropy); | |||
delete entropy; | |||
|
|||
device_inject_root_of_trust(key_buff, actual_size); |
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.
Error code needs to be recorded from here as well. The injection phase can fail as rell, so
ret = device_inject_root_of_trust(key_buff, actual_size);
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.
Changed
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.
Once the issues mentioned by Seppo have been addressed this looks ok from my point of view.
31cfc3e
to
1938190
Compare
Pull request has been modified.
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.
*/ | ||
int generate_key_by_random(uint32_t *output, size_t size); | ||
int generate_root_of_trust(); |
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.
Should be changed to public api. Seems like it could/should also be static.
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.
Writing a unit test for this wouldn't hurt.
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.
It is now changed to public.
static DeviceKey &get_instance()
{
// Use this implementation of singleton (Meyer's) rather than the one that allocates
// the instance on the heap, as it ensures destruction at program end (preventing warnings
// from memory checking tools, such as valgrind).
static DeviceKey instance;
return instance;
}
CI started |
Test run: FAILEDSummary: 1 of 11 test jobs failed Failed test jobs:
|
Rest of failing tests updated. |
Test run: FAILEDSummary: 1 of 4 test jobs failed Failed test jobs:
|
Test run: SUCCESSSummary: 8 of 8 test jobs passed |
@tymoteuszblochmobica I added breaking change label. Can you update the release notes (no migration needed ?) ? Also:
Is not saying much to a user, what real impact is there? |
@0xc0170 I updated the PR header, that should be now OK for release notes. Or do we need to add a separate title for that? |
Since ARMmbed/mbed-os#12385: 0e7a53c DeviceKey Root of Trust generation refactored. the Root of Trust is not automatically generated anymore. We need to generate or inject one explicitly. This commit also improves the readability of the existing code for the injection of Root of Trust.
Since ARMmbed/mbed-os#12385: 0e7a53c DeviceKey Root of Trust generation refactored. the Root of Trust is not automatically generated anymore. We need to generate or inject one explicitly. This commit also improves the readability of the existing code for the injection of Root of Trust. Fixes ARMmbed#71
Since ARMmbed/mbed-os#12385: 0e7a53c DeviceKey Root of Trust generation refactored. the Root of Trust is not automatically generated anymore. We need to generate or inject one explicitly. This commit also improves the readability of the existing code for the injection of Root of Trust. Fixes ARMmbed#71
Root of Trust is no longer automatically and silently created.
Summary of changes
Removed automatic creation of the Root Of Trust when
DeviceKey::generate_derived_key(...)
API is used.User must generate or inject the key before first use of
DeviceKey
API.Impact of changes
DeviceKey is not automatically generated anymore. This might impact test application which expect the key to be present, but do not explicitly generate it.
Migration actions required
Application developers must be aware that if their device does not have Root of Trust permanently injected, which is usually true in development phase, they must generate a key before first use of
DeviceKey
API. Two options exist for key generation:DeviceKey::device_generate_root_of_trust()
DeviceKey::device_inject_root_of_trust(...)
in case the device does not have a TRNG available.Documentation
ARMmbed/mbed-os-5-docs#1244
Release notes
Pull request type
Test results
Reviewers
@SeppoTakalo
@michalpasztamobica
@Jammu Kekkonen
@teetak01
@janne Kiiskila