Skip to content

Commit

Permalink
ckem: pass xof to elliptic.GenerateKey directly
Browse files Browse the repository at this point in the history
  • Loading branch information
bwesterb committed Feb 16, 2023
1 parent 90f2a3e commit d5f5e29
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions kem/hybrid/ckem.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package hybrid
// TODO move over to crypto/ecdh once we can assume Go 1.20.

import (
"bytes"
"crypto/elliptic"
cryptoRand "crypto/rand"
"crypto/subtle"
Expand Down Expand Up @@ -123,10 +122,7 @@ func (sch *cScheme) DeriveKeyPair(seed []byte) (kem.PublicKey, kem.PrivateKey) {
}
h := xof.SHAKE256.New()
_, _ = h.Write(seed)
buf := make([]byte, sch.PrivateKeySize())
_, _ = h.Read(buf)
rnd := bytes.NewReader(buf)
key, x, y, err := elliptic.GenerateKey(sch.curve, rnd)
key, x, y, err := elliptic.GenerateKey(sch.curve, h)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit d5f5e29

Please sign in to comment.