diff --git a/patterns.go b/patterns.go index 5fc17a8..d1a5a59 100644 --- a/patterns.go +++ b/patterns.go @@ -98,6 +98,15 @@ var HandshakeXX = HandshakePattern{ }, } +var HandshakeXXfallback = HandshakePattern{ + Name: "XXfallback", + Messages: [][]MessagePattern{ + {MessagePatternE}, + {MessagePatternE, MessagePatternDHEE, MessagePatternS, MessagePatternDHSE}, + {MessagePatternS, MessagePatternDHES}, + }, +} + var HandshakeIX = HandshakePattern{ Name: "IX", Messages: [][]MessagePattern{ diff --git a/state.go b/state.go index 723b368..8ce7c56 100644 --- a/state.go +++ b/state.go @@ -495,3 +495,16 @@ func (s *HandshakeState) PeerStatic() []byte { func (s *HandshakeState) MessageIndex() int { return s.msgIdx } + +// PeerEphemeral returns the ephemeral key provided by the remote peer during +// a handshake. It is an error to call this method if a handshake message +// containing a static key has not been read. +func (s *HandshakeState) PeerEphemeral() []byte { + return s.re +} + +// LocalEphemeral returns the local ephemeral key pair generated during +// a handshake. +func (s *HandshakeState) LocalEphemeral() DHKey { + return s.e +}