Use newConstantTimeHash for MAC

This commit is contained in:
yuhan6665
2026-09-20 19:27:52 -04:00
parent 9124ee149d
commit f6eb30fc0e
+3 -5
View File
@@ -417,15 +417,13 @@ func cipherAES(key, iv []byte, isRead bool) any {
// macSHA1 returns a SHA-1 based constant time MAC.
func macSHA1(key []byte) hash.Hash {
//////////////////////////////////// [REALITY] SECTION: do not use newConstantTimeHash
//h := sha1.New
h := sha1.New
// The BoringCrypto SHA1 does not have a constant-time
// checksum function, so don't try to use it.
//if !boring.Enabled {
//h = newConstantTimeHash(h)
h = newConstantTimeHash(h)
//}
return hmac.New(sha1.New, key)
//////////////////////////////////// [REALITY] SECTION END
return hmac.New(h, key)
}
// macSHA256 returns a SHA-256 based MAC. This is only supported in TLS 1.2 and