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

WIP: supports mutable IV in GcmParams, close #225 #226

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zkonge
Copy link

@zkonge zkonge commented Sep 20, 2024

so that some PKCS11 implementation (like AWS CloudHSM) could write random IV into it.

Fixes #225

so that some PKCS11 implementation (like AWS CloudHSM) could write random IV into it

Signed-off-by: Konge <[email protected]>
Copy link
Collaborator

@wiktor-k wiktor-k left a comment

Choose a reason for hiding this comment

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

I'm not using this scheme personally but the underlying issue seems real and the trade-offs in this solution reasonable.

Wdyt @hug-dev @ionut-arm @keldonin et al?

@zkonge
Copy link
Author

zkonge commented Sep 23, 2024

Although the trait constraint for Mechanism is enough for the alias rule:

Mechanism: !Clone+!Send

I open another branch 43c8863 that make all operations use the owned Mechanism.

It's not necessary, but I think it can give us (and the compiler) more restrictions on when we can get things wrong.

Any ideas about that? And is there anyone prefer passing the mutable reference instead of owned data?

@wiktor-k
Copy link
Collaborator

Any ideas about that? And is there anyone prefer passing the mutable reference instead of owned data?

Wait, I thought mutable ref would allow the PKCS11 implementation to set these fields that are to be read by the caller, which would be impossible when using owned data? (unless the owned object is being returned from the function too).

Btw, I think we can resume work on this given recent changes in main.

Sorry for the delays @zkonge 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use GcmParams with AWS CloudHSM will cause undefined behavior
2 participants