Skip to content

Commit cf490a0

Browse files
bwesterbLekensteyn
authored andcommitted
Add dummy key agreement with codepoint 0xfe33 (#162)
DummyKex is a key agreeement similar in size but purposefully incompatible with X25519. The goal is to have a key agreement that servers will not support, so we can test HelloRetryRquest.
1 parent c2a040c commit cf490a0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/crypto/tls/cfkem.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"io"
2424

25+
"github.com/cloudflare/circl/hpke"
2526
"github.com/cloudflare/circl/kem"
2627
"github.com/cloudflare/circl/kem/hybrid"
2728
)
@@ -42,6 +43,11 @@ var (
4243
X25519Kyber768Draft00Old = CurveID(0xfe31)
4344
P256Kyber768Draft00 = CurveID(0xfe32)
4445
invalidCurveID = CurveID(0)
46+
47+
// A key agreeement similar in size but purposefully incompatible with
48+
// X25519. The goal is to have a key agreement that servers will not
49+
// support, so we can test HelloRetryRquest.
50+
DummyKex = CurveID(0xfe33)
4551
)
4652

4753
func singleClientKeySharePrivateFor(ks clientKeySharePrivate, group CurveID) singleClientKeySharePrivate {
@@ -58,6 +64,8 @@ func curveIdToCirclScheme(id CurveID) kem.Scheme {
5864
return hybrid.Kyber768X25519()
5965
case P256Kyber768Draft00:
6066
return hybrid.P256Kyber768Draft00()
67+
case DummyKex:
68+
return hpke.KEM_X25519_HKDF_SHA256.Scheme()
6169
}
6270
return nil
6371
}

src/crypto/tls/cfkem_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ func TestHybridKEX(t *testing.T) {
9595
X25519Kyber768Draft00,
9696
X25519Kyber768Draft00Old,
9797
P256Kyber768Draft00,
98+
DummyKex,
9899
} {
99100
run(curveID, true, true, false, false)
100101
run(curveID, true, false, false, false)

0 commit comments

Comments
 (0)