diff options
author | Ian Lance Taylor <iant@golang.org> | 2019-09-06 18:12:46 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-09-06 18:12:46 +0000 |
commit | aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13 (patch) | |
tree | 7e63b06d1eec92beec6997c9d3ab47a5d6a835be /libgo/go/crypto/tls/auth_test.go | |
parent | 920ea3b8ba3164b61ac9490dfdfceb6936eda6dd (diff) | |
download | gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.zip gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.tar.gz gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.tar.bz2 |
libgo: update to Go 1.13beta1 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/193497
From-SVN: r275473
Diffstat (limited to 'libgo/go/crypto/tls/auth_test.go')
-rw-r--r-- | libgo/go/crypto/tls/auth_test.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libgo/go/crypto/tls/auth_test.go b/libgo/go/crypto/tls/auth_test.go index 3f876b9..1d958cf 100644 --- a/libgo/go/crypto/tls/auth_test.go +++ b/libgo/go/crypto/tls/auth_test.go @@ -6,12 +6,14 @@ package tls import ( "crypto" + "crypto/ed25519" "testing" ) func TestSignatureSelection(t *testing.T) { rsaCert := &testRSAPrivateKey.PublicKey ecdsaCert := &testECDSAPrivateKey.PublicKey + ed25519Cert := testEd25519PrivateKey.Public().(ed25519.PublicKey) sigsPKCS1WithSHA := []SignatureScheme{PKCS1WithSHA256, PKCS1WithSHA1} sigsPSSWithSHA := []SignatureScheme{PSSWithSHA256, PSSWithSHA384} sigsECDSAWithSHA := []SignatureScheme{ECDSAWithP256AndSHA256, ECDSAWithSHA1} @@ -22,7 +24,7 @@ func TestSignatureSelection(t *testing.T) { ourSigAlgs []SignatureScheme tlsVersion uint16 - expectedSigAlg SignatureScheme // or 0 if ignored + expectedSigAlg SignatureScheme // if tlsVersion == VersionTLS12 expectedSigType uint8 expectedHash crypto.Hash }{ @@ -56,6 +58,10 @@ func TestSignatureSelection(t *testing.T) { // RSASSA-PSS is defined in TLS 1.3 for TLS 1.2 // https://tools.ietf.org/html/draft-ietf-tls-tls13-21#page-45 {rsaCert, []SignatureScheme{PSSWithSHA256}, sigsPSSWithSHA, VersionTLS12, PSSWithSHA256, signatureRSAPSS, crypto.SHA256}, + + // All results are fixed for Ed25519. RFC 8422, Section 5.10. + {ed25519Cert, []SignatureScheme{Ed25519}, []SignatureScheme{ECDSAWithSHA1, Ed25519}, VersionTLS12, Ed25519, signatureEd25519, directSigning}, + {ed25519Cert, nil, nil, VersionTLS12, Ed25519, signatureEd25519, directSigning}, } for testNo, test := range tests { @@ -63,7 +69,7 @@ func TestSignatureSelection(t *testing.T) { if err != nil { t.Errorf("test[%d]: unexpected error: %v", testNo, err) } - if test.expectedSigAlg != 0 && test.expectedSigAlg != sigAlg { + if test.tlsVersion == VersionTLS12 && test.expectedSigAlg != sigAlg { t.Errorf("test[%d]: expected signature scheme %#x, got %#x", testNo, test.expectedSigAlg, sigAlg) } if test.expectedSigType != sigType { @@ -84,6 +90,12 @@ func TestSignatureSelection(t *testing.T) { {ecdsaCert, sigsPKCS1WithSHA, sigsPKCS1WithSHA, VersionTLS12}, {ecdsaCert, sigsECDSAWithSHA, sigsPKCS1WithSHA, VersionTLS12}, {rsaCert, []SignatureScheme{0}, sigsPKCS1WithSHA, VersionTLS12}, + {ed25519Cert, sigsECDSAWithSHA, sigsECDSAWithSHA, VersionTLS12}, + {ed25519Cert, []SignatureScheme{Ed25519}, sigsECDSAWithSHA, VersionTLS12}, + {ecdsaCert, []SignatureScheme{Ed25519}, []SignatureScheme{Ed25519}, VersionTLS12}, + {ed25519Cert, nil, nil, VersionTLS11}, + {ed25519Cert, nil, nil, VersionTLS10}, + {ed25519Cert, nil, nil, VersionSSL30}, // ECDSA is unspecified for SSL 3.0 in RFC 4492. // TODO a SSL 3.0 client cannot advertise signature_algorithms, |