diff --git a/handshake_client.go b/handshake_client.go index 8965ad6..1c14476 100644 --- a/handshake_client.go +++ b/handshake_client.go @@ -164,7 +164,7 @@ func (c *Conn) makeClientHello() (*clientHelloMsg, *keySharePrivateKeys, *echCon if _, err := io.ReadFull(config.rand(), seed); err != nil { return nil, nil, nil, err } - keyShareKeys.kyber, err = mlkem768.NewDecapsulationKey(seed) + keyShareKeys.kyber, err = mlkem768.NewDecapsulationKey768(seed) if err != nil { return nil, nil, nil, err } diff --git a/handshake_client_tls13.go b/handshake_client_tls13.go index cdef806..fbec743 100644 --- a/handshake_client_tls13.go +++ b/handshake_client_tls13.go @@ -481,7 +481,7 @@ func (hs *clientHandshakeStateTLS13) establishHandshakeKeys() error { ecdhePeerData := hs.serverHello.serverShare.data if hs.serverHello.serverShare.group == x25519Kyber768Draft00 { - if len(ecdhePeerData) != x25519PublicKeySize+mlkem768.CiphertextSize { + if len(ecdhePeerData) != x25519PublicKeySize+mlkem768.CiphertextSize768 { c.sendAlert(alertIllegalParameter) return errors.New("tls: invalid server key share") } diff --git a/handshake_server_tls13.go b/handshake_server_tls13.go index 29add50..3591aa1 100644 --- a/handshake_server_tls13.go +++ b/handshake_server_tls13.go @@ -223,7 +223,7 @@ func (hs *serverHandshakeStateTLS13) processClientHello() error { ecdhData := clientKeyShare.data if selectedGroup == x25519Kyber768Draft00 { ecdhGroup = X25519 - if len(ecdhData) != x25519PublicKeySize+mlkem768.EncapsulationKeySize { + if len(ecdhData) != x25519PublicKeySize+mlkem768.EncapsulationKeySize768 { c.sendAlert(alertIllegalParameter) return errors.New("tls: invalid Kyber client key share") } diff --git a/key_schedule.go b/key_schedule.go index 3bbfc1b..8377807 100644 --- a/key_schedule.go +++ b/key_schedule.go @@ -54,11 +54,11 @@ func (c *cipherSuiteTLS13) exportKeyingMaterial(s *tls13.MasterSecret, transcrip type keySharePrivateKeys struct { curveID CurveID ecdhe *ecdh.PrivateKey - kyber *mlkem768.DecapsulationKey + kyber *mlkem768.DecapsulationKey768 } // kyberDecapsulate implements decapsulation according to Kyber Round 3. -func kyberDecapsulate(dk *mlkem768.DecapsulationKey, c []byte) ([]byte, error) { +func kyberDecapsulate(dk *mlkem768.DecapsulationKey768, c []byte) ([]byte, error) { K, err := dk.Decapsulate(c) if err != nil { return nil, err @@ -68,7 +68,7 @@ func kyberDecapsulate(dk *mlkem768.DecapsulationKey, c []byte) ([]byte, error) { // kyberEncapsulate implements encapsulation according to Kyber Round 3. func kyberEncapsulate(ek []byte) (c, ss []byte, err error) { - k, err := mlkem768.NewEncapsulationKey(ek) + k, err := mlkem768.NewEncapsulationKey768(ek) if err != nil { return nil, nil, err } diff --git a/key_schedule_test.go b/key_schedule_test.go index 3253277..766370f 100644 --- a/key_schedule_test.go +++ b/key_schedule_test.go @@ -120,7 +120,7 @@ func TestTrafficKey(t *testing.T) { } func TestKyberEncapsulate(t *testing.T) { - dk, err := mlkem768.GenerateKey() + dk, err := mlkem768.GenerateKey768() if err != nil { t.Fatal(err) }