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

Refactor Crypto Service Proxy #10036

Merged
merged 7 commits into from Mar 26, 2019

Conversation

Projects
None yet
9 participants
@itayzafrir
Copy link
Contributor

commented Mar 11, 2019

Description

Refactor common functionality in crypto service proxy (client side) to prevent code duplication and save some flash space.

Tested locally:
Cypress - crypto sanity + crypto access control + crypto compliance - PASSED
NXP - crypto sanity + crypto access control + crypto compliance - PASSED

Pull request type

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

Reviewers

@avolinski @NirSonnenschein

Release Notes

itayzafrir

@ciarmcom ciarmcom requested review from avolinski, NirSonnenschein and ARMmbed/mbed-os-maintainers Mar 11, 2019

@ciarmcom

This comment has been minimized.

Copy link
Member

commented Mar 11, 2019

@itayzafrir, thank you for your changes.
@avolinski @NirSonnenschein @ARMmbed/mbed-os-maintainers please review.

@mikisch81

This comment has been minimized.

Copy link
Contributor

commented Mar 11, 2019

How much space did it save?
Can you post the result of the secure build before and after?

@itayzafrir

This comment has been minimized.

Copy link
Contributor Author

commented Mar 11, 2019

I'll post the size diff tomorrow, but this PR affects the non-secure side only. I'm planning on refactoring the secure side as well when I get a chance...

@orenc17
Copy link
Contributor

left a comment

Looks great, main focus is consistency
probably needed to be documented that the ipc_call returns BAD_STATE on a bad handle
But again looks great

@0xc0170 0xc0170 added needs: work and removed needs: review labels Mar 12, 2019

@itayzafrir

This comment has been minimized.

Copy link
Contributor Author

commented Mar 12, 2019

@orenc17 thanks for the review. I've added some more commits, please take a look.

Currently running tests on NXP & Cypress: crypto-sanity, crypto-access-control, crypto-compliance
All tests passed on NXP, Cypress is still running, I'll attach a log once tests are done.

@0xc0170 can you please remove the needs work label and add the needs review?

@itayzafrir

This comment has been minimized.

Copy link
Contributor Author

commented Mar 12, 2019

All tests passed locally on both Cypress & NXP:

  • crypto sanity
  • crypto access control
  • crypto compliance

test_results.txt

@itayzafrir itayzafrir force-pushed the itayzafrir:crypto-ipc-refactor branch 2 times, most recently Mar 12, 2019

itayzafrir
Unify code style
- Use designated initializers for IPC structs
- Unify variables declaration and initialization

@itayzafrir itayzafrir force-pushed the itayzafrir:crypto-ipc-refactor branch to c97b90a Mar 12, 2019

@orenc17
Copy link
Contributor

left a comment

LGTM

@0xc0170 0xc0170 added needs: review and removed needs: work labels Mar 13, 2019

@0xc0170

This comment has been minimized.

Copy link
Member

commented Mar 13, 2019

5.12.1 release target?

@itayzafrir

This comment has been minimized.

Copy link
Contributor Author

commented Mar 13, 2019

5.12.1 release target?

This isn't anything urgent, it can wait.

@0xc0170
Copy link
Member

left a comment

One small change. Otherwise looks fine

{
psa_status_t status;
psa_crypto_ipc_t psa_crypto_ipc = { 0, 0, 0 };
//TODO: add retry mechanism to make sure resources were deallocated.

This comment has been minimized.

Copy link
@0xc0170

0xc0170 Mar 18, 2019

Member

We should not leave TODO in the code, create a tracking issue rather

This comment has been minimized.

Copy link
@itayzafrir

itayzafrir Mar 18, 2019

Author Contributor

I removed the comment as it's not relevant anymore.

@itayzafrir

This comment has been minimized.

Copy link
Contributor Author

commented Mar 18, 2019

@avolinski please review

@0xc0170 0xc0170 added needs: CI and removed needs: review labels Mar 18, 2019

@0xc0170

This comment has been minimized.

Copy link
Member

commented Mar 18, 2019

While waiting for final approval, CI started


status = psa_call(handle, NULL, 0, NULL, 0);
psa_close(handle);
psa_status_t status = psa_call(*handle, in_vec, in_vec_size, out_vec, out_vec_size);

This comment has been minimized.

Copy link
@avolinski

avolinski Mar 18, 2019

Contributor

if call failed, do we close anyway?

This comment has been minimized.

Copy link
@itayzafrir

itayzafrir Mar 18, 2019

Author Contributor

yes, if close == true

@mbed-ci

This comment has been minimized.

Copy link

commented Mar 18, 2019

Test run: SUCCESS

Summary: 13 of 13 test jobs passed
Build number : 1
Build artifacts

@cmonr cmonr added ready for merge and removed needs: CI labels Mar 18, 2019

@itayzafrir

This comment has been minimized.

Copy link
Contributor Author

commented Mar 18, 2019

Please hold the merge until @avolinski completes his review.

@cmonr cmonr added needs: review and removed ready for merge labels Mar 18, 2019

@cmonr cmonr requested a review from avolinski Mar 18, 2019

@itayzafrir

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2019

All reviews are done, can we get this merged please

@NirSonnenschein NirSonnenschein merged commit ca62922 into ARMmbed:master Mar 26, 2019

28 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/build-ARMC5 Success
Details
jenkins-ci/build-ARMC6 Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR8 Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage RTOS ROM(+0 bytes) RAM(+0 bytes)
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARMC5 Success
Details
jenkins-ci/mbed2-build-ARMC6 Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR8 Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Local astyle testing has passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/doxy-spellcheck Local doxy-spellcheck testing has passed
Details
travis-ci/events Passed, runtime is 9126 cycles (-66 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/include_check Local include_check testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8408B (+0.00%)
Details
travis-ci/psa-autogen Local psa-autogen testing has passed
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details
travis-ci/tools-py3.5 Local tools-py3.5 testing has passed
Details
travis-ci/tools-py3.6 Local tools-py3.6 testing has passed
Details
travis-ci/tools-py3.7 Local tools-py3.7 testing has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.