Skip to content

Commit 70930d7

Browse files
authored
Merge pull request #280 from ProtonMail/fix/aead-max-chunk-size
Change the max AEAD chunk size to 4MiB from 64KiB
2 parents 61ae167 + 54e82fd commit 70930d7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

openpgp/packet/aead_config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (conf *AEADConfig) Mode() AEADMode {
3737

3838
// ChunkSizeByte returns the byte indicating the chunk size. The effective
3939
// chunk size is computed with the formula uint64(1) << (chunkSizeByte + 6)
40-
// limit to 16 = 4 MiB
40+
// limit chunkSizeByte to 16 which equals to 2^22 = 4 MiB
4141
// https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-07.html#section-5.13.2
4242
func (conf *AEADConfig) ChunkSizeByte() byte {
4343
if conf == nil || conf.ChunkSize == 0 {
@@ -49,8 +49,8 @@ func (conf *AEADConfig) ChunkSizeByte() byte {
4949
switch {
5050
case exponent < 6:
5151
exponent = 6
52-
case exponent > 16:
53-
exponent = 16
52+
case exponent > 22:
53+
exponent = 22
5454
}
5555

5656
return byte(exponent - 6)

0 commit comments

Comments
 (0)