Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(115)

Delta Between Two Patch Sets: src/pkg/crypto/tls/handshake_client.go

Issue 157076: crypto/tls: add initial client implementation. (Closed)
Left Patch Set: Created 15 years, 4 months ago
Right Patch Set: code review 157076: crypto/tls: add initial client implementation. Created 15 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/crypto/tls/common.go ('k') | src/pkg/crypto/tls/handshake_messages.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package tls 5 package tls
6 6
7 import ( 7 import (
8 "crypto/hmac"; 8 "crypto/hmac";
9 "crypto/rc4"; 9 "crypto/rc4";
10 "crypto/rsa"; 10 "crypto/rsa";
(...skipping 15 matching lines...) Expand all
26 h.writeChan = writeChan; 26 h.writeChan = writeChan;
27 h.controlChan = controlChan; 27 h.controlChan = controlChan;
28 h.msgChan = msgChan; 28 h.msgChan = msgChan;
29 h.config = config; 29 h.config = config;
30 30
31 defer close(writeChan); 31 defer close(writeChan);
32 defer close(controlChan); 32 defer close(controlChan);
33 33
34 finishedHash := newFinishedHash(); 34 finishedHash := newFinishedHash();
35 35
36 » hello := new(clientHelloMsg); 36 » hello := &clientHelloMsg{
rsc 2009/11/19 06:23:12 write this as a composite literal for readability:
agl 2009/11/21 23:41:16 Done.
37 » hello.major = defaultMajor; 37 » » major: defaultMajor,
38 » hello.minor = defaultMinor; 38 » » minor: defaultMinor,
39 » hello.cipherSuites = []uint16{TLS_RSA_WITH_RC4_128_SHA}; 39 » » cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA},
40 » hello.compressionMethods = []uint8{compressionNone}; 40 » » compressionMethods: []uint8{compressionNone},
41 » » random: make([]byte, 32),
42 » };
43
41 currentTime := uint32(config.Time()); 44 currentTime := uint32(config.Time());
42 hello.random = make([]byte, 32);
43 hello.random[0] = byte(currentTime >> 24); 45 hello.random[0] = byte(currentTime >> 24);
44 hello.random[1] = byte(currentTime >> 16); 46 hello.random[1] = byte(currentTime >> 16);
45 hello.random[2] = byte(currentTime >> 8); 47 hello.random[2] = byte(currentTime >> 8);
46 hello.random[3] = byte(currentTime); 48 hello.random[3] = byte(currentTime);
47 _, err := io.ReadFull(config.Rand, hello.random[4:len(hello.random)]); 49 _, err := io.ReadFull(config.Rand, hello.random[4:len(hello.random)]);
48 if err != nil { 50 if err != nil {
49 h.error(alertInternalError); 51 h.error(alertInternalError);
50 return; 52 return;
51 } 53 }
52 54
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // to tell it about the error. 216 // to tell it about the error.
215 go func() { 217 go func() {
216 for _ = range h.msgChan { 218 for _ = range h.msgChan {
217 } 219 }
218 }(); 220 }();
219 h.controlChan <- ConnectionState{false, "", e}; 221 h.controlChan <- ConnectionState{false, "", e};
220 close(h.controlChan); 222 close(h.controlChan);
221 h.writeChan <- alert{alertLevelError, e}; 223 h.writeChan <- alert{alertLevelError, e};
222 } 224 }
223 } 225 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b