-
Notifications
You must be signed in to change notification settings - Fork 28
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
RFC: Support for SUIT in the Firmware Update API #174
base: main
Are you sure you want to change the base?
Conversation
* Reworked the state model and API based on detailed understanding of the Multiple Trust Domain extension to the base SUIT specification. * Added component state information to the detailed sequence graphic to clarify the programming model. * Aligned the document with the details of the SUIT specifications. * Provided more detail on how the API design supports the alternative flow scenarios.
I've updated the proposal following initial discussion, and further, detailed reading of some of the additional SUIT specifications relating to nested/dependency manifests.
Much of the text has been altered or completely rewritten - if you have read v1, it may be worthwhile reading the whole new proposal, instead of reviewing the diffs. |
A second update to the proposal.
A few key open issues remain:
|
369a74d
to
9668daa
Compare
* Removed the FETCHING state * Addressed the issues relating to the use of payload fetching during the suit-install sequence. * Added extra flow diagrams * Further clarification of component ids * Realised that an alternate flow might be a better API fit - see the Appendix with alternate sequence diagrams.
Version 0.4 uploaded. Revision notes:
Note also: Alternative flow is possible with one-at-a-time restriction. See the appendix in the proposal for details. |
Resolution of all substantial open issues: * The alternative flow in v0.4 is not viable as it combines the payload phase with the install phase. This prevents the use case where the decision to apply/install the update can be separated from the delivery of the update. The associated appendix has been removed. * The two phases of payload fetching need to have distinct states for the envelope component. The first phase is non-destructive of the current firmware, so the work to abandon an update is different in these two phases. PROCESSING state is now FETCHING and INSTALLING states. * Added the suit-resolve-dependencies and suit-candidate-validation to the sequence diagrams to clarify where these SUIT command sequences fit. * Added detail to the error, cancellation, and restart sections relating to the FETCHING and INSTALLING states, and the ability to cancel and restart the current payload fetch.
Updated to v0.5 - see commit or revision history for update notes. |
ed8bdda
to
c7c37a6
Compare
v0.6: I've made an attempt to define the API. This raises a few additional issues to resolve relating to detailed API design. |
design/rfc-01-fwu-suit/rfc-01.rst
Outdated
|
||
* 8: If a payload is required that is detached from the Envelope, the call to ``psa_fwu_process()`` returns with a new status code, ``PSA_FWU_PAYLOAD_REQUIRED``. The call to ``psa_fwu_process()`` includes an output parameter, which the service uses to provide the details of the payload to be transferred, including a component identifier for the payload (for use with ``psa_fwu_start()`` etc), and a URI for the payload. | ||
|
||
*The Update service might also have information about the size and digest of the payload to be fetched. These could be optionally be provided with the payload URI: are there benefits in using this information to eliminate or detect incorrect or malicious transfers prior to transfer to the Update service?* |
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.
That functionality may cause confusions. In SUIT, a digest value (or expected payload size) in not a fixed property of component but rather an argument to directive-override-parameters ‘, so:
- Expected digest value (or expected payload size) may be unknown at time of execution of ‘directive-fetch‘ – there is nothing what enforces a manifest creator to call ‘directive-override-parameters’ prior to ‘directive-fetch‘
- Manifest may be crafted in a way that it accepts alternative payloads represented by single URI. In such case manifest may evaluate several digest values on fetched payload.
- Methods of digest calculation for regular image and dependency manifest differs.
- Manifest may be crafted in a way that it repeats fetching in case if recently downloaded payload is damaged, so some resiliency mechanisms are already in-place.
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 not unlikely that the digest parameter will already be set when calling suit-directive-fetch:
-
One of the optimisations suggested for a SUIT processor when restarting a command sequence after interruption, is to elide the fetching of a payload that has already been transferred, by matching a stored payload using the digest of the requested payload.
-
This optimisation depends on the component's digest parameter being set prior to the suit-directive-fetch command. In the absence of the digest parameter the optimisation is disabled, and the payload will always be fetched.
I can see that for some systems, being able to detect a non-matching image before download, might avoid costly download or store-to-flash overheads. This could improve long-term-reliability, but only if having incorrect payload images on the update server is considered to be probable. It does not significantly mitigate security concerns, as an attacker can present an acceptable digest, but an invalid image, and would still result in the download and transfer of the image before the SUIT digest verification reports an error.
Conclusion
Adding these might be beneficial for some systems/deployments, but the availability of these attributes is not guaranteed. Therefore, if we add them to the payload information, then they must be optional, and we need another field in the payload information to individually indicate if these parameters are present in the information.
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.
This is now (from v0.8 of the proposal) optionally provided in the payload information, with a flag to indicate its presence.
design/rfc-01-fwu-suit/rfc-01.rst
Outdated
* 7: If processing is required, the Update client then calls ``psa_fwu_process()`` to begin manifest processing. At this point the Update service will do the following: | ||
|
||
* Verify and authenticate the manifest. | ||
* Process the Update command sequences: system validation, dependency resolution, payload fetch, payload verification. |
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.
There is no dedicated ‘system validation’ sequence defined in SUIT specification. Maybe it is worth to remove it?
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 think when I first wrote this I was thinking about checking that the update matches the system (device type, etc.) - but that would be integrated into one of the other sequences.
Fixed.
design/rfc-01-fwu-suit/rfc-01.rst
Outdated
|
||
* 22: To proceed with the installation, the Update client now calls ``psa_fwu_install()``. | ||
|
||
* 23: The flow in Figure 3 shows a system which requires a reboot to continue with the installation. The suit-install SUIT command sequences will be processed after the reboot. |
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.
suit-candidate-validation and suit-install?
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.
Corrected
design/rfc-01-fwu-suit/rfc-01.rst
Outdated
Dependency manifests | ||
~~~~~~~~~~~~~~~~~~~~ | ||
|
||
In SUIT, a dependency manifest (one nested within a dependent manifest) is not processed in an isolated manner. Instead, all dependency manifests, including those nested at deeper levels, are identified and fetched before any other payload. Then the full set of manifests is involved in each of the subsequent command processing stages of the SUIT top-level (root) manifest. |
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.
"Then the full set of manifests is involved...," Actually - Currently processed command sequence MAY execute 'process-dependency' on any dependencies of currently processed manifests.
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.
Corrected/clarified.
Update to the API: * Describe a third (preferred) option for the payload information discovery API, OPTION C. This is also reflected in updated sequence diagrams. * Permit an implementation to optionally provide additional payload size and digest information. (Only coded into Option C).
Updated the proposal to v0.8:
|
The Open Issues remaining:
|
The alternative options for the API design (A and B) have been retired to an appendix, so that the API definition is clearer.
Minor updates to finalize API details
This is a draft PR that creates an RFC proposal document, considering how to implement full support for SUIT in the Firmware Update API.
Reading the proposal is easiest by viewing the document in its branch: rfc-01-fwu-suit
Please provide feedback on the analysis, the draft proposal, and any of the currently open issues (end of the document right now); either in the PR discussion thread, or as review comments against the 'Files changed'.