Commit c0dae355 authored by Jonathan Rudenberg's avatar Jonathan Rudenberg

Implement XR pattern

parent 3512ab15
......@@ -98,6 +98,16 @@ var HandshakeXX = HandshakePattern{
},
}
var HandshakeXR = HandshakePattern{
Name: "XR",
Messages: [][]MessagePattern{
{MessagePatternE},
{MessagePatternE, MessagePatternDHEE},
{MessagePatternS, MessagePatternDHSE},
{MessagePatternS, MessagePatternDHSE},
},
}
var HandshakeIX = HandshakePattern{
Name: "IX",
Messages: [][]MessagePattern{
......
......@@ -44,7 +44,7 @@ type patternKeyInfo struct {
}
func init() {
for _, h := range []HandshakePattern{HandshakeNN, HandshakeKN, HandshakeNK, HandshakeKK, HandshakeNX, HandshakeKX, HandshakeXN, HandshakeIN, HandshakeXK, HandshakeIK, HandshakeXX, HandshakeIX, HandshakeN, HandshakeK, HandshakeX} {
for _, h := range []HandshakePattern{HandshakeNN, HandshakeKN, HandshakeNK, HandshakeKK, HandshakeNX, HandshakeKX, HandshakeXN, HandshakeIN, HandshakeXK, HandshakeIK, HandshakeXX, HandshakeXR, HandshakeIX, HandshakeN, HandshakeK, HandshakeX} {
patterns[h.Name] = h
var k patternKeyInfo
if len(h.Name) == 1 {
......@@ -74,7 +74,7 @@ func init() {
case 'K':
k.rs = true
k.rsi = true
case 'X':
case 'X', 'R':
k.rs = true
}
}
......
......@@ -13,7 +13,7 @@ import (
func main() {
for ci, cipher := range []CipherFunc{CipherAESGCM, CipherChaChaPoly} {
for _, hash := range []HashFunc{HashSHA256, HashSHA512, HashBLAKE2b, HashBLAKE2s} {
for hi, handshake := range []HandshakePattern{HandshakeNN, HandshakeKN, HandshakeNK, HandshakeKK, HandshakeNX, HandshakeKX, HandshakeXN, HandshakeIN, HandshakeXK, HandshakeIK, HandshakeXX, HandshakeIX, HandshakeN, HandshakeK, HandshakeX} {
for hi, handshake := range []HandshakePattern{HandshakeNN, HandshakeKN, HandshakeNK, HandshakeKK, HandshakeNX, HandshakeKX, HandshakeXN, HandshakeIN, HandshakeXK, HandshakeIK, HandshakeXX, HandshakeIX, HandshakeN, HandshakeK, HandshakeX, HandshakeXR} {
for _, psk := range []bool{false, true} {
payloads := (psk && hi%2 == 0) || (!psk && hi%2 != 0)
prologue := ci == 0
......@@ -103,7 +103,7 @@ func writeHandshake(out io.Writer, cs CipherSuite, h HandshakePattern, hasPSK, h
fmt.Fprintf(out, "init_static=%x\n", staticI.Private)
}
switch h.Name[1] {
case 'K', 'E', 'X':
case 'K', 'E', 'X', 'R':
configR.StaticKeypair = staticR
fmt.Fprintf(out, "resp_static=%x\n", staticR.Private)
switch h.Name[1] {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment