crypto/tls: add support for AES_256_GCM_SHA384 cipher suites specified in RFC5289

Generalizes PRF calculation for TLS 1.2 to support arbitrary hashes (SHA-384 instead of SHA-256).
Testdata were all updated to correspond with the new cipher suites in the handshake.

Change-Id: I3d9fc48c19d1043899e38255a53c80dc952ee08f
Reviewed-on: https://go-review.googlesource.com/3265
Reviewed-by: Adam Langley <agl@golang.org>
This commit is contained in:
Jacob H. Haven 2015-02-03 16:15:18 -08:00 committed by Adam Langley
parent 531f0d0055
commit 01861d435c
31 changed files with 1185 additions and 968 deletions

View file

@ -1,18 +1,18 @@
>>> Flow 1 (client to server)
00000000 16 03 01 00 75 01 00 00 71 03 03 00 00 00 00 00 |....u...q.......|
00000000 16 03 01 00 79 01 00 00 75 03 03 00 00 00 00 00 |....y...u.......|
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 00 00 1a c0 2f |.............../|
00000030 c0 2b c0 11 c0 07 c0 13 c0 09 c0 14 c0 0a 00 05 |.+..............|
00000040 00 2f 00 35 c0 12 00 0a 01 00 00 2e 00 05 00 05 |./.5............|
00000050 01 00 00 00 00 00 0a 00 08 00 06 00 17 00 18 00 |................|
00000060 19 00 0b 00 02 01 00 00 0d 00 0a 00 08 04 01 04 |................|
00000070 03 02 01 02 03 ff 01 00 01 00 |..........|
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../|
00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........|
00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 2e |...../.5........|
00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................|
00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0a 00 |................|
00000070 08 04 01 04 03 02 01 02 03 ff 01 00 01 00 |..............|
>>> Flow 2 (server to client)
00000000 16 03 03 00 59 02 00 00 55 03 03 32 10 48 2c 35 |....Y...U..2.H,5|
00000010 88 8d 78 49 39 19 48 d7 5c 44 ac 54 22 9c e3 bd |..xI9.H.\D.T"...|
00000020 43 94 0b 79 76 e3 7e b8 05 8c 8f 20 c3 af 31 88 |C..yv.~.... ..1.|
00000030 eb f4 55 f3 c0 43 f3 75 e6 e6 db 44 ba 95 09 95 |..U..C.u...D....|
00000040 e7 ef b8 93 f2 79 a5 fe 37 4b 15 6e c0 09 00 00 |.....y..7K.n....|
00000000 16 03 03 00 59 02 00 00 55 03 03 e1 64 a4 cd 65 |....Y...U...d..e|
00000010 5a 19 5f 07 68 cb af f2 74 76 a2 99 18 e4 9e 00 |Z._.h...tv......|
00000020 6a 72 6b 84 dd 1c ec cd 64 45 34 20 96 c3 54 88 |jrk.....dE4 ..T.|
00000030 00 ec aa 32 95 2c ad 08 47 64 fd 2e d4 1f 8e 5e |...2.,..Gd.....^|
00000040 ec 39 aa ba 6a 3c 8c c7 a6 63 55 8e c0 09 00 00 |.9..j<...cU.....|
00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................|
00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..|
00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....|
@ -47,23 +47,24 @@
00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....|
00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.|
00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....|
00000270 2a 16 03 03 00 d7 0c 00 00 d3 03 00 17 41 04 de |*............A..|
00000280 0f fa c5 80 41 6b 2f f6 c6 ef 28 17 fe 7e 06 e0 |....Ak/...(..~..|
00000290 e9 fe d4 c6 3e 29 6e 1a 83 b7 d1 f2 12 db 95 dd |....>)n.........|
000002a0 ff ee 83 71 af e4 3f b9 a6 6c 08 99 b0 46 24 e9 |...q..?..l...F$.|
000002b0 ef c6 61 29 c0 d0 96 25 20 92 6a ff 2e 15 28 04 |..a)...% .j...(.|
000002c0 03 00 8a 30 81 87 02 41 1c 44 92 98 91 1c 63 fe |...0...A.D....c.|
000002d0 6a 05 d4 ea 77 f3 e3 0a 35 25 25 80 63 9c 85 f6 |j...w...5%%.c...|
000002e0 0d 43 2b 1a 40 13 e7 57 0d b4 4d 65 46 6f fb f5 |.C+.@..W..MeFo..|
000002f0 23 57 cd 23 41 b5 c9 0a 2a 38 9a bc 54 70 a1 b8 |#W.#A...*8..Tp..|
00000300 8e 19 46 26 2a bb c0 1c d1 02 42 00 a4 01 e2 2e |..F&*.....B.....|
00000310 b1 0b 7e 9b 9b 94 3e 19 d2 44 ac bd 60 c2 75 55 |..~...>..D..`.uU|
00000320 b0 da dd a8 8f 6d 5b 83 91 61 b9 b3 68 32 b2 fe |.....m[..a..h2..|
00000330 56 81 49 ab e7 e8 a9 47 5c 75 7d c0 13 4a af 30 |V.I....G\u}..J.0|
00000340 7a 23 a7 37 f4 53 0a 07 ae aa 6e 01 a2 16 03 03 |z#.7.S....n.....|
00000350 00 2e 0d 00 00 26 03 01 02 40 00 1e 06 01 06 02 |.....&...@......|
00000360 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................|
00000370 03 02 03 03 02 01 02 02 02 03 00 00 0e 00 00 00 |................|
00000270 2a 16 03 03 00 d8 0c 00 00 d4 03 00 17 41 04 bb |*............A..|
00000280 6d 5c 62 98 a7 6c bd f1 9b 4b 09 16 31 59 6a 51 |m\b..l...K..1YjQ|
00000290 83 c8 9f 75 9c f8 09 b0 ee 39 01 e3 7a 25 9d 66 |...u.....9..z%.f|
000002a0 fe 14 14 15 45 1b 51 a4 47 fe 1e 58 01 28 96 13 |....E.Q.G..X.(..|
000002b0 2a 0e 0b 40 b2 22 db 2f e6 f4 88 0a 58 92 10 04 |*..@."./....X...|
000002c0 03 00 8b 30 81 88 02 42 01 13 f5 38 52 04 f7 3b |...0...B...8R..;|
000002d0 55 96 ef 39 77 be 4f 85 07 18 e9 47 49 b4 bb 57 |U..9w.O....GI..W|
000002e0 c9 c0 93 2e 9e b2 5e 3f 14 ce 43 f0 93 b5 a4 66 |......^?..C....f|
000002f0 8c fe 3a 06 fc a7 bb 9d 87 46 b8 20 1f 0a 31 c6 |..:......F. ..1.|
00000300 80 b0 2d fa e5 06 5f 78 b2 da 02 42 01 c0 bd 12 |..-..._x...B....|
00000310 5b ec 79 dd bf a4 54 f1 3b a8 b8 9a 50 ac a9 7c |[.y...T.;...P..||
00000320 d2 a6 b5 dd 84 ee dd eb 3e c7 52 1c 65 ac 1e 37 |........>.R.e..7|
00000330 4f a8 87 fa 05 8a a4 69 c9 59 53 65 ee 8e 4c 1b |O......i.YSe..L.|
00000340 6c d0 88 b8 65 de 85 f8 fe f9 27 96 b8 c0 16 03 |l...e.....'.....|
00000350 03 00 2e 0d 00 00 26 03 01 02 40 00 1e 06 01 06 |......&...@.....|
00000360 02 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 |................|
00000370 01 03 02 03 03 02 01 02 02 02 03 00 00 0e 00 00 |................|
00000380 00 |.|
>>> Flow 3 (client to server)
00000000 16 03 03 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0|
00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5|
@ -102,32 +103,32 @@
00000220 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 |Q.5uq..T[....g..|
00000230 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 |$ >.V...(^.+-O..|
00000240 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 |..lK[.V.2B.X..I.|
00000250 b5 68 1a 41 03 56 6b dc 5a 89 16 03 03 00 92 0f |.h.A.Vk.Z.......|
00000260 00 00 8e 04 03 00 8a 30 81 87 02 41 3d 25 31 d8 |.......0...A=%1.|
00000270 55 40 da 77 81 21 17 c1 7f d2 e2 b7 74 b9 da 34 |U@.w.!......t..4|
00000280 a9 f5 ce 50 4b 2e 80 30 47 b8 eb e2 be 9a e2 c0 |...PK..0G.......|
00000290 ea ec 8e 14 56 1a 0c ac 24 25 41 13 e3 53 7a ba |....V...$%A..Sz.|
000002a0 13 3a 20 15 f4 90 90 22 cf 0d 23 9b 3e 02 42 01 |.: ...."..#.>.B.|
000002b0 1c 00 db 16 3e 83 52 26 21 43 d2 08 62 7d ac 18 |....>.R&!C..b}..|
000002c0 71 f6 1a 49 c5 16 cf 83 b5 b6 40 b4 ad e7 1b 3f |q..I......@....?|
000002d0 b3 de 9c b2 0b 7e bf 07 f8 4a ea 54 e4 a2 6d 62 |.....~...J.T..mb|
000002e0 aa da b8 c5 60 46 c9 84 d9 b7 ab f3 82 4d 01 d8 |....`F.......M..|
000002f0 70 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 |p..........@....|
00000300 00 00 00 00 00 00 00 00 00 00 00 00 1a 4d 46 2c |.............MF,|
00000310 e9 de b4 b1 2c b4 7f fb b9 6a b8 4f 9d 68 92 bf |....,....j.O.h..|
00000320 87 05 b2 e3 fa 74 58 37 d5 63 fe 23 00 5f 37 26 |.....tX7.c.#._7&|
00000330 de 99 3a c3 af 58 ca 74 c6 53 09 5c |..:..X.t.S.\|
00000250 b5 68 1a 41 03 56 6b dc 5a 89 16 03 03 00 93 0f |.h.A.Vk.Z.......|
00000260 00 00 8f 04 03 00 8b 30 81 88 02 42 00 e9 db 80 |.......0...B....|
00000270 e2 67 5d 00 21 88 67 99 7f df de 90 77 86 1e b7 |.g].!.g.....w...|
00000280 28 b1 2d 08 8d 02 de 9a 29 2b ca b9 9c 48 ad bd |(.-.....)+...H..|
00000290 58 16 68 ad a3 0f 08 4c 01 52 e7 54 97 7c 06 0a |X.h....L.R.T.|..|
000002a0 9e c8 97 61 e6 a9 53 62 fb b1 e3 b1 d7 03 02 42 |...a..Sb.......B|
000002b0 01 f3 99 af dc e6 69 af 1d fb d5 d0 63 bd d1 17 |......i.....c...|
000002c0 d2 ca a5 10 97 1a 94 93 df c4 94 27 53 77 1a 9e |...........'Sw..|
000002d0 9b a5 e6 dd 0d cf 49 46 4c 5b 83 a4 52 f2 8b d6 |......IFL[..R...|
000002e0 b2 5f 40 e5 c3 d6 7f a2 2c 50 4d 4c 81 54 80 5b |._@.....,PML.T.[|
000002f0 72 c7 14 03 03 00 01 01 16 03 03 00 40 00 00 00 |r...........@...|
00000300 00 00 00 00 00 00 00 00 00 00 00 00 00 96 9f 5a |...............Z|
00000310 9c e3 d0 6c 5f 11 c4 cf e4 34 1a 54 7e dc ec 1d |...l_....4.T~...|
00000320 cd 08 eb 5c b4 32 1b d0 e5 12 1f 7a e7 86 16 56 |...\.2.....z...V|
00000330 a7 10 20 e1 59 31 65 63 12 7d 45 2d 2a |.. .Y1ec.}E-*|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 40 d7 8f 09 25 1e |..........@...%.|
00000010 05 12 68 52 87 c0 0a ae d7 f0 f6 0c 1e 79 0b be |..hR.........y..|
00000020 92 8f e1 06 08 b8 89 a1 5e 5e df f3 a1 01 56 d8 |........^^....V.|
00000030 03 f7 6f c1 5c e4 74 16 12 05 8a 7e b9 7c 50 48 |..o.\.t....~.|PH|
00000040 b8 6c 96 07 dd 32 b5 7a a4 c2 e0 |.l...2.z...|
00000000 14 03 03 00 01 01 16 03 03 00 40 54 bd b1 39 e6 |..........@T..9.|
00000010 a7 d0 76 5e 7e 91 0d 81 d1 c6 82 05 79 90 24 fc |..v^~.......y.$.|
00000020 26 b7 ec e6 b8 72 05 59 bd 00 99 f7 dd f4 44 1e |&....r.Y......D.|
00000030 79 4d 6d a1 22 4a e3 2c 41 05 ec 5a f7 32 17 ff |yMm."J.,A..Z.2..|
00000040 d3 1b ee 21 71 98 99 b7 85 34 b3 |...!q....4.|
>>> Flow 5 (client to server)
00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........|
00000010 00 00 00 00 00 cf 6e 12 61 5d 83 0e 90 c7 f0 55 |......n.a].....U|
00000020 02 42 49 69 c4 f1 dc 33 97 91 92 aa ec b7 42 09 |.BIi...3......B.|
00000030 fa 39 d5 b5 f2 15 03 03 00 30 00 00 00 00 00 00 |.9.......0......|
00000040 00 00 00 00 00 00 00 00 00 00 9c 2e ac 12 50 52 |..............PR|
00000050 6b 48 fc 42 f7 ef 8c d0 79 a2 11 c0 52 38 6e e5 |kH.B....y...R8n.|
00000060 79 eb 4b 62 2d f8 5b 09 15 07 |y.Kb-.[...|
00000010 00 00 00 00 00 b9 81 3f 48 14 95 9b 39 85 2a 9e |.......?H...9.*.|
00000020 44 ec bb cf c2 29 a9 44 f7 8a 6b 3f 92 13 dd 0e |D....).D..k?....|
00000030 c6 6b a1 51 79 15 03 03 00 30 00 00 00 00 00 00 |.k.Qy....0......|
00000040 00 00 00 00 00 00 00 00 00 00 1c 93 91 23 12 11 |.............#..|
00000050 cc 30 fb 22 9e 23 b7 60 8a 3d 4c e6 52 2b 3e 6b |.0.".#.`.=L.R+>k|
00000060 8e 47 91 b1 68 50 07 8a d1 6f |.G..hP...o|