From 8526739066ccb00ccd24b74650a7d7b284442985 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Thu, 21 Jun 2018 13:10:40 -0700 Subject: MM-10934 Update server dependencies. (#8981) * Changing throttled import path. * Upgrading dependencies. --- vendor/github.com/miekg/dns/dnssec.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'vendor/github.com/miekg/dns/dnssec.go') 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) -- cgit v1.2.3-1-g7c22