diff options
| author | Alberto Donizetti <alb.donizetti@gmail.com> | 2018-04-30 11:18:29 +0200 |
|---|---|---|
| committer | Han-Wen Nienhuys <hanwen@google.com> | 2018-04-30 11:26:54 +0000 |
| commit | db7d12313a59cd5b727192a287195e2cdfa40049 (patch) | |
| tree | d6b3ba425df3cdeeb352ffc956a47f7c39075052 | |
| parent | b49d69b5da943f7ef3c9cf91c8777c1f78a0cc3c (diff) | |
| download | go-x-crypto-db7d12313a59cd5b727192a287195e2cdfa40049.tar.xz | |
ssh/agent: remove len check in Unlock
Unlock compares the length of the passphrase with the given one before
calling subtle.ConstantTimeCompare. This is redundant, since
ConstantTimeCompare already perform a lengths check before doing
anything. Remove the check from Unlock.
Updates golang/go#25173
Change-Id: Ib5fec3a94392bddf2996f5c6bf5a414529e86f2f
Reviewed-on: https://go-review.googlesource.com/110068
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
| -rw-r--r-- | ssh/agent/keyring.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ssh/agent/keyring.go b/ssh/agent/keyring.go index a6ba06a..1a51632 100644 --- a/ssh/agent/keyring.go +++ b/ssh/agent/keyring.go @@ -102,7 +102,7 @@ func (r *keyring) Unlock(passphrase []byte) error { if !r.locked { return errors.New("agent: not locked") } - if len(passphrase) != len(r.passphrase) || 1 != subtle.ConstantTimeCompare(passphrase, r.passphrase) { + if 1 != subtle.ConstantTimeCompare(passphrase, r.passphrase) { return fmt.Errorf("agent: incorrect passphrase") } |
