From 88f404c19eed5720c621c12b6229455a109e5484 Mon Sep 17 00:00:00 2001 From: Lucas Clemente Date: Sat, 16 Apr 2016 00:27:30 +0200 Subject: [PATCH] initial server hello implementation --- handshake/crypto_setup.go | 9 +++++++-- handshake/tags.go | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/handshake/crypto_setup.go b/handshake/crypto_setup.go index c42ca077..f1c2f241 100644 --- a/handshake/crypto_setup.go +++ b/handshake/crypto_setup.go @@ -58,8 +58,13 @@ func (h *CryptoSetup) HandleCryptoMessage(data []byte) ([]byte, error) { if err != nil { return nil, err } - // TODO: Send SHLO - return nil, nil + + var reply bytes.Buffer + WriteHandshakeMessage(&reply, TagSHLO, map[Tag][]byte{ + TagPUBS: h.scfg.kex.PublicKey(), + TagVER: protocol.SupportedVersionsAsTags, + }) + return reply.Bytes(), nil } // We have an inacholate or non-matching CHLO, we now send a rejection diff --git a/handshake/tags.go b/handshake/tags.go index 38daebc3..3173c110 100644 --- a/handshake/tags.go +++ b/handshake/tags.go @@ -68,4 +68,7 @@ const ( TagEXPY Tag = 'E' + 'X'<<8 + 'P'<<16 + 'Y'<<24 // TagCERT is the CERT data TagCERT Tag = 0xff545243 + + // TagSHLO is the server hello + TagSHLO Tag = 'S' + 'H'<<8 + 'L'<<16 + 'O'<<24 )