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.
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 drivers: specification for key derivation #5451
PSA drivers: specification for key derivation #5451
Changes from 8 commits
a2b4159
220bda7
c2e2910
1a5b830
3fc9e04
54eb068
d9645c8
eda71ce
4e346bd
635b779
fd09408
66b96e2
4e94fea
d2fe1d5
f787879
b319ed6
e52bff9
24f5229
1414bc3
f96a18e
dcaf104
7df8ba6
8dd1e62
f4ba001
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
@silabs-hannes notes that it would be convenient to pass the key attributes here. And indeed that's how it's supposed to work.
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.
If I understand correctly, this call happens in case of a call to
psa_key_derivation_output_key/verify_key/verify_bytes
that has not stopped in the previous steps. This seems correct to me but maybe it would be easier to understand if the series of driver calls was described for each PSA API separately (longer spec with repetitions though).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.
Each step only applies if none of the previous steps had a “stop” instruction. Otherwise the preconditions on each step get increasingly complex and it's hard to see if they're exhaustive.
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 would be more comfortable with two series of steps, one for the
psa_key_derivation_output_bytes()
andpsa_key_derivation_output_key()
APIs and one for thepsa_key_derivation_verify_bytes()
orpsa_key_derivation_verify_key()
APIs. But this is not a blocker.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've split that part into one list for each function, because upon reflection the fallbacks between the various cases weren't quite correct. I'm not fully confident that the spec now handles all the cases it should, but this is the sort of thing that's best checked by implementing, so I'd rather not polish it further for now.
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.
From the following it seems it is an operation object. Shouldn't is name reflect that? What about to make it mandatory?
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.
Operation objects usually have a setup function and an abort function. Here there's just a single function, so I think it makes sense to use different terminology. But I have no strong feelings about it.
Re-reading this, I'm not sure the API works: the core chooses the amount of data that it passes to the driver, but wouldn't the driver know better? To be revised, perhaps in a follow-up.
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.
"total" as may be done in several calls?
Otherwise, does it mean that the core stop calling
derive_key
after passing the intended number of bytes and ifderiver_key
does not return SUCCESS on the last call, the derivation fails?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 the length passed at each call. Though now I'm not sure if it's right that the core chooses the length.