Skip to content

Commit

Permalink
Fix session key length generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Aron Wussler committed Feb 29, 2024
1 parent 9d2beb2 commit 31b9581
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion openpgp/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,13 @@ func encrypt(keyWriter io.Writer, dataWriter io.Writer, to []*Entity, signed *En
}
}

symKey := make([]byte, cipher.KeySize())
var symKey []byte
if aeadSupported {
symKey = make([]byte, aeadCipherSuite.Cipher.KeySize())
} else {
symKey = make([]byte, cipher.KeySize())
}

if _, err := io.ReadFull(config.Random(), symKey); err != nil {
return nil, err
}
Expand Down

0 comments on commit 31b9581

Please sign in to comment.