Skip to content

PSA Secure partition manager and services #8744

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

Merged
merged 24 commits into from
Nov 27, 2018
Merged

PSA Secure partition manager and services #8744

merged 24 commits into from
Nov 27, 2018

Conversation

orenc17
Copy link
Contributor

@orenc17 orenc17 commented Nov 14, 2018

Description

  • Introduce PSA Secure partition manager (SPM) to mbed-os.
  • Add SPM tests (for PSA targets).
  • Add PSA SPM hal layer.
  • Add PSA PRoT internal trusted storage Secure implementation.
  • Integrate SPM into the boot proccess.
  • PSA manifest data generator.
  • Add PSA abstract targets to mbed-os targets.json.
  • Add artifact delivery to the tools ( by @theotherjimmy ).

Dependencies

#8667
#8680
#8730

The actual changes of this PR are in commit ad7876e0620531cadaad7502f27cdd5f4d8c814f

Pull request type

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

@theotherjimmy
Copy link
Contributor

Thanks for the credit!

@theotherjimmy
Copy link
Contributor

It looks like I forgot to update the python tests to include the new Config attribute. I'll add that later today.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 19, 2018

@ARMmbed/mbed-os-tools Please review tools changes

dependencies

2 dependencies are still in progress:

#8667 - in progress
#8680 - merged
#8730 - depends on 8667

@mohammad1603 mohammad1603 mentioned this pull request Nov 21, 2018
Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

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

My comments can be found in the commit: ad7876e

@mbed-ci
Copy link

mbed-ci commented Nov 25, 2018

Test run: SUCCESS

Summary: 4 of 4 test jobs passed
Build number : 7
Build artifacts
Build logs

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 26, 2018

We are waiting for the last dependency to land : #8730

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.

I've just noticed I did not publish this on Friday, since I reviewed there were few comments so might be already addressed.

@@ -0,0 +1,48 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited
Copy link
Contributor

Choose a reason for hiding this comment

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

All new files should have 2018 year and using SPDX identifier

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -27,6 +27,8 @@
##############################################################################
BUILD_DIR = abspath(join(ROOT, "BUILD"))

DELIVERY_DIR = abspath(join(ROOT, "DELIVERY"))
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this do? Is it documented anywhere ( no comment here, cant find it in the commit msg neither)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comment

hal/spm_api.h Outdated
*
* Wakeup the peer processor waiting on the mailbox driver event.
*
* @note The functions below should be implemented by target specific code.
Copy link
Contributor

Choose a reason for hiding this comment

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

quick question: these new docs were already reviewed by docs team or shall be done (within this pull request) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@danny4478 and @AnotherButler should know the aswer

Copy link
Contributor

Choose a reason for hiding this comment

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

@0xc0170 Which docs are you referring to?

  • The code (c and h files) was not reviewed by docs team. Once the cod is ready for merge, the docs team will generate the Doxygen for them.
  • Regarding docs, we have 3 documents (handbook) under review by the docs team.

Copy link
Contributor

Choose a reason for hiding this comment

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

Doxygen documentation (functionality docs) - they have to be reviewed by docs team.

Therefore if that is true, it would be helpful here provided what doxygen docs should be reviewed. I identified at least this header file

Copy link
Contributor

Choose a reason for hiding this comment

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

Doxygen headers for review are:
[ ] - components/TARGET_PSA/spm/spm_client.h
[ ] - components/TARGET_PSA/spm/COMPONENT_SPE/spm_server.h
[ ] - components/TARGET_PSA/spm/psa_defs.h
[ ] - hal/spm_api.h

Copy link
Contributor

Choose a reason for hiding this comment

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

Thankss, this is helpful !

@melwee01 @AnotherButler Please review these

@mbed-ci
Copy link

mbed-ci commented Nov 26, 2018

Test run: SUCCESS

Summary: 4 of 4 test jobs passed
Build number : 9
Build artifacts
Build logs

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 26, 2018

All dependencies were integrated, please rebase (I reviewed astyle failures, rebase should take care of them as well?)

@orenc17
Copy link
Contributor Author

orenc17 commented Nov 26, 2018

Branch rebased and ready to go

@NirSonnenschein
Copy link
Contributor

@0xc0170 @bulislaw , fixes are in please take a look. I'll run this through CI in anticipation of review (previous version passed so hopefully this will not be an issue)

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.

Few questions

#endif

#if (defined( __CC_ARM ) || defined(__ARMCC_VERSION) || defined( __ICCARM__ ))
#error [NOT_SUPPORTED] this test is supported on GCC only
Copy link
Contributor

Choose a reason for hiding this comment

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

What limitations are here that only GCC ARM supported? ) ?

Copy link
Contributor

@alzix alzix Nov 26, 2018

Choose a reason for hiding this comment

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

mainly assembly code included in the test


#if defined(COMPONENT_SPE)

void psa_spm_init(void);
Copy link
Contributor

Choose a reason for hiding this comment

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

why these do not have any documentation?

Copy link
Contributor

Choose a reason for hiding this comment

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

done

const uint32_t out_len
);

void channel_state_switch(uint8_t *current_state, uint8_t expected_state, uint8_t new_state);
Copy link
Contributor

Choose a reason for hiding this comment

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

these 2 functions do not have doxygen, the rest of the functions here have?

Copy link
Contributor

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

This is confusing.
This is an internal API.
AFAIU, it should not be Doxygen documented. Of course it should have normal code comments.
My bottom line is: This file comments should be be Doxygen style.


#else

#error "Non dual-chip platforms are not yet supported"
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 error correct ( this is else for COMPONENT_SPM_MAILBOX) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there should be another main function for secure-side on v8 systems.
as we are not yet supporting v8 with SPM, the compilation should fail

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 26, 2018

@ARMmbed/mbed-os-tools Please review today

@cmonr
Copy link
Contributor

cmonr commented Nov 26, 2018

Making a note here. This appears to be undergoing email discussion. Will update once resolved.

@bulislaw
Copy link
Member

bulislaw commented Nov 26, 2018

All the PRs need to be engineering ready (marked as "needs: CI") by the end of the day (Austin time). Otherwise it won't make 5.11 and will need to come in the next release (5.12 for features, 5.11.1 for fixes and new platforms).

Oren Cohen and others added 20 commits November 27, 2018 09:16
Move function description to header files

Note: it is not in Doxygen format since it is an internal module and
        Doxygen should not be generated for it
Make minor copy edits, mostly for punctuation and style.
Make minor edits, mostly for consistent capitalization and style.
Make minor edits, mostly for consistent abbreviations.
Edit file, mostly for minor grammar and style changes.
@NirSonnenschein
Copy link
Contributor

CI restarted


/* -------------------------------- Handle Manager Module ---------------------------- */

/* The Handle Manager Module manages handles.
Copy link
Contributor

Choose a reason for hiding this comment

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

Presumably. Do we need to actually state this?


/* The Handle Manager Module manages handles.
*
* It basically generates and exposes a unique handle identifier [handle] per
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't use "basically" or similar.


/* The Handle Manager Module manages handles.
*
* It basically generates and exposes a unique handle identifier [handle] per
Copy link
Contributor

Choose a reason for hiding this comment

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

(handle), (handle_mem), etc.

* - Remove a handle from the handle manager module [handle_destroy]
*
* Note:
* Handles generation is done exclusively.
Copy link
Contributor

Choose a reason for hiding this comment

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

Handle

*
* Note:
* Handles generation is done exclusively.
* Once we got a handle, removing a handle or getting its memory can be
Copy link
Contributor

Choose a reason for hiding this comment

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

we, use you instead

non-exclusively

@@ -0,0 +1,23 @@
# Mbed Secure Partition Manager (SPM)

The Platform Security Architecture (PSA) firmware framework specifications contain a logic component called the Secure Partition Manager (SPM). PSA defines a Secure Processing Environment (SPE) for:
Copy link
Contributor

Choose a reason for hiding this comment

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

Mbed secure partition manager, unless it's a brand name. Is it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the file will be removed as well

# Mbed Secure Partition Manager (SPM)

The Platform Security Architecture (PSA) firmware framework specifications contain a logic component called the Secure Partition Manager (SPM). PSA defines a Secure Processing Environment (SPE) for:

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above comment for SPM and PSA. These are general terms, not brand names, right?

The Platform Security Architecture (PSA) firmware framework specifications contain a logic component called the Secure Partition Manager (SPM). PSA defines a Secure Processing Environment (SPE) for:

* Sensitive data, such as keys, credentials and firmware.
* The code that manages it.
Copy link
Contributor

Choose a reason for hiding this comment

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

What's it?

* The code that manages it.
* Its trusted hardware resources.

The PSA SPM interfaces decouple components, allowing reuse of components in other device platform and helps to reduce an integration effort.
Copy link
Contributor

Choose a reason for hiding this comment

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

nonparallel construction


* Secures low cost IoT devices, where a full Trusted Execution Environment (TEE) would not be appropriate.
* Protects sensitive assets (keys, credentials and firmware) by separating these from the application firmware and hardware.
* Is architecture agnostic and can be implemented on different Arm Cortex®-M architectures, offering variable level of protection, based on platform resources.
Copy link
Contributor

Choose a reason for hiding this comment

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

another character render error

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 27, 2018

Restarted CI , one device failed with serial error (in events test)

@alzix
Copy link
Contributor

alzix commented Nov 27, 2018

@melwee01, thank you for review.
We will fix all your remarks in followup PR RC2

@mbed-ci
Copy link

mbed-ci commented Nov 27, 2018

Test run: SUCCESS

Summary: 4 of 4 test jobs passed
Build number : 14
Build artifacts
Build logs

@0xc0170 0xc0170 dismissed melwee01’s stale review November 27, 2018 14:22

Will be fixed in the new PR

@0xc0170 0xc0170 merged commit e69aa15 into ARMmbed:master Nov 27, 2018
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.