Parcourir la source

strings: delete Runes, Bytes

gofmt -w -r 'strings.Bytes(a) -> []byte(a)' src/cmd src/pkg test/bench
gofmt -w -r 'strings.Runes(a) -> []int(a)' src/cmd src/pkg test/bench
delete unused imports

R=r
CC=golang-dev
https://golang.org/cl/224062
v1.2.3
Russ Cox il y a 14 ans
Parent
révision
000416e795
2 fichiers modifiés avec 7 ajouts et 10 suppressions
  1. +3
    -5
      handshake_messages.go
  2. +4
    -5
      prf.go

+ 3
- 5
handshake_messages.go Voir le fichier

@@ -4,8 +4,6 @@

package tls

import "strings"

type clientHelloMsg struct {
raw []byte
major, minor uint8
@@ -100,7 +98,7 @@ func (m *clientHelloMsg) marshal() []byte {
z[1] = 1
z[3] = byte(len(m.serverName) >> 8)
z[4] = byte(len(m.serverName))
copy(z[5:], strings.Bytes(m.serverName))
copy(z[5:], []byte(m.serverName))
z = z[l:]
}

@@ -280,7 +278,7 @@ func (m *serverHelloMsg) marshal() []byte {
l = 255
}
z[0] = byte(l)
copy(z[1:], strings.Bytes(v[0:l]))
copy(z[1:], []byte(v[0:l]))
z = z[1+l:]
}
}
@@ -548,7 +546,7 @@ func (m *nextProtoMsg) marshal() []byte {

y := x[4:]
y[0] = byte(l)
copy(y[1:], strings.Bytes(m.proto[0:l]))
copy(y[1:], []byte(m.proto[0:l]))
y = y[1+l:]
y[0] = byte(padding)



+ 4
- 5
prf.go Voir le fichier

@@ -10,7 +10,6 @@ import (
"crypto/sha1"
"hash"
"os"
"strings"
)

// Split a premaster secret in two as specified in RFC 4346, section 5.
@@ -70,10 +69,10 @@ const (
finishedVerifyLength = 12 // Length of verify_data in a Finished message.
)

var masterSecretLabel = strings.Bytes("master secret")
var keyExpansionLabel = strings.Bytes("key expansion")
var clientFinishedLabel = strings.Bytes("client finished")
var serverFinishedLabel = strings.Bytes("server finished")
var masterSecretLabel = []byte("master secret")
var keyExpansionLabel = []byte("key expansion")
var clientFinishedLabel = []byte("client finished")
var serverFinishedLabel = []byte("server finished")

// keysFromPreMasterSecret generates the connection keys from the pre master
// secret, given the lengths of the MAC and cipher keys, as defined in RFC


Chargement…
Annuler
Enregistrer