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>
92 lines
6.9 KiB
Text
92 lines
6.9 KiB
Text
>>> Flow 1 (client to server)
|
|
00000000 16 03 01 00 dc 01 00 00 d8 03 03 35 42 f3 56 6d |...........5B.Vm|
|
|
00000010 cd 58 c6 08 54 f1 6c 64 c5 16 eb 39 b0 d9 1b 22 |.X..T.ld...9..."|
|
|
00000020 88 d6 36 a7 70 a8 27 c8 e8 1a 20 20 cc c6 13 bc |..6.p.'... ....|
|
|
00000030 f4 3a ed 6a d2 59 ac 02 18 68 e9 80 50 4a a3 df |.:.j.Y...h..PJ..|
|
|
00000040 1e 6b 54 0c 85 3a 17 5c 23 7f e0 fc 00 04 13 02 |.kT..:.\#.......|
|
|
00000050 00 ff 01 00 00 8b 00 00 00 0e 00 0c 00 00 09 31 |...............1|
|
|
00000060 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........|
|
|
00000070 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................|
|
|
00000080 00 16 00 00 00 17 00 00 00 0d 00 1e 00 1c 04 03 |................|
|
|
00000090 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................|
|
|
000000a0 08 05 08 06 04 01 05 01 06 01 00 2b 00 03 02 03 |...........+....|
|
|
000000b0 04 00 2d 00 02 01 01 00 33 00 26 00 24 00 1d 00 |..-.....3.&.$...|
|
|
000000c0 20 de c8 19 7a 66 cb db c3 04 b9 96 f4 5c 2e 52 | ...zf.......\.R|
|
|
000000d0 1b 63 0b 11 87 a2 a9 14 f8 54 10 a4 de 5f 9f 13 |.c.......T..._..|
|
|
000000e0 09 |.|
|
|
>>> 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 cc c6 13 bc |........... ....|
|
|
00000030 f4 3a ed 6a d2 59 ac 02 18 68 e9 80 50 4a a3 df |.:.j.Y...h..PJ..|
|
|
00000040 1e 6b 54 0c 85 3a 17 5c 23 7f e0 fc 13 02 00 00 |.kT..:.\#.......|
|
|
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 de 82 46 36 68 05 6c 4d 4c 79 da 2a |......F6h.lMLy.*|
|
|
00000090 a2 de 70 e3 64 66 79 ba 1d 4f d3 17 03 03 02 6d |..p.dfy..O.....m|
|
|
000000a0 66 1a 81 1c 38 21 0d 17 ef 4c 0f ad 52 c1 f3 d5 |f...8!...L..R...|
|
|
000000b0 d6 3f ee 05 dd bb ec e3 cd 00 a3 e5 42 90 f6 b8 |.?..........B...|
|
|
000000c0 2f d3 95 b8 27 3d 70 63 55 ef 32 e8 55 1a 20 0e |/...'=pcU.2.U. .|
|
|
000000d0 c8 47 7b 0c 15 30 86 37 72 25 d7 3b 97 a3 d1 90 |.G{..0.7r%.;....|
|
|
000000e0 5c a4 07 e4 b8 3c 3b bc 74 ea 93 d5 a8 30 dc bc |\....<;.t....0..|
|
|
000000f0 f9 2b 62 4e 15 84 c6 1c 67 a3 85 e2 8e 71 1d 6a |.+bN....g....q.j|
|
|
00000100 8d 26 97 96 ba 08 9d 09 e5 21 fa 4c 72 d9 7a df |.&.......!.Lr.z.|
|
|
00000110 39 69 02 82 58 0c ba 79 2a c1 73 d7 97 44 62 56 |9i..X..y*.s..DbV|
|
|
00000120 b6 7f 08 91 a3 ed 95 18 84 99 31 f6 64 54 59 bc |..........1.dTY.|
|
|
00000130 e0 c6 a2 e1 5f 51 5d 03 fd 5b cf 8f 97 1b 41 4b |...._Q]..[....AK|
|
|
00000140 c6 fa 78 06 c4 4d 3c e0 ba d9 3c 5f 5f f8 72 79 |..x..M<...<__.ry|
|
|
00000150 53 a0 cc bc aa 92 be 78 15 08 35 36 1f 53 91 89 |S......x..56.S..|
|
|
00000160 ec 74 0b b4 9e 97 85 86 d0 15 ff b6 62 9c 89 07 |.t..........b...|
|
|
00000170 9f 5d e8 9f 9d 7e b9 17 0e 33 78 06 ea 84 db 9e |.]...~...3x.....|
|
|
00000180 90 37 8a db c1 66 e2 a1 72 40 91 c5 49 e6 04 d9 |.7...f..r@..I...|
|
|
00000190 35 7c 50 1b 2e d6 63 44 c8 44 f9 e3 72 9c 1c 29 |5|P...cD.D..r..)|
|
|
000001a0 63 0f 5e fd a8 ab 09 c8 b8 02 7b 6f 40 35 85 3e |c.^.......{o@5.>|
|
|
000001b0 bb ae c9 b2 06 6d 0d 70 7e 65 b9 30 20 8f 54 da |.....m.p~e.0 .T.|
|
|
000001c0 9d 55 6e 70 7a a3 b0 15 5a 29 72 51 61 84 57 5c |.Unpz...Z)rQa.W\|
|
|
000001d0 f0 65 0a 9b 6e fb a4 d9 22 70 45 de c1 a6 5f 95 |.e..n..."pE..._.|
|
|
000001e0 3e 95 c8 3f 6b fa 69 01 ab e8 e0 61 6d 76 7b 5b |>..?k.i....amv{[|
|
|
000001f0 b2 33 e9 c1 67 99 33 99 03 75 e3 2c 29 b8 0f 75 |.3..g.3..u.,)..u|
|
|
00000200 b8 00 c5 dd cf f3 2e 24 fc 55 cc d5 d4 2d cc f4 |.......$.U...-..|
|
|
00000210 f1 59 20 d5 7a c1 ef f5 3b 8b b0 2a 0d c0 2a ad |.Y .z...;..*..*.|
|
|
00000220 2c ce c6 91 4d 17 1e 5c e8 d1 98 1e 58 cc d9 42 |,...M..\....X..B|
|
|
00000230 42 e9 ff b8 f7 33 f0 af df 8f 1e 7f 52 79 7e 4f |B....3......Ry~O|
|
|
00000240 48 e1 21 10 8c aa 7c 84 5d 42 f0 01 73 ff bb e1 |H.!...|.]B..s...|
|
|
00000250 de cb 61 a9 d0 9a be 2a cd 18 60 91 0c 20 86 db |..a....*..`.. ..|
|
|
00000260 4a e7 08 eb ab af 1b 7a bb 04 f6 49 29 b9 20 65 |J......z...I). e|
|
|
00000270 da a6 09 f3 8e 57 b4 5f b0 53 07 86 06 cf 44 de |.....W._.S....D.|
|
|
00000280 ba bd 16 ca 88 df 65 50 1a 0d 4b 30 41 ee 04 6a |......eP..K0A..j|
|
|
00000290 90 71 27 1b 05 b2 5e 0b 9c 77 ec fb 8a 02 82 18 |.q'...^..w......|
|
|
000002a0 34 3e af ea 43 71 4b 9c 12 75 f2 59 32 04 76 87 |4>..CqK..u.Y2.v.|
|
|
000002b0 2a ea 31 f6 c8 29 30 41 3f cf 4e c5 2b 38 d0 15 |*.1..)0A?.N.+8..|
|
|
000002c0 e6 fa 8d de 2a ec 3e 49 b9 bb 2e 46 ef 8b 8f a4 |....*.>I...F....|
|
|
000002d0 e0 96 39 67 d6 2f 56 fb 8b 9c 7c 49 65 3d b3 8e |..9g./V...|Ie=..|
|
|
000002e0 1f 48 02 24 53 10 43 49 6d 31 fc d6 99 f6 50 73 |.H.$S.CIm1....Ps|
|
|
000002f0 b3 fd b7 57 72 c6 81 a2 df 16 13 0a da 67 8f 3c |...Wr........g.<|
|
|
00000300 ff 94 b7 8a 26 0c f2 fe c9 f6 67 a2 f2 17 03 03 |....&.....g.....|
|
|
00000310 00 99 1d 59 bb 70 37 f6 a7 72 d1 27 3b 5a d5 1d |...Y.p7..r.';Z..|
|
|
00000320 f6 e6 02 84 3c 8b 24 0e 78 ed 88 73 e8 e4 d2 8d |....<.$.x..s....|
|
|
00000330 97 c4 cc a3 22 b7 c1 ba 2d df ef d4 84 0d 78 ce |...."...-.....x.|
|
|
00000340 70 c9 4f 60 dc fb 13 50 2d d1 52 ba e9 d4 5a 5e |p.O`...P-.R...Z^|
|
|
00000350 ed eb 93 ae 99 b8 08 91 61 ee a5 9c 3e 63 07 ed |........a...>c..|
|
|
00000360 17 b1 29 5f 03 ae 5b 0d a7 0a 4a 3a f5 6b 9c 6f |..)_..[...J:.k.o|
|
|
00000370 28 ad 16 6d f5 31 17 87 f5 10 b5 53 13 c8 a2 a1 |(..m.1.....S....|
|
|
00000380 7a 9a 12 10 04 0b e7 b6 c7 3b 55 25 05 d3 0c 5e |z........;U%...^|
|
|
00000390 32 60 bf 43 e6 62 d0 cc cd a6 61 9b 19 dc 83 34 |2`.C.b....a....4|
|
|
000003a0 9f f2 2d 8f ca 9e 96 73 4d e9 52 17 03 03 00 45 |..-....sM.R....E|
|
|
000003b0 28 21 db ab 2f da c8 33 af a5 44 5b f4 2f 18 bd |(!../..3..D[./..|
|
|
000003c0 72 74 6d a7 c0 16 fb 13 de 8b d4 f8 03 8f ba 28 |rtm............(|
|
|
000003d0 06 89 08 0f 82 14 9b 6d 9b 61 7c 6c c3 de 76 2e |.......m.a|l..v.|
|
|
000003e0 f3 2b ff db 2d bc 6f 84 75 19 b3 df eb a1 a7 69 |.+..-.o.u......i|
|
|
000003f0 a7 a7 70 27 48 |..p'H|
|
|
>>> Flow 3 (client to server)
|
|
00000000 14 03 03 00 01 01 17 03 03 00 45 5b 1d b7 49 6d |..........E[..Im|
|
|
00000010 d0 f1 9a 16 cc e8 08 84 c0 80 23 1f 4f fc 15 b1 |..........#.O...|
|
|
00000020 20 28 d0 65 1b 58 8b 67 fa 30 c2 37 86 ac b2 47 | (.e.X.g.0.7...G|
|
|
00000030 d6 b8 ac 8a 69 bc a3 09 10 c8 47 15 54 b3 a4 79 |....i.....G.T..y|
|
|
00000040 1f 12 2d c1 ca e1 ce 54 c0 ce e5 fc 61 f2 7c 07 |..-....T....a.|.|
|
|
>>> Flow 4 (server to client)
|
|
00000000 17 03 03 00 1e ba d7 68 39 2c 76 30 fb 0e 36 47 |.......h9,v0..6G|
|
|
00000010 d9 b8 7c 2d e2 1c fd 13 86 9b 2c 07 ab 66 03 2d |..|-......,..f.-|
|
|
00000020 1e 7d 69 17 03 03 00 13 eb 7b d8 47 8a 5e 53 83 |.}i......{.G.^S.|
|
|
00000030 17 87 b3 aa c5 80 71 ba df 1b 60 |......q...`|
|