From 8f269a6b16e03c80db1d823c86591177b533cc3a Mon Sep 17 00:00:00 2001 From: Tom Thorogood Date: Tue, 27 Nov 2018 21:36:27 +1030 Subject: [PATCH] Use strings.EqualFold rather than strings.ToLower (#828) strings.ToLower may allocate and will do more work than strings.EqualFold. --- dnssec.go | 2 +- sig0.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dnssec.go b/dnssec.go index 26b512e7..c3491a18 100644 --- a/dnssec.go +++ b/dnssec.go @@ -401,7 +401,7 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error { if rr.Algorithm != k.Algorithm { return ErrKey } - if strings.ToLower(rr.SignerName) != strings.ToLower(k.Hdr.Name) { + if !strings.EqualFold(rr.SignerName, k.Hdr.Name) { return ErrKey } if k.Protocol != 3 { diff --git a/sig0.go b/sig0.go index 07c2acb1..92b12b32 100644 --- a/sig0.go +++ b/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 // 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"} } sigend := offset