Remove redundant sorting and fix small error
This commit is contained in:
parent
ca33c9ad0e
commit
220ad18ded
6
dns.go
6
dns.go
|
@ -84,10 +84,6 @@ func NewRRset() RRset {
|
|||
return s
|
||||
}
|
||||
|
||||
func (s RRset) Len() int { return len(s) }
|
||||
func (s RRset) Less(i, j int) bool { return s[i].Header().Name < s[j].Header().Name }
|
||||
func (s RRset) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
|
||||
func (s RRset) String() string {
|
||||
str := ""
|
||||
for _, r := range s {
|
||||
|
@ -110,7 +106,7 @@ func (s *RRset) Pop() RR {
|
|||
|
||||
// Push pushes the RR r to the RRset.
|
||||
func (s *RRset) Push(r RR) bool {
|
||||
if s.Len() == 0 {
|
||||
if len(*s) == 0 {
|
||||
*s = append(*s, r)
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -192,8 +192,6 @@ func (s *RR_RRSIG) Sign(k PrivateKey, rrset RRset) bool {
|
|||
s.Labels-- // wildcards, remove from label count
|
||||
}
|
||||
|
||||
sort.Sort(rrset)
|
||||
|
||||
sigwire := new(rrsigWireFmt)
|
||||
sigwire.TypeCovered = s.TypeCovered
|
||||
sigwire.Algorithm = s.Algorithm
|
||||
|
@ -202,7 +200,7 @@ func (s *RR_RRSIG) Sign(k PrivateKey, rrset RRset) bool {
|
|||
sigwire.Expiration = s.Expiration
|
||||
sigwire.Inception = s.Inception
|
||||
sigwire.KeyTag = s.KeyTag
|
||||
sigwire.SignerName = s.SignerName
|
||||
sigwire.SignerName = strings.ToLower(s.SignerName)
|
||||
|
||||
// Create the desired binary blob
|
||||
signdata := make([]byte, DefaultMsgSize)
|
||||
|
@ -287,7 +285,6 @@ func (s *RR_RRSIG) Verify(k *RR_DNSKEY, rrset RRset) bool {
|
|||
return false
|
||||
}
|
||||
}
|
||||
sort.Sort(rrset)
|
||||
|
||||
// RFC 4035 5.3.2. Reconstructing the Signed Data
|
||||
// Copy the sig, except the rrsig data
|
||||
|
@ -299,7 +296,7 @@ func (s *RR_RRSIG) Verify(k *RR_DNSKEY, rrset RRset) bool {
|
|||
sigwire.Expiration = s.Expiration
|
||||
sigwire.Inception = s.Inception
|
||||
sigwire.KeyTag = s.KeyTag
|
||||
sigwire.SignerName = s.SignerName
|
||||
sigwire.SignerName = strings.ToLower(s.SignerName)
|
||||
// Create the desired binary blob
|
||||
signeddata := make([]byte, DefaultMsgSize)
|
||||
n, ok := packStruct(sigwire, signeddata, 0)
|
||||
|
|
Loading…
Reference in New Issue