add a unit test using the test vector from the draft

This commit is contained in:
Marten Seemann
2020-01-24 10:20:23 +07:00
parent 52f9811046
commit 3446946217
3 changed files with 40 additions and 33 deletions

View File

@@ -3,6 +3,8 @@ package handshake
import (
"crypto"
"crypto/cipher"
"encoding/hex"
"strings"
"github.com/alangpierce/go-forceexport"
"github.com/golang/mock/gomock"
@@ -52,6 +54,18 @@ var cipherSuites = []*qtls.CipherSuiteTLS13{
},
}
func splitHexString(s string) (slice []byte) {
for _, ss := range strings.Split(s, " ") {
if ss[0:2] == "0x" {
ss = ss[2:]
}
d, err := hex.DecodeString(ss)
Expect(err).ToNot(HaveOccurred())
slice = append(slice, d...)
}
return
}
func init() {
if err := forceexport.GetFunc(&aeadChaCha20Poly1305, "github.com/marten-seemann/qtls.aeadChaCha20Poly1305"); err != nil {
panic(err)