Skip to content

Commit 1a2c24d

Browse files
committed
kem: add X25519MLKEM768 TLS hybrid KEM
1 parent c311e46 commit 1a2c24d

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

kem/hybrid/hybrid.go

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
// Package hybrid defines several hybrid classical/quantum KEMs.
1+
// Package hybrid defines several hybrid classical/quantum KEMs for use in TLS.
22
//
3-
// KEMs are combined by simple concatenation of shared secrets, cipher texts,
4-
// public keys, etc, see
3+
// Hybrid KEMs in TLS are created by simple concatenation
4+
// of shared secrets, cipher texts, public keys, etc.
5+
// This is safe for TLS, see eg.
56
//
67
// https://datatracker.ietf.org/doc/draft-ietf-tls-hybrid-design/
78
// https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Cr2.pdf
89
//
9-
// Note that this is only fine if the shared secret is used in its entirety
10-
// in a next step, such as being hashed or used as key.
10+
// Note that this approach is not proven secure in broader context.
1111
//
1212
// For deriving a KEM keypair deterministically and encapsulating
1313
// deterministically, we expand a single seed to both using SHAKE256,
@@ -38,6 +38,7 @@ import (
3838
"github.com/cloudflare/circl/kem/kyber/kyber1024"
3939
"github.com/cloudflare/circl/kem/kyber/kyber512"
4040
"github.com/cloudflare/circl/kem/kyber/kyber768"
41+
"github.com/cloudflare/circl/kem/mlkem/mlkem768"
4142
)
4243

4344
var ErrUninitialized = errors.New("public or private key not initialized")
@@ -57,6 +58,9 @@ func Kyber1024X448() kem.Scheme { return kyber1024X }
5758
// Returns the hybrid KEM of Kyber768Draft00 and P-256.
5859
func P256Kyber768Draft00() kem.Scheme { return p256Kyber768Draft00 }
5960

61+
// Returns the hybrid KEM of ML-KEM-768 and X25519.
62+
func X25519MLKEM768() kem.Scheme { return xmlkem768 }
63+
6064
var p256Kyber768Draft00 kem.Scheme = &scheme{
6165
"P256Kyber768Draft00",
6266
p256Kem,
@@ -87,6 +91,12 @@ var kyber1024X kem.Scheme = &scheme{
8791
kyber1024.Scheme(),
8892
}
8993

94+
var xmlkem768 kem.Scheme = &scheme{
95+
"X25519MLKEM768",
96+
mlkem768.Scheme(),
97+
x25519Kem,
98+
}
99+
90100
// Public key of a hybrid KEM.
91101
type publicKey struct {
92102
scheme *scheme

kem/schemes/schemes.go

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ var allSchemes = [...]kem.Scheme{
4949
hybrid.Kyber768X448(),
5050
hybrid.Kyber1024X448(),
5151
hybrid.P256Kyber768Draft00(),
52+
hybrid.X25519MLKEM768(),
5253
}
5354

5455
var allSchemeNames map[string]kem.Scheme

kem/schemes/schemes_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,5 @@ func Example_schemes() {
163163
// Kyber768-X448
164164
// Kyber1024-X448
165165
// P256Kyber768Draft00
166+
// X25519MLKEM768
166167
}

0 commit comments

Comments
 (0)