Debian Codegraph @

tls/tls_handshake_test.go

raw symbols SCIP
1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package tlsscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/
6
7 import (
8 "encoding/jsonscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/"
9 "reflectscip-go gomod github.com/golang/go/src go1.16 reflect/"
10 "testingscip-go gomod github.com/golang/go/src go1.16 testing/"
11 )
12
13 type ZTLSHandshakeSuitescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/ZTLSHandshakeSuite# struct{}
14
15 func marshalAndUnmarshalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/marshalAndUnmarshal().(original interface{}, target interface{}) error {
16 var b []byte
17 var err error
18 if b, err = jsonscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/Marshal().(original); err != nil {
19 return err
20 }
21 if err = jsonscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/Unmarshal().(b, target); err != nil {
22 return err
23 }
24 return nil
25 }
26
27 func marshalAndUnmarshalAndCheckEqualityscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/marshalAndUnmarshalAndCheckEquality().(original interface{}, target interface{}, t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
28 if err := marshalAndUnmarshalscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/marshalAndUnmarshal().(original, target); err != nil {
29 t.Fatalfscip-go gomod github.com/golang/go/src go1.16 testing/common#Fatalf().("unable to marshalAndUnmarshal: %s", err.Error())
30 }
31 if eq := reflectscip-go gomod github.com/golang/go/src go1.16 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.16 reflect/DeepEqual().(original, target); eq != true {
32 t.Errorfscip-go gomod github.com/golang/go/src go1.16 testing/common#Errorf().("expected %+v to equal %+v", original, target)
33 }
34 }
35
36 func TestTLSVersionEncodeDecodescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/TestTLSVersionEncodeDecode().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
37 v := TLSVersionscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/TLSVersion#(VersionTLS12scip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/VersionTLS12.)
38 var dec TLSVersionscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/TLSVersion#
39 marshalAndUnmarshalAndCheckEqualityscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/marshalAndUnmarshalAndCheckEquality().(&v, &dec, t)
40 }
41
42 func TestCipherSuiteEncodeDecodescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/TestCipherSuiteEncodeDecode().(t *testingscip-go gomod github.com/golang/go/src go1.16 testing/.Tscip-go gomod github.com/golang/go/src go1.16 testing/T#) {
43 v := CipherSuitescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/CipherSuite#(TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256scip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256.)
44 var dec CipherSuitescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/CipherSuite#
45 marshalAndUnmarshalAndCheckEqualityscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/marshalAndUnmarshalAndCheckEquality().(&v, &dec, t)
46 expectedName := nameForSuitescip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/nameForSuite().(TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256scip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256.)
47 if decodedName := dec.Stringscip-go gomod github.com/zmap/zcrypto . `github.com/zmap/zcrypto/tls`/CipherSuite#String().(); decodedName != expectedName {
48 t.Errorfscip-go gomod github.com/golang/go/src go1.16 testing/common#Errorf().("decoded wrong name, got %s, expected %s", decodedName, expectedName)
49 }
50 }