Commit Graph

14 Commits

Author SHA1 Message Date
Tom Thorogood b6ecf29d98 Improve performance by addressing some low hanging fruit. (#444)
* Remove unused bytes.Buffer from dns/idn.encode.

This buffer is truncated and written to but never read from. It
serves no purpose and all tests pass with it removed.

It appears to have been introduced when puncycode.go was first
added in miekg/dns@e3c2c07.

* Produce less pointless garbage.

This change:
- removes several needless []byte -> string conversions,
- removes two needless append calls in HashName, and
- writes the hash to the same nsec3 []byte in HashName rather
  than creating a new []byte on each of the k iterations.

These are all minor performance improvements that will likely
go entirely unnoticed. The changes will reduce the ammount of
garbage produced when calling CertificateToDANE, HashName,
(*SIG).Sign and TsigGenerate.
2017-02-02 07:33:49 +00:00
Michael Haro a465e84f54 Use encoding/binary's conversion functions when possible. (#364)
* Remove {un,}packUint{16,32}Msg functions.

unpackUint16Msg unpackUint32Msg packUint16Msg packUint32Msg implemented
functionality that is part of the encoding/binary package.

* Use encoding/binary's encoding in more places.
2016-06-08 16:38:42 +01:00
Miek Gieben 475ab80867 Remove (most) reflection
Remove the use of reflection when packing and unpacking, instead
generate all the pack and unpack functions using msg_generate.
This will generate zmsg.go which in turn calls the helper functions from
msg_helper.go.

This increases the speed by about ~30% while cutting back on memory
usage. Not all RRs are using it, but that will be rectified in upcoming
PR.

Most of the speed increase is in the header/question section parsing.
These functions *are* not generated, but straight forward enough. The
implementation can be found in msg.go.

The new code has been fuzzed by go-fuzz, which turned up some issues.

All files that started with 'z', and not autogenerated were renamed,
i.e. zscan.go is now scan.go.

Reflection is still used, in subsequent PRs it will be removed entirely.
2016-06-03 12:45:22 +01:00
Filippo Valsorda 034c247229 Refactor DNSSEC to use crypto.{PrivateKey,Signer}
This will allow RRSIG.Sign to use generic crypto.Signer implementations.

This is a interface breaking change, even if the required changes are most
likely just type asserions from crypto.PrivateKey to the underlying type or
crypto.Signer.
2015-08-19 17:51:02 +01:00
Miek Gieben 64fea017a2 Move all docs to docs.go
Another golint change.
2015-02-19 13:47:50 +00:00
Miek Gieben 67945c119e A bunch of golint fixes
The proposed vars names are a nono, because they break the API.
Things left: document each RR and zscan_rr.go has some funcky if-then-elses.
2015-02-19 09:58:33 +00:00
Filippo Valsorda e9faa971b3 Refactor the DNSSEC private key code
Now PrivateKey is an interface exposing Sign() and String(). Common
implementations are wrappers for {rsa|dsa|ecdsa}.PrivateKey but
this allows for custom signers, and abstracts away the private-ops
code to a single place.
2015-01-23 13:04:29 -08:00
Filippo Valsorda 0afbf1143c Extend the fixed-length int representation fixes to sig0.go 2014-12-06 10:27:27 +00:00
Filippo Valsorda 0f1b1184ae Rename and simplify packing helper functions 2014-12-05 19:27:44 +00:00
Miek Gieben 26e298191a Fix package header 2014-11-03 11:04:21 +00:00
Miek Gieben 241f9e6ce5 There is a copyright file now 2014-11-03 08:04:16 +00:00
Andrew Tunnell-Jones 9862d7044a SIG0 misc - doc, bounds checking, refactor tests
* expand documentation a little and tweak comments
* add bounds checking in Verify()
* refactor tests
2014-11-02 23:20:08 +00:00
Miek Gieben 53a0935749 Documentation cleanups 2014-11-02 11:39:12 +00:00
Andrew Tunnell-Jones 91b8c69a22 Implement SIG(0) signing and verification
This is based on @miekg's sig0 branch. That branch diverged from master
and I didn't want to wander off on a rebase.

As implemented there's no allowance for multi-envelope (TCP) support.

TODO:

* unpackUint32() could be moved out and used elsewhere
* tests
* multi-envelope support (if useful)
2014-11-01 11:32:46 +00:00