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

Fix the UsageFlags structure #82

Closed
hug-dev opened this issue Apr 14, 2021 · 0 comments · Fixed by #86
Closed

Fix the UsageFlags structure #82

hug-dev opened this issue Apr 14, 2021 · 0 comments · Fixed by #86
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@hug-dev
Copy link
Member

hug-dev commented Apr 14, 2021

We added a clarification in the book in parallaxsecond/parsec-book#110 regarding sign/verify_hash/message.

The following part is specifically important about sign/verify_hash:

This flag automatically sets sign_message: if an application sets the flag sign_hash when creating a key, then the key always has the permissions conveyed by sign_message. For a key pair, this concerns the private key.

I see multiple ways to fix this:

  1. Make the fields of UsageFlags private (or just the sign/verify ones?) with setters and getters on the different usages. set_sign_hash would set both sign_hash and sign_message to true.
  2. Just add verify/sign_message methods that return true if either sign/verify_message or sign/verify_hash are true.

I would prefer 1 I think but that is a breaking change. That's probably fine. 2 would make the behaviour correct if you use the new method but we would have to check that we use that everywhere. It's not breaking though.

@hug-dev hug-dev added the bug Something isn't working label Apr 14, 2021
@hug-dev hug-dev added the good first issue Good for newcomers label Apr 29, 2021
@Kakemone Kakemone self-assigned this Jul 7, 2021
Kakemone added a commit to Kakemone/rust-psa-crypto that referenced this issue Jul 7, 2021
Made the fields of UsageFlags private and added a public setter and a public getter for each field.

Signed-off-by: Sam Davis <sam.davis@arm.com>
Kakemone added a commit to Kakemone/rust-psa-crypto that referenced this issue Jul 8, 2021
Made the fields of UsageFlags private and added a public setter and a public getter for each field. Also changed the operations and tests so that they use the getter/setter rather trying to access the fields of UsageFlags directly.

Signed-off-by: Sam Davis <sam.davis@arm.com>
@hug-dev hug-dev linked a pull request Jul 8, 2021 that will close this issue
Kakemone added a commit to Kakemone/rust-psa-crypto that referenced this issue Jul 9, 2021
Made the fields of UsageFlags private and added a public setter and a public getter for each field. Also changed the operations and tests so that they use the getter/setter rather trying to access the fields of UsageFlags directly.

Signed-off-by: Sam Davis <sam.davis@arm.com>
hug-dev added a commit that referenced this issue Jul 9, 2021
Made the fields of UsageFlags private, Fix #82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants