@@ -123,17 +123,17 @@ func (i *ClientInstance) Handshake(conn net.Conn) (net.Conn, error) {
123
123
}
124
124
125
125
if t != 1 {
126
- return nil , fmt .Errorf ("unexpected type %v, expect random hello" , t )
126
+ return nil , fmt .Errorf ("unexpected type %v, expect server hello" , t )
127
127
}
128
- peerRandomHello := make ([]byte , 1088 + 21 )
129
- if l != len (peerRandomHello ) {
130
- return nil , fmt .Errorf ("unexpected length %v for random hello" , l )
128
+ peerServerHello := make ([]byte , 1088 + 21 )
129
+ if l != len (peerServerHello ) {
130
+ return nil , fmt .Errorf ("unexpected length %v for server hello" , l )
131
131
}
132
- if _ , err := io .ReadFull (c .Conn , peerRandomHello ); err != nil {
132
+ if _ , err := io .ReadFull (c .Conn , peerServerHello ); err != nil {
133
133
return nil , err
134
134
}
135
- encapsulatedPfsKey := peerRandomHello [:1088 ]
136
- c .ticket = peerRandomHello [1088 :]
135
+ encapsulatedPfsKey := peerServerHello [:1088 ]
136
+ c .ticket = peerServerHello [1088 :]
137
137
138
138
pfsKey , err := pfsDKey .Decapsulate (encapsulatedPfsKey )
139
139
if err != nil {
@@ -216,17 +216,17 @@ func (c *ClientConn) Read(b []byte) (int, error) {
216
216
if t != 0 {
217
217
return 0 , fmt .Errorf ("unexpected type %v, expect server random" , t )
218
218
}
219
- peerRandom := make ([]byte , 32 )
220
- if l != len (peerRandom ) {
219
+ peerRandomHello := make ([]byte , 32 )
220
+ if l != len (peerRandomHello ) {
221
221
return 0 , fmt .Errorf ("unexpected length %v for server random" , l )
222
222
}
223
- if _ , err := io .ReadFull (c .Conn , peerRandom ); err != nil {
223
+ if _ , err := io .ReadFull (c .Conn , peerRandomHello ); err != nil {
224
224
return 0 , err
225
225
}
226
226
if c .random == nil {
227
227
return 0 , errors .New ("empty c.random" )
228
228
}
229
- c .peerAead = NewAead (ClientCipher , c .baseKey , peerRandom , c .random )
229
+ c .peerAead = NewAead (ClientCipher , c .baseKey , peerRandomHello , c .random )
230
230
c .peerNonce = make ([]byte , 12 )
231
231
}
232
232
if len (c .peerCache ) != 0 {
0 commit comments