-
Notifications
You must be signed in to change notification settings - Fork 9
Add support for writing to and reading from a slot #6
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
Patater
merged 2 commits into
ARMmbed:mbed-cryptoauthlib
from
AndrzejKurek:read_write_slot
Jun 21, 2019
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why would the driver expose a way to read/write at an offset? The API only provides a way to import/export the key as a whole.
Uh oh!
There was an error while loading. Please reload this page.
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 a possibility to store arbitrary data at any slot (slot 8 in our case), for example a certificate, or a signature. The user might want to write and/or read to a slot, depending on the configuration.
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.
Ok, but that would be exposed through the API via
psa_import_key
andpsa_export_key
with the key typePSA_KEY_TYPE_RAW_DATA
. These functions read/write the whole slot.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.
Ok, I didn't know that that's the plan. I can refactor the import_key and export_key procedures to factor for that, I would just like to get a confirmation from @Patater.
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.
Sounds like we don't need extra function pointers in the struct then, since we have import and export function pointers already. Let's use those.
Do we want to register a new driver struct under a different lifetime for handling raw data? or add a switch statement inside the existing driver import/export function implementation?
Uh oh!
There was an error while loading. Please reload this page.
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.
The export_key function won't know about the key type unless it's passed to it or if it will check the hardware to determine which method of reading to use.
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.
Oh, you mean the
export_key
function in the driver? I guess it should receive the key attributes as an argument. Right now it only gets the size and location. Why isn't it enough to know the size and location, by the way?Uh oh!
There was an error while loading. Please reload this page.
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.
The public key is stored fragmented and padded, and has to be read using a dedicated
atcab_get_pubkey
function that converts it to a readable format. Clear text reads are used for raw data, and exporting a private key is not even possible.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.
OK, so the secure element API has to be updated. Should I do it? Will it be a part of a different PR? @Patater - are we planning on switching from https://github.com/Patater/mbed-crypto/tree/secure-element to an official branch?
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 are other pending updates to the SE API to cope with driver registration, key registration and updates to the application API. That's on me at the moment, together with https://jira.arm.com/browse/IOTCRYPT-608 and https://jira.arm.com/browse/IOTCRYPT-778