ssh/test: reset the random source before capturing a recording
If a recording file exists but is invalid for any reason, the random source may have already been used, resulting in a recording that cannot be replayed. Change-Id: Ib81aaf163f5783fede2c14a0ac10a8d2af6019c6 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/664917 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org> Auto-Submit: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
committed by
Gopher Robot
parent
88199028d7
commit
9c1aa6af88
@@ -21,7 +21,6 @@ import (
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/internal/testenv"
|
||||
"golang.org/x/crypto/sha3"
|
||||
"golang.org/x/crypto/ssh"
|
||||
"golang.org/x/crypto/ssh/testdata"
|
||||
)
|
||||
@@ -169,6 +168,8 @@ func (test *clientTest) run(t *testing.T, write bool) {
|
||||
var clientConn net.Conn
|
||||
var recordingConn *recordingConn
|
||||
|
||||
setDeterministicRandomSource(&test.config.Config)
|
||||
|
||||
if write {
|
||||
// We store the username used when we record the connection so we can
|
||||
// reuse the same username when running tests.
|
||||
@@ -238,7 +239,6 @@ func recordingsClientConfig() *ssh.ClientConfig {
|
||||
if config.KeyExchanges[0] == "mlkem768x25519-sha256" {
|
||||
config.KeyExchanges = config.KeyExchanges[1:]
|
||||
}
|
||||
config.Rand = sha3.NewShake128()
|
||||
config.Auth = []ssh.AuthMethod{
|
||||
ssh.PublicKeys(testSigners["rsa"]),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user