Skip to content

Commit

Permalink
Fix missing error check in X448 (#181)
Browse files Browse the repository at this point in the history
When encapsulating, we generate an ephemeral key. If the randomness provider returns an error, the key material should be discarded
  • Loading branch information
alrs authored Sep 23, 2023
1 parent 3c4c8a2 commit afb1ddc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion openpgp/internal/ecc/x448.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ func (c *x448) GenerateECDH(rand io.Reader) (point []byte, secret []byte, err er
func (c *x448) Encaps(rand io.Reader, point []byte) (ephemeral, sharedSecret []byte, err error) {
var pk, ss x448lib.Key
seed, e, err := c.generateKeyPairBytes(rand)

if err != nil {
return nil, nil, err
}
copy(pk[:], point)
x448lib.Shared(&ss, &seed, &pk)

Expand Down

0 comments on commit afb1ddc

Please sign in to comment.