"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/crypto/tls/handshake_server_test.go" between
go1.19.src.tar.gz and go1.19.1.src.tar.gz

About: Google’s Go is a compiled, garbage-collected, concurrent programming language.
Latest stable release (1.19).

handshake_server_test.go  (go1.19.src):handshake_server_test.go  (go1.19.1.src)
skipping to change at line 284 skipping to change at line 284
if !ok { if !ok {
t.Fatalf("didn't get ServerHello message in reply. Got %v\n", rep ly) t.Fatalf("didn't get ServerHello message in reply. Got %v\n", rep ly)
} }
if s := serverHello.cipherSuite; s != TLS_RSA_WITH_RC4_128_SHA { if s := serverHello.cipherSuite; s != TLS_RSA_WITH_RC4_128_SHA {
t.Fatalf("bad cipher suite from server: %x", s) t.Fatalf("bad cipher suite from server: %x", s)
} }
} }
func TestTLSPointFormats(t *testing.T) { func TestTLSPointFormats(t *testing.T) {
// Test that a Server returns the ec_point_format extension when ECC is // Test that a Server returns the ec_point_format extension when ECC is
// negotiated, and not returned on RSA handshake. // negotiated, and not on a RSA handshake or if ec_point_format is missin g.
tests := []struct { tests := []struct {
name string name string
cipherSuites []uint16 cipherSuites []uint16
supportedCurves []CurveID supportedCurves []CurveID
supportedPoints []uint8 supportedPoints []uint8
wantSupportedPoints bool wantSupportedPoints bool
}{ }{
{"ECC", []uint16{TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA}, []CurveID{C {"ECC", []uint16{TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA}, []CurveID{C
urveP256}, []uint8{compressionNone}, true}, urveP256}, []uint8{pointFormatUncompressed}, true},
{"ECC without ec_point_format", []uint16{TLS_ECDHE_RSA_WITH_AES_2
56_CBC_SHA}, []CurveID{CurveP256}, nil, false},
{"ECC with extra values", []uint16{TLS_ECDHE_RSA_WITH_AES_256_CBC
_SHA}, []CurveID{CurveP256}, []uint8{13, 37, pointFormatUncompressed, 42}, true}
,
{"RSA", []uint16{TLS_RSA_WITH_AES_256_GCM_SHA384}, nil, nil, fals e}, {"RSA", []uint16{TLS_RSA_WITH_AES_256_GCM_SHA384}, nil, nil, fals e},
{"RSA with ec_point_format", []uint16{TLS_RSA_WITH_AES_256_GCM_SH A384}, nil, []uint8{pointFormatUncompressed}, false},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
clientHello := &clientHelloMsg{ clientHello := &clientHelloMsg{
vers: VersionTLS12, vers: VersionTLS12,
random: make([]byte, 32), random: make([]byte, 32),
cipherSuites: tt.cipherSuites, cipherSuites: tt.cipherSuites,
compressionMethods: []uint8{compressionNone}, compressionMethods: []uint8{compressionNone},
supportedCurves: tt.supportedCurves, supportedCurves: tt.supportedCurves,
supportedPoints: tt.supportedPoints, supportedPoints: tt.supportedPoints,
skipping to change at line 333 skipping to change at line 336
s.Close() s.Close()
reply := <-replyChan reply := <-replyChan
if err, ok := reply.(error); ok { if err, ok := reply.(error); ok {
t.Fatal(err) t.Fatal(err)
} }
serverHello, ok := reply.(*serverHelloMsg) serverHello, ok := reply.(*serverHelloMsg)
if !ok { if !ok {
t.Fatalf("didn't get ServerHello message in reply . Got %v\n", reply) t.Fatalf("didn't get ServerHello message in reply . Got %v\n", reply)
} }
if tt.wantSupportedPoints { if tt.wantSupportedPoints {
if len(serverHello.supportedPoints) < 1 { if !bytes.Equal(serverHello.supportedPoints, []ui
t.Fatal("missing ec_point_format extensio nt8{pointFormatUncompressed}) {
n from server") t.Fatal("incorrect ec_point_format extens
} ion from server")
found := false
for _, p := range serverHello.supportedPoints {
if p == pointFormatUncompressed {
found = true
break
}
}
if !found {
t.Fatal("missing uncompressed format in e
c_point_format extension from server")
} }
} else { } else {
if len(serverHello.supportedPoints) != 0 { if len(serverHello.supportedPoints) != 0 {
t.Fatalf("unexpected ec_point_format exte nsion from server: %v", serverHello.supportedPoints) t.Fatalf("unexpected ec_point_format exte nsion from server: %v", serverHello.supportedPoints)
} }
} }
}) })
} }
} }
 End of changes. 4 change blocks. 
17 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)