mirror of
https://github.com/refraction-networking/utls.git
synced 2025-04-03 20:17:36 +03:00
Implement a basic TLS 1.3 server handshake, only enabled if explicitly requested with MaxVersion. This CL intentionally leaves for future CLs: - PSK modes and resumption - client authentication - compatibility mode ChangeCipherSpecs - early data skipping - post-handshake messages - downgrade protection - KeyLogWriter support - TLS_FALLBACK_SCSV processing It also leaves a few areas up for a wider refactor (maybe in Go 1.13): - the certificate selection logic can be significantly improved, including supporting and surfacing signature_algorithms_cert, but this isn't new in TLS 1.3 (see comment in processClientHello) - handshake_server_tls13.go can be dried up and broken into more meaningful, smaller functions, but it felt premature to do before PSK and client auth support - the monstrous ClientHello equality check in doHelloRetryRequest can get both cleaner and more complete with collaboration from the parsing layer, which can come at the same time as extension duplicates detection Updates #9671 Change-Id: Id9db2b6ecc2eea21bf9b59b6d1d9c84a7435151c Reviewed-on: https://go-review.googlesource.com/c/147017 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Adam Langley <agl@golang.org>
90 lines
6.7 KiB
Text
90 lines
6.7 KiB
Text
>>> Flow 1 (client to server)
|
|
00000000 16 03 01 00 c6 01 00 00 c2 03 03 f0 a4 89 8f b9 |................|
|
|
00000010 fd ba d7 9f 2d ca bf f0 7a 6e 04 6a b4 54 9d f4 |....-...zn.j.T..|
|
|
00000020 dd b5 e5 c9 f7 4f e1 a4 0c a9 72 20 57 d4 f7 3a |.....O....r W..:|
|
|
00000030 88 0a d3 95 c7 3a 4c 7c e3 0c ac 99 bc 24 d7 ad |.....:L|.....$..|
|
|
00000040 3f 53 07 08 00 aa c3 e5 2c 2b d3 2f 00 08 13 02 |?S......,+./....|
|
|
00000050 13 03 13 01 00 ff 01 00 00 71 00 00 00 0e 00 0c |.........q......|
|
|
00000060 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....|
|
|
00000070 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................|
|
|
00000080 00 19 00 18 00 16 00 00 00 17 00 00 00 0d 00 04 |................|
|
|
00000090 00 02 08 04 00 2b 00 03 02 03 04 00 2d 00 02 01 |.....+......-...|
|
|
000000a0 01 00 33 00 26 00 24 00 1d 00 20 ef 5d 96 0f 42 |..3.&.$... .]..B|
|
|
000000b0 9a fe c1 40 ee 31 cd 34 6d 11 d2 ad e9 99 9b b6 |...@.1.4m.......|
|
|
000000c0 70 27 8f dc 81 c2 a6 ac 90 3f 4b |p'.......?K|
|
|
>>> Flow 2 (server to client)
|
|
00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......|
|
|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
|
|
00000020 00 00 00 00 00 00 00 00 00 00 00 20 57 d4 f7 3a |........... W..:|
|
|
00000030 88 0a d3 95 c7 3a 4c 7c e3 0c ac 99 bc 24 d7 ad |.....:L|.....$..|
|
|
00000040 3f 53 07 08 00 aa c3 e5 2c 2b d3 2f 13 02 00 00 |?S......,+./....|
|
|
00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /|
|
|
00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0|
|
|
00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 17 |.........._X.;t.|
|
|
00000080 03 03 00 17 e9 da 29 cf f2 21 32 b3 92 c0 18 5b |......)..!2....[|
|
|
00000090 26 f6 c8 ed eb 67 5c 9c df 5c f2 17 03 03 02 6d |&....g\..\.....m|
|
|
000000a0 c8 d6 15 36 38 ef 64 62 1b 49 c8 c9 bc ce f7 99 |...68.db.I......|
|
|
000000b0 da da 8e d0 2f 98 b1 cf 9a fa 53 cf 8a 20 11 6c |..../.....S.. .l|
|
|
000000c0 25 10 fc fd b2 f1 22 ea 42 64 21 b5 2f 94 9a 0a |%.....".Bd!./...|
|
|
000000d0 d3 3e 3b 14 4e b1 d1 3e fb 40 03 54 af d3 9e ea |.>;.N..>.@.T....|
|
|
000000e0 c8 fb b2 ed ff fa c1 1d 7e 72 fb bd dd 04 b2 0c |........~r......|
|
|
000000f0 ac 33 4c 1b e4 65 2f 91 c1 3e f1 1a 8f e0 92 23 |.3L..e/..>.....#|
|
|
00000100 3a 4d 04 f2 4f 14 d4 bb fe f7 fe 6a 69 8b aa 15 |:M..O......ji...|
|
|
00000110 c4 97 dd 06 3c 79 1c c9 aa 77 51 ac 95 8e 50 f8 |....<y...wQ...P.|
|
|
00000120 0c b4 d1 b7 1e 3d 68 8b 4e e7 28 c3 df 79 3f 66 |.....=h.N.(..y?f|
|
|
00000130 31 a5 06 28 8d 3f 49 d6 de fd 32 dd 10 79 5e d5 |1..(.?I...2..y^.|
|
|
00000140 77 4e 88 20 b5 e1 cc 96 b9 73 23 ca 09 25 30 3e |wN. .....s#..%0>|
|
|
00000150 2a be aa 06 e7 22 cd 8c f1 46 2a 54 6e 54 bf 90 |*...."...F*TnT..|
|
|
00000160 89 01 5e e4 e2 aa 7b d7 bc e9 37 d4 ee 75 18 57 |..^...{...7..u.W|
|
|
00000170 0c f7 8b fb 70 b2 cc 1c e2 ed 64 20 22 56 7a d3 |....p.....d "Vz.|
|
|
00000180 24 eb 25 0d 29 6f 8b be 5a 99 89 eb aa 04 18 8c |$.%.)o..Z.......|
|
|
00000190 bd c8 b3 95 57 5d 5b 00 55 d8 ef a0 22 f8 cb 26 |....W][.U..."..&|
|
|
000001a0 8d e0 9a 25 a7 77 6d 25 27 c3 aa 75 f7 51 15 c5 |...%.wm%'..u.Q..|
|
|
000001b0 30 72 57 ef d4 41 3e cf dd fc 77 d9 d8 08 41 87 |0rW..A>...w...A.|
|
|
000001c0 b6 9a 06 c6 f2 00 c5 a2 14 e9 f3 52 91 65 db 69 |...........R.e.i|
|
|
000001d0 a7 2e fb 32 5c 3f 13 c8 ea 65 3a 3a 4d 65 a9 69 |...2\?...e::Me.i|
|
|
000001e0 3f 7b f8 7c ee 1e a2 87 81 10 5c 7f 8d 37 1a 75 |?{.|......\..7.u|
|
|
000001f0 29 8a 78 58 8a d7 f7 af 75 ee 3d f2 58 c2 de a5 |).xX....u.=.X...|
|
|
00000200 60 e7 f9 a3 a1 66 cf df 76 2f 2a cf 5e 6e 80 a3 |`....f..v/*.^n..|
|
|
00000210 47 16 c9 c9 d1 b5 02 38 63 0a 86 fc f2 e8 0b 16 |G......8c.......|
|
|
00000220 d6 43 8e d1 68 b8 01 a0 63 69 01 c8 d3 1e eb 48 |.C..h...ci.....H|
|
|
00000230 28 5e 82 24 3a 19 62 f2 48 65 13 82 77 8c 9a ca |(^.$:.b.He..w...|
|
|
00000240 69 84 27 4d fd 88 81 79 74 8a a7 ef 2e be 6c c7 |i.'M...yt.....l.|
|
|
00000250 89 9d 19 ab 44 fa 35 99 cc 8e af c3 c0 98 85 85 |....D.5.........|
|
|
00000260 e7 92 45 84 39 c3 2d 27 a1 55 98 81 3a 09 1f f3 |..E.9.-'.U..:...|
|
|
00000270 9a 86 e5 53 f4 7d 35 8d 1f 2e 06 ef ed bf eb cb |...S.}5.........|
|
|
00000280 54 41 b7 9c d9 df 1b 75 00 f3 81 29 27 e4 ed 90 |TA.....u...)'...|
|
|
00000290 bd 16 39 96 15 22 c3 19 35 5c 88 db 00 05 38 77 |..9.."..5\....8w|
|
|
000002a0 8e ef 42 f5 b2 8c 0a 6c 7f 38 7a f7 c1 13 a6 3d |..B....l.8z....=|
|
|
000002b0 80 3c 62 aa 26 d0 80 08 31 b0 f4 84 36 c1 8d 51 |.<b.&...1...6..Q|
|
|
000002c0 6b 8c cd d7 e8 fa 95 8e 33 1d 33 16 a4 3f a9 85 |k.......3.3..?..|
|
|
000002d0 cc 37 5e b9 29 4d ba 06 55 31 c5 4f c3 bd 91 f2 |.7^.)M..U1.O....|
|
|
000002e0 8e c6 b7 a5 2d 58 09 fc 49 a5 74 1f 29 3d 4c 01 |....-X..I.t.)=L.|
|
|
000002f0 73 6f a8 ae 1e af d8 91 2a 5b a0 69 59 91 03 92 |so......*[.iY...|
|
|
00000300 bc d3 a0 f5 dd 1d 33 f2 a1 89 14 be 4a 17 03 03 |......3.....J...|
|
|
00000310 00 99 d1 cc 25 8c e1 97 49 3f bf 3a cc b7 f1 84 |....%...I?.:....|
|
|
00000320 16 7e 07 3c 18 f1 40 99 8f f4 ad 33 75 9d b5 c9 |.~.<..@....3u...|
|
|
00000330 5b fe 17 e6 b1 4c 34 2d 02 67 16 1d 54 7a 0b 2e |[....L4-.g..Tz..|
|
|
00000340 ae 28 fd a0 a6 15 a0 ed b1 12 19 6e 42 87 f9 96 |.(.........nB...|
|
|
00000350 0e 7d 5e 4e 03 5b a0 c8 36 8f ed 4a 9b 87 3f 09 |.}^N.[..6..J..?.|
|
|
00000360 c3 d0 4a e0 56 b7 fa fd 2b 3d 09 b9 d8 27 39 d9 |..J.V...+=...'9.|
|
|
00000370 ff ab 4a 37 e6 5a 0f 74 3b c7 b2 56 5b c3 b6 34 |..J7.Z.t;..V[..4|
|
|
00000380 0c 94 d2 0f 81 21 41 62 63 8c c4 19 38 3a 98 a6 |.....!Abc...8:..|
|
|
00000390 4f 60 7e 38 bb 05 f9 06 17 31 cb b7 a5 ed 96 7c |O`~8.....1.....||
|
|
000003a0 9f 8f 87 f2 6d 53 84 e1 9c bd 9c 17 03 03 00 45 |....mS.........E|
|
|
000003b0 8f 46 b9 62 e1 e3 a4 80 ac d7 63 17 6d 5c 9e 40 |.F.b......c.m\.@|
|
|
000003c0 ef 8d 18 98 39 6c 3f 75 5a dc e5 d5 c5 55 d3 b5 |....9l?uZ....U..|
|
|
000003d0 53 2d 4b 1e 04 50 30 a6 f2 a2 e4 db 15 40 25 fb |S-K..P0......@%.|
|
|
000003e0 b7 51 9c 24 cd 01 33 13 87 c4 35 04 db 28 67 a6 |.Q.$..3...5..(g.|
|
|
000003f0 0f 6f 62 13 1f |.ob..|
|
|
>>> Flow 3 (client to server)
|
|
00000000 14 03 03 00 01 01 17 03 03 00 45 93 78 a6 3d 50 |..........E.x.=P|
|
|
00000010 bd bf cb d5 f5 2d af d7 1a 04 5a 7c 18 57 5f ce |.....-....Z|.W_.|
|
|
00000020 bf aa f3 25 1d 19 29 3a 90 06 9b 9a ad bb 03 92 |...%..):........|
|
|
00000030 58 62 1f db 30 3b db 83 bf 21 dc 32 50 7a cc c1 |Xb..0;...!.2Pz..|
|
|
00000040 51 2d 46 a4 41 eb 07 b3 91 54 55 23 bd 1b c9 82 |Q-F.A....TU#....|
|
|
>>> Flow 4 (server to client)
|
|
00000000 17 03 03 00 1e 94 17 fa b4 46 cf 05 18 36 1e 2c |.........F...6.,|
|
|
00000010 fa b8 76 fd 66 4f d0 6c df 7d 35 ea cc 5f 8c fb |..v.fO.l.}5.._..|
|
|
00000020 6f 31 cc 17 03 03 00 13 7e 91 d1 39 ce 2c 4d e4 |o1......~..9.,M.|
|
|
00000030 49 90 a1 a6 c1 12 bf 0b 12 80 40 |I.........@|
|