summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/miekg/dns/dnssec.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-06-21 13:10:40 -0700
committerHarrison Healey <harrisonmhealey@gmail.com>2018-06-21 16:10:40 -0400
commit8526739066ccb00ccd24b74650a7d7b284442985 (patch)
tree282512ae2ad95c98a9ca82de304a410b6b56685c /vendor/github.com/miekg/dns/dnssec.go
parenta59ccaa8b3844895dde3980e6224fef46ff4a1c8 (diff)
downloadchat-8526739066ccb00ccd24b74650a7d7b284442985.tar.gz
chat-8526739066ccb00ccd24b74650a7d7b284442985.tar.bz2
chat-8526739066ccb00ccd24b74650a7d7b284442985.zip
MM-10934 Update server dependencies. (#8981)
* Changing throttled import path. * Upgrading dependencies.
Diffstat (limited to 'vendor/github.com/miekg/dns/dnssec.go')
-rw-r--r--vendor/github.com/miekg/dns/dnssec.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/vendor/github.com/miekg/dns/dnssec.go b/vendor/github.com/miekg/dns/dnssec.go
index 478cb1e90..7e6bac428 100644
--- a/vendor/github.com/miekg/dns/dnssec.go
+++ b/vendor/github.com/miekg/dns/dnssec.go
@@ -542,20 +542,20 @@ func (k *DNSKEY) publicKeyRSA() *rsa.PublicKey {
explen = uint16(keybuf[1])<<8 | uint16(keybuf[2])
keyoff = 3
}
+ if explen > 4 {
+ // Larger exponent than supported by the crypto package.
+ return nil
+ }
pubkey := new(rsa.PublicKey)
pubkey.N = big.NewInt(0)
- shift := uint64((explen - 1) * 8)
expo := uint64(0)
- for i := int(explen - 1); i > 0; i-- {
- expo += uint64(keybuf[keyoff+i]) << shift
- shift -= 8
- }
- // Remainder
- expo += uint64(keybuf[keyoff])
- if expo > (2<<31)+1 {
- // Larger expo than supported.
- // println("dns: F5 primes (or larger) are not supported")
+ for i := 0; i < int(explen); i++ {
+ expo <<= 8
+ expo |= uint64(keybuf[keyoff+i])
+ }
+ if expo > 1<<31-1 {
+ // Larger exponent than supported by the crypto package.
return nil
}
pubkey.E = int(expo)