Skip to content

Commit d5f5e29

Browse files
committed
ckem: pass xof to elliptic.GenerateKey directly
1 parent 90f2a3e commit d5f5e29

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

kem/hybrid/ckem.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package hybrid
33
// TODO move over to crypto/ecdh once we can assume Go 1.20.
44

55
import (
6-
"bytes"
76
"crypto/elliptic"
87
cryptoRand "crypto/rand"
98
"crypto/subtle"
@@ -123,10 +122,7 @@ func (sch *cScheme) DeriveKeyPair(seed []byte) (kem.PublicKey, kem.PrivateKey) {
123122
}
124123
h := xof.SHAKE256.New()
125124
_, _ = h.Write(seed)
126-
buf := make([]byte, sch.PrivateKeySize())
127-
_, _ = h.Read(buf)
128-
rnd := bytes.NewReader(buf)
129-
key, x, y, err := elliptic.GenerateKey(sch.curve, rnd)
125+
key, x, y, err := elliptic.GenerateKey(sch.curve, h)
130126
if err != nil {
131127
panic(err)
132128
}

0 commit comments

Comments
 (0)