subtle.ConstantTimeCompare now tests the length of the inputs (although
it didn't when this code was written) so this test in crypto/hmac is now
superfluous.
Fixes #16336.
Change-Id: Ic02d8537e776fa1dd5694d3af07a28c4d840d14b
Reviewed-on: https://go-review.googlesource.com/27239
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
// We don't have to be constant time if the lengths of the MACs are
// different as that suggests that a completely different hash function
// was used.
- return len(mac1) == len(mac2) && subtle.ConstantTimeCompare(mac1, mac2) == 1
+ return subtle.ConstantTimeCompare(mac1, mac2) == 1
}