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

Allow passing a message size hint #321

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

Allow passing a message size hint #321

wants to merge 1 commit into from

Conversation

twiss
Copy link
Member

@twiss twiss commented Dec 10, 2024

Also, set the AEAD chunk size to twice the message size hint (or the actual message size, when known), so that we don't generate an overly large chunk size when the message could fit in a smaller chunk size.

This is useful to reduce the memory usage when en/decrypting AEAD message once ProtonMail/go-crypto#259 is merged.

@twiss twiss requested a review from lubux December 10, 2024 17:39
@twiss twiss force-pushed the message-size-hint branch 2 times, most recently from 704c5e2 to d9f3052 Compare December 10, 2024 17:56
Also, set the AEAD chunk size to twice the message size hint (or the
actual message size, when known), so that we don't generate an overly
large chunk size when the message could fit in a smaller chunk size.
@twiss twiss force-pushed the message-size-hint branch from d9f3052 to 07a6094 Compare December 10, 2024 18:07
@@ -3,13 +3,18 @@ package crypto
import "github.com/ProtonMail/go-crypto/openpgp/packet"

type EncryptionProfile interface {
EncryptionConfig() *packet.Config
EncryptionConfig(messageSizeHint uint64) *packet.Config
Copy link
Member

Choose a reason for hiding this comment

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

We might need more options here in the future without breaking backward compatibility.
What about introducing a struct EncHandleSettings and passing &encHandleSettings instead with default nil?

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