// hashForServerKeyExchange hashes the given slices and returns their digest
// using the given hash function (for >= TLS 1.2) or using a default based on
// the sigType (for earlier TLS versions).
-func hashForServerKeyExchange(sigType uint8, hashFunc crypto.Hash, version uint16, slices ...[]byte) ([]byte, error) {
+func hashForServerKeyExchange(sigType uint8, hashFunc crypto.Hash, version uint16, slices ...[]byte) []byte {
if version >= VersionTLS12 {
h := hashFunc.New()
for _, slice := range slices {
h.Write(slice)
}
digest := h.Sum(nil)
- return digest, nil
+ return digest
}
if sigType == signatureECDSA {
- return sha1Hash(slices), nil
+ return sha1Hash(slices)
}
- return md5SHA1Hash(slices), nil
+ return md5SHA1Hash(slices)
}
// ecdheKeyAgreement implements a TLS key agreement where the server
return nil, errors.New("tls: certificate cannot be used with the selected cipher suite")
}
- digest, err := hashForServerKeyExchange(sigType, hashFunc, ka.version, clientHello.random, hello.random, serverECDHParams)
- if err != nil {
- return nil, err
- }
+ digest := hashForServerKeyExchange(sigType, hashFunc, ka.version, clientHello.random, hello.random, serverECDHParams)
signOpts := crypto.SignerOpts(hashFunc)
if sigType == signatureRSAPSS {
}
sig = sig[2:]
- digest, err := hashForServerKeyExchange(sigType, hashFunc, ka.version, clientHello.random, serverHello.random, serverECDHParams)
- if err != nil {
- return err
- }
+ digest := hashForServerKeyExchange(sigType, hashFunc, ka.version, clientHello.random, serverHello.random, serverECDHParams)
return verifyHandshakeSignature(sigType, cert.PublicKey, hashFunc, digest, sig)
}
if i == n-1 && call.Ellipsis.IsValid() {
ellipsis = call.Ellipsis
}
- check.argument(call.Fun, sig, i, x, ellipsis, context)
+ check.argument(sig, i, x, ellipsis, context)
}
}
// argument checks passing of argument x to the i'th parameter of the given signature.
// If ellipsis is valid, the argument is followed by ... at that position in the call.
-func (check *Checker) argument(fun ast.Expr, sig *Signature, i int, x *operand, ellipsis token.Pos, context string) {
+func (check *Checker) argument(sig *Signature, i int, x *operand, ellipsis token.Pos, context string) {
check.singleValue(x)
if x.mode == invalid {
return
}
// checkHeader performs basic sanity checks on the header.
-func checkHeader(p *dnsmessage.Parser, h dnsmessage.Header, name, server string) error {
+func checkHeader(p *dnsmessage.Parser, h dnsmessage.Header) error {
if h.RCode == dnsmessage.RCodeNameError {
return errNoSuchHost
}
return nil
}
-func skipToAnswer(p *dnsmessage.Parser, qtype dnsmessage.Type, name, server string) error {
+func skipToAnswer(p *dnsmessage.Parser, qtype dnsmessage.Type) error {
for {
h, err := p.AnswerHeader()
if err == dnsmessage.ErrSectionDone {
continue
}
- if err := checkHeader(&p, h, name, server); err != nil {
+ if err := checkHeader(&p, h); err != nil {
dnsErr := &DNSError{
Err: err.Error(),
Name: name,
continue
}
- err = skipToAnswer(&p, qtype, name, server)
+ err = skipToAnswer(&p, qtype)
if err == nil {
return p, server, nil
}
// don't want to expose.
func (b *Writer) flush() (err error) {
defer b.handlePanic(&err, "Flush")
- return b.flushNoDefers()
+ b.flushNoDefers()
+ return nil
}
// flushNoDefers is like flush, but without a deferred handlePanic call. This
// can be called from other methods which already have their own deferred
// handlePanic calls, such as Write, and avoid the extra defer work.
-func (b *Writer) flushNoDefers() (err error) {
+func (b *Writer) flushNoDefers() {
// add current cell if not empty
if b.cell.size > 0 {
if b.endChar != 0 {
// format contents of buffer
b.format(0, 0, len(b.lines))
b.reset()
- return nil
}
var hbar = []byte("---\n")
// the formatting of the following lines (the last cell per
// line is ignored by format()), thus we can flush the
// Writer contents.
- if err = b.flushNoDefers(); err != nil {
- return
- }
+ b.flushNoDefers()
if ch == '\f' && b.flags&Debug != 0 {
// indicate section break
b.write0(hbar)