Use strings.EqualFold rather than strings.ToLower (#828)
strings.ToLower may allocate and will do more work than strings.EqualFold.
This commit is contained in:
parent
1c9c9bf4c9
commit
8f269a6b16
|
@ -401,7 +401,7 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error {
|
||||||
if rr.Algorithm != k.Algorithm {
|
if rr.Algorithm != k.Algorithm {
|
||||||
return ErrKey
|
return ErrKey
|
||||||
}
|
}
|
||||||
if strings.ToLower(rr.SignerName) != strings.ToLower(k.Hdr.Name) {
|
if !strings.EqualFold(rr.SignerName, k.Hdr.Name) {
|
||||||
return ErrKey
|
return ErrKey
|
||||||
}
|
}
|
||||||
if k.Protocol != 3 {
|
if k.Protocol != 3 {
|
||||||
|
|
2
sig0.go
2
sig0.go
|
@ -167,7 +167,7 @@ func (rr *SIG) Verify(k *KEY, buf []byte) error {
|
||||||
}
|
}
|
||||||
// If key has come from the DNS name compression might
|
// If key has come from the DNS name compression might
|
||||||
// have mangled the case of the name
|
// have mangled the case of the name
|
||||||
if strings.ToLower(signername) != strings.ToLower(k.Header().Name) {
|
if !strings.EqualFold(signername, k.Header().Name) {
|
||||||
return &Error{err: "signer name doesn't match key name"}
|
return &Error{err: "signer name doesn't match key name"}
|
||||||
}
|
}
|
||||||
sigend := offset
|
sigend := offset
|
||||||
|
|
Loading…
Reference in New Issue