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

Direct access to device key #9215

Merged
merged 4 commits into from
Jan 10, 2019

Conversation

offirko
Copy link
Contributor

@offirko offirko commented Dec 31, 2018

Description

Low code size tool that provides direct access to ROT Device Key
(to be used by BootLoader).

Pending on #9237

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[X] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

@offirko
Copy link
Contributor Author

offirko commented Dec 31, 2018

@cmonr , @0xc0170 , @ARMmbed/mbed-os-storage - Please review

@offirko offirko changed the title Offir bootloader direct access to device key Direct access to device key Dec 31, 2018
@ciarmcom ciarmcom requested review from a team December 31, 2018 16:00
@ciarmcom
Copy link
Member

@offirko, thank you for your changes.
@ARMmbed/mbed-os-storage @ARMmbed/mbed-os-maintainers please review.

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

Also git log might be cleaned up (reduced to few c ommits for 3 new files).

#include "FlashIAP.h"
#include <stdio.h>

int direct_access_to_devicekey(uint32_t tdb_start_offset, uint32_t tdb_end_offset, void *data_buf,
Copy link
Contributor

Choose a reason for hiding this comment

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

is this missing doxygen ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, I added doxygen info - and squashed the log

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, looks better. But still can be improved: "inital version" - what initial version is it? what does it bring? or successfully compiled ?

Copy link
Contributor Author

@offirko offirko Jan 2, 2019

Choose a reason for hiding this comment

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

@0xc0170 - I'm not sure I follow.. git is source control. Part of its use is to track the different development stages (e.g. enabling quick recovery milestones..) . I agree that sometimes there are too many unimportant stages that can be squashed .. but in general I don't think we should rewrite git-log history prior to delivery or make it look better)..

Copy link
Contributor

Choose a reason for hiding this comment

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

I partly agree but my point was that this feels like development branch rather than ready for the release. Don't need to squash but rather add details important for users.
Two commits msg have zero value without studying changes and this is functionality change, we should introduce it - why are we bringing this functionality change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I think I now understand what you meant - I'll add the required information.

@cmonr
Copy link
Contributor

cmonr commented Jan 3, 2019

Fixes #9196

@offirko offirko force-pushed the offir_bootloader_get-device-key branch from 6bd13b6 to e14b6b7 Compare January 3, 2019 13:09
@offirko
Copy link
Contributor Author

offirko commented Jan 3, 2019

Pending on #9237

@bulislaw
Copy link
Member

bulislaw commented Jan 3, 2019

Does it need change to design docs and storage documentation? It's hard to see how it fits in the architecture.

@dannybenor
Copy link

This code will not be documented. Is for the use of the PDMC bootloader, to reduce the size and avoid linking the full TDBStore. In 2 versions, the bootloader will completely change to a PSA oriented, and this code will not be relevant.

@cmonr
Copy link
Contributor

cmonr commented Jan 4, 2019

#9215 (comment)

Fyi @ARMmbed/mbed-docs @ARMmbed/mbed-os-maintainers
Imo, this sounds reasonable.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 4, 2019

Version based on prceeding PR

@offirko
Copy link
Contributor Author

offirko commented Jan 7, 2019

@davidsaada - can you please review - Thanks

Copy link
Contributor

@davidsaada davidsaada left a comment

Choose a reason for hiding this comment

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

Looks good, except for a few minor issues.

exit_point:
if (true == is_flash_init) {
flash.deinit();
is_flash_init = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can remove this line.

*out_tdb_start_offset = MBED_CONF_STORAGE_TDB_EXTERNAL_INTERNAL_BASE_ADDRESS;
tdb_size = MBED_CONF_STORAGE_TDB_EXTERNAL_RBP_INTERNAL_SIZE;
} else {
return MBED_ERROR_UNSUPPORTED;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should deinit flash here and on next failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad, some of the ifs are later addition to the code. I will move flash init below them.

static int reserved_data_get(FlashIAP *flash, tdbstore_area_data_t *area_params, void *reserved_data_buf,
size_t reserved_data_buf_size, size_t *actual_data_size_ptr)
{
int status = MBED_SUCCESS;;
Copy link
Contributor

Choose a reason for hiding this comment

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

redundant semicolon.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 8, 2019

Ready for CI as soon as reviewers approve (@davidsaada )

Copy link
Contributor

@davidsaada davidsaada left a comment

Choose a reason for hiding this comment

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

Looks good now.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 8, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 8, 2019

Test run: FAILED

Summary: 3 of 7 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-GCC_ARM
  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-IAR

@yossi2le
Copy link
Contributor

yossi2le commented Jan 8, 2019

I have changed the test main file to skip compiling if there is no component flashiap set for the target. I hope this will solve all the build failure.
Can you please run the CI again?
Thanks

@offirko
Copy link
Contributor Author

offirko commented Jan 9, 2019

@yossi2le - thanks for the fix!
@0xc0170 - travis failure doesnt seem to be related - can u pls rerun.

@NirSonnenschein
Copy link
Contributor

Hi @offirko,
The Travis failures are caused by an issue fixed on master a few hours ago, and this change should be propagated here via rebase. We can start CI only after travis is fixed, could you please rebase this PR?
Sorry for the trouble

offirko and others added 4 commits January 9, 2019 13:48
This enables application with code size restrictions to access
devicekey directly based on address in internal flash without kvconfig overhead
…e position.

(Supporting FILESYSTEM and TDB_EXTERNAL configuration only)
@offirko offirko force-pushed the offir_bootloader_get-device-key branch from e0eea8e to 423c4fb Compare January 9, 2019 11:49
@0xc0170
Copy link
Contributor

0xc0170 commented Jan 9, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 10, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 2
Build artifacts

@cmonr cmonr merged commit d6c014c into ARMmbed:master Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants