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

PSA ITS update #9192

Closed
wants to merge 18 commits into from
Closed

PSA ITS update #9192

wants to merge 18 commits into from

Conversation

orenc17
Copy link
Contributor

@orenc17 orenc17 commented Dec 24, 2018

Description

Update PSA-ITS to revision 1.0 as described here

Pull request type

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

Reviewers

@alzix @davidsaada @Patater @moranpeker

@ciarmcom ciarmcom requested review from alzix, davidsaada, moranpeker, Patater and a team December 24, 2018 14:00
@ciarmcom
Copy link
Member

@orenc17, thank you for your changes.
@alzix @Patater @davidsaada @moranpeker@ARMmbed/mbed-os-maintainers please review.

#define PSA_ITS_ERROR_BAD_POINTER 5 /**< The operation failed because one of the provided pointers is invalid, for example is `NULL` or references memory the caller cannot access */
#define PSA_ITS_ERROR_KEY_NOT_FOUND 6 /**< The operation failed because the provided key value was not found in the storage */
#define PSA_ITS_ERROR_INCORRECT_SIZE 7 /**< The operation failed because the data associated with provided key is not the same size as `data_size`, or `offset+data_size` is too large for the data, but `offset` is less than the size */
#define PSA_ITS_ERROR_OFFSET_INVALID 8 /**< The operation failed because an offset was supplied that is invalid for the existing data associated with the uid. For example, offset is greater that the size of the data */
Copy link
Contributor

Choose a reason for hiding this comment

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

Gonna say here what I said in the PSA API repo: Some of the return codes here make the implementation inefficient. For instance, PSA_ITS_ERROR_OFFSET_INVALID imposes a redundant get_info call before get. I think that if we already have a breaking change, then we should revise the entire error codes list.

Copy link
Contributor

Choose a reason for hiding this comment

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

CC @dreemkiller

@davidsaada change requests better be sent via our spec repo.
This PR implements aggregated spec changes till now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Commented in the spec repo as well (to the PR opened by @orenc17). My comment's aim here is to stress that a review to this PR won't be full until we sort out the changes to the error code list.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please post a URL to your issue here?
It will allow us to keep track of it.
Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

It was a general comment in the PR #22 of the spec repo. I didn't elaborate regarding the problems, but they are mainly in the get implementation. I think that PSA_ITS_ERROR_OFFSET_INVALID return code is not required and that PSA_ITS_ERROR_INCORRECT_SIZE is already tested by KVStore, so no need to make the checks again.

Copy link
Contributor

@alzix alzix left a comment

Choose a reason for hiding this comment

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

ITS version used to store the file should be preserved. The reason for adding it was allowing future migrations between ITS versions.
I think it is better to save ITS version in flash and verify it upon first initialization.
@davidsaada @dreemkiller may I get your opinion on this?

@mbed-ci
Copy link

mbed-ci commented Dec 25, 2018

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

its_version_t version = { 0, 0 };
size_t actual_size = 0;
KVStore::info_t kv_info;
int status = kvstore->get_info(ITS_VERSION_KEY, &kv_info);
Copy link
Contributor

Choose a reason for hiding this comment

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

is the call to kvstore->get_info really required?
it seems that we can deduce this info from kvstore->get return code and actual size.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just making sure that no one is trying to fake the size of the key

version.minor = PSA_ITS_API_VERSION_MINOR;
}

if (kvstore->set(ITS_VERSION_KEY, &version, sizeof(version), 0) != 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.

the set statement should be executed only when version file is not found or after migration.
rewriting it unconditionally is redundant.

@mbed-ci
Copy link

mbed-ci commented Dec 26, 2018

Test run: FAILED

Summary: 3 of 7 test jobs failed
Build number : 2
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

@mbed-ci
Copy link

mbed-ci commented Dec 27, 2018

Test run: FAILED

Summary: 3 of 7 test jobs failed
Build number : 3
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

@mbed-ci
Copy link

mbed-ci commented Dec 27, 2018

Test run: FAILED

Summary: 3 of 7 test jobs failed
Build number : 4
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

@mbed-ci
Copy link

mbed-ci commented Dec 30, 2018

Test run: FAILED

Summary: 2 of 11 test jobs failed
Build number : 5
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test
  • jenkins-ci/mbed-os-ci_exporter

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 2, 2019

Please review test failures, related to the changes

@orenc17
Copy link
Contributor Author

orenc17 commented Jan 2, 2019

@ARMmbed/mbed-os-maintainers ready for CI

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 2, 2019

@ARMmbed/mbed-os-maintainers ready for CI

We can schedule a build once 5.11.1 RC passes (currently in the CI, and had already one issue so restarted again)

@cmonr
Copy link
Contributor

cmonr commented Jan 3, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 3, 2019

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 6
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 3, 2019

2 failures there are related to the device rather than this PR, we will restart the job once the device is fixed

Copy link
Contributor

@alzix alzix left a comment

Choose a reason for hiding this comment

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

LGTM

@cmonr
Copy link
Contributor

cmonr commented Jan 3, 2019

CI job restarted: jenkins-ci/mbed-os-ci_greentea-test

@cmonr cmonr requested a review from bulislaw January 3, 2019 21:27
@dreemkiller
Copy link
Contributor

Why is the header file call psa_prot_internal_storage.h instead of psa/internal_trusted_storage.h?

@orenc17
Copy link
Contributor Author

orenc17 commented Jan 29, 2019

@0xc0170 the breaking change in this PR is mainly the key type that has been chnaged

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 4, 2019

Merged via #9529

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.

10 participants