added XXfallback handshake, getters for local and peer ephemeral (#28)

This commit is contained in:
Gerardo Di Giacomo 2018-03-26 14:13:16 -07:00 committed by Jonathan Rudenberg
parent 953535c65f
commit d1c47b3565
2 changed files with 22 additions and 0 deletions

View File

@ -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{

View File

@ -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
}