mirror of
https://github.com/refraction-networking/utls.git
synced 2025-04-03 20:17:36 +03:00
crypto/tls: take key size into account in signature algorithm selection
Fixes #29793 Change-Id: I6e389d166c2d9a2ba8664a41f4b9569f2481b27f Reviewed-on: https://go-review.googlesource.com/c/go/+/205177 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
This commit is contained in:
parent
cb4dd9fcb4
commit
aff697f53d
6 changed files with 71 additions and 146 deletions
|
@ -1180,12 +1180,22 @@ func TestHandshakeServerRSAPKCS1v15(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestHandshakeServerRSAPSS(t *testing.T) {
|
||||
// We send rsa_pss_rsae_sha512 first, as the test key won't fit, and we
|
||||
// verify the server implementation will disregard the client preference in
|
||||
// that case. See Issue 29793.
|
||||
test := &serverTest{
|
||||
name: "RSA-RSAPSS",
|
||||
command: []string{"openssl", "s_client", "-no_ticket", "-sigalgs", "rsa_pss_rsae_sha256"},
|
||||
command: []string{"openssl", "s_client", "-no_ticket", "-sigalgs", "rsa_pss_rsae_sha512:rsa_pss_rsae_sha256"},
|
||||
}
|
||||
runServerTestTLS12(t, test)
|
||||
runServerTestTLS13(t, test)
|
||||
|
||||
test = &serverTest{
|
||||
name: "RSA-RSAPSS-TooSmall",
|
||||
command: []string{"openssl", "s_client", "-no_ticket", "-sigalgs", "rsa_pss_rsae_sha512"},
|
||||
expectHandshakeErrorIncluding: "peer doesn't support any of the certificate's signature algorithms",
|
||||
}
|
||||
runServerTestTLS13(t, test)
|
||||
}
|
||||
|
||||
func TestHandshakeServerEd25519(t *testing.T) {
|
||||
|
@ -1637,7 +1647,7 @@ T+E0J8wlH24pgwQHzy7Ko2qLwn1b5PW8ecrlvP1g
|
|||
config.MinVersion = VersionTLS13
|
||||
server := Server(serverConn, config)
|
||||
err := server.Handshake()
|
||||
expectError(t, err, "key size too small for PSS signature")
|
||||
expectError(t, err, "key size too small")
|
||||
close(done)
|
||||
}()
|
||||
err = client.Handshake()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue