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

Add CachingOHttpCryptoProvider to reduce overhead #46

Closed
wants to merge 2 commits into from

Conversation

normanmaurer
Copy link
Member

Motivation:

Creating HPKE*Context instances is expensive. If the same configuration is used we should be able to share the same instance

Modifications:

Add CachingOHttpCryptoProvider which caches and shares HPKE*Context instances when possible

Result:

Less overhead

Motivation:

Creating HPKE*Context instances is expensive. If the same configuration is used we should be able to share the same instance

Modifications:

Add CachingOHttpCryptoProvider which caches and shares HPKE*Context instances when possible

Result:

Less overhead
@normanmaurer
Copy link
Member Author

This needs tests

@normanmaurer normanmaurer requested a review from thomdev January 21, 2024 15:46
Copy link
Collaborator

@thomdev thomdev left a comment

Choose a reason for hiding this comment

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

Looks great! Nice trick with the back-and-forth conversions between closable and reference-counted objects. There are security implications with the caching of the sender context since it contains an ephemeral key. It could be worth mentioning in a comment.

@normanmaurer
Copy link
Member Author

@thomdev thanks for the comments... do you think it would be better to only cache the recipient ?

@thomdev
Copy link
Collaborator

thomdev commented Jan 21, 2024

Actually I don't think that caching will work since the enc parameter, which is produced by a randomized algorithm on the sender, will be different every time for the recipient.

@normanmaurer
Copy link
Member Author

@thomdev so if I understand correctly we can not cache anything, correct ?

@thomdev
Copy link
Collaborator

thomdev commented Jan 21, 2024

The server could cache the output of EVP_HPKE_KEY_new_and_init_or_throw.

@normanmaurer
Copy link
Member Author

@thomdev #23 ;) ... Let me close this one and rebase + merge #23

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.

2 participants