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 01 00 59 02 00 00 55 03 01 8e e5 cd c8 24 |....Y...U......$|
00000010 aa 56 53 50 51 e2 d3 6f 6d 8a 03 11 e8 f1 ff f5 |.VSPQ..om.......|
00000020 7c f4 30 9c fb 39 cb c5 18 79 cf 20 04 38 5d d9 ||.0..9...y. .8].|
00000030 d4 68 64 85 e7 5a 6d bb 0c de 1e 42 e0 78 57 67 |.hd..Zm....B.xWg|
00000040 9c 75 3c 47 42 1f a7 06 24 8f 18 11 c0 09 00 00 |.u<GB...$.......|
00000000 16 03 01 00 59 02 00 00 55 03 01 43 60 d4 9a c4 |....Y...U..C`...|
00000010 28 6c b9 56 de 43 c6 e4 05 f5 ab 71 87 ef ae b8 |(l.V.C.....q....|
00000020 cf da 13 b5 98 b7 ab cc 35 44 48 20 2c 7f 10 60 |........5DH ,..`|
00000030 98 a8 13 4d a8 7c d6 45 48 aa c5 aa f2 f7 bb 98 |...M.|.EH.......|
00000040 53 6e 5d 3f 56 de 17 ba c9 a8 d1 81 c0 09 00 00 |Sn]?V...........|
00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................|
00000060 01 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,21 +47,21 @@
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 01 00 d6 0c 00 00 d2 03 00 17 41 04 9e |*............A..|
00000280 7c 82 c3 eb d9 2f 1a 2c 35 32 70 b3 64 7f dd 16 ||..../.,52p.d...|
00000290 0d 28 91 0b b0 b0 30 a8 c7 4c 4f 10 b3 42 84 a4 |.(....0..LO..B..|
000002a0 b7 a1 f6 38 e6 63 47 95 1a 0a 3e f0 96 4a 10 10 |...8.cG...>..J..|
000002b0 45 fd 66 27 e5 ef 0b 44 d8 da 20 61 47 e3 b8 00 |E.f'...D.. aG...|
000002c0 8b 30 81 88 02 42 01 b9 39 36 f9 73 6d 2c f1 1f |.0...B..96.sm,..|
000002d0 5f 8d 1d 49 d4 8c f9 19 7c 18 f8 ed 41 77 01 40 |_..I....|...Aw.@|
000002e0 30 27 a0 64 a8 c9 08 fb 09 69 eb 13 24 1f cf af |0'.d.....i..$...|
000002f0 d2 32 c6 ae 76 52 ac 96 31 4b 63 2c 56 55 af f8 |.2..vR..1Kc,VU..|
00000300 c6 cc 56 07 f5 8b fa 82 02 42 01 9e a8 fd 78 34 |..V......B....x4|
00000310 f3 d1 53 8c e2 19 37 df 05 8e b7 46 84 ee 66 cc |..S...7....F..f.|
00000320 48 d9 8e 22 c0 70 bf 98 3a 40 37 82 a2 bb df 75 |H..".p..:@7....u|
00000330 84 4b dc 31 e9 57 70 98 7f 50 81 9b 75 55 9c f6 |.K.1.Wp..P..uU..|
00000340 9f ad 69 e6 2b 05 6a 0d 48 7b 99 83 16 03 01 00 |..i.+.j.H{......|
00000350 0e 0d 00 00 06 03 01 02 40 00 00 0e 00 00 00 |........@......|
00000270 2a 16 03 01 00 d4 0c 00 00 d0 03 00 17 41 04 ef |*............A..|
00000280 89 a9 4f 05 2f ee ee c9 cb 73 d0 57 cc c9 45 ca |..O./....s.W..E.|
00000290 d8 61 4d 0d 5b cf 83 c1 19 bd 6d a7 49 de ba 6c |.aM.[.....m.I..l|
000002a0 63 b5 88 c9 4d a8 44 9f f2 ec 3c 88 d6 ec 20 f3 |c...M.D...<... .|
000002b0 6f 25 cd 99 0a 42 71 19 67 6d dd 65 6a 52 f8 00 |o%...Bq.gm.ejR..|
000002c0 89 30 81 86 02 41 42 4f 70 eb fa 2a bf 06 0f 16 |.0...ABOp..*....|
000002d0 62 d8 25 d5 d4 c4 bb 2e d1 f9 84 3b a0 57 78 7f |b.%........;.Wx.|
000002e0 fe 29 50 49 e1 f0 a1 c6 1f 87 98 7f d5 63 b9 72 |.)PI.........c.r|
000002f0 f5 2f 70 a8 bc 5f 45 22 57 07 99 e1 f8 51 30 b0 |./p.._E"W....Q0.|
00000300 2f 6e 6d 8c b5 4a 34 02 41 05 86 7d e4 16 b2 bf |/nm..J4.A..}....|
00000310 70 de 5a 69 43 6e e2 ec a2 4f 97 b0 ae 99 07 08 |p.ZiCn...O......|
00000320 32 d2 9d f4 56 80 71 d7 96 94 36 59 b5 95 7f 10 |2...V.q...6Y....|
00000330 8a aa a5 90 db cc a3 47 02 53 b1 9e 2d c7 db bc |.......G.S..-...|
00000340 58 1d b5 01 07 9c 9c 74 b5 a7 16 03 01 00 0e 0d |X......t........|
00000350 00 00 06 03 01 02 40 00 00 0e 00 00 00 |......@......|
>>> Flow 3 (client to server)
00000000 16 03 01 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|
@ -100,30 +100,30 @@
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 01 00 91 0f |.h.A.Vk.Z.......|
00000260 00 00 8d 00 8b 30 81 88 02 42 01 3a 26 83 6d 4a |.....0...B.:&.mJ|
00000270 e0 87 d4 5e 54 98 f1 8e a5 23 5f be ce 7b 31 76 |...^T....#_..{1v|
00000280 9e f9 93 53 3f b7 a2 4a 80 9f cf ab 64 dc ed 91 |...S?..J....d...|
00000290 14 26 27 07 f9 00 64 76 06 a3 84 ea 5f f2 43 f7 |.&'...dv...._.C.|
000002a0 35 e1 db ff 53 af 9d 18 00 7f fb ad 02 42 01 fe |5...S........B..|
000002b0 56 93 31 ad c3 c3 dc 35 02 66 76 4e 8f 70 f2 10 |V.1....5.fvN.p..|
000002c0 84 9c 4b e1 93 7d 7a 7a 0b 4e 0e ae 82 17 17 dd |..K..}zz.N......|
000002d0 8a d0 ba 97 7a 6f 9d 2d d3 20 88 a5 2f 3a 01 ff |....zo.-. ../:..|
000002e0 14 17 94 d0 81 dc 9d 36 52 72 e9 47 57 4b f4 e5 |.......6Rr.GWK..|
000002f0 14 03 01 00 01 01 16 03 01 00 30 68 55 dd 97 80 |..........0hU...|
00000300 5b 94 75 02 9c c1 19 f6 c4 04 c1 8a ad 8f 16 f2 |[.u.............|
00000310 b6 d6 c1 3b 35 f6 13 ab e3 d1 b7 e4 f9 a9 d5 5f |...;5.........._|
00000320 37 9c 3b d8 39 95 2b 66 73 e6 54 |7.;.9.+fs.T|
00000250 b5 68 1a 41 03 56 6b dc 5a 89 16 03 01 00 90 0f |.h.A.Vk.Z.......|
00000260 00 00 8c 00 8a 30 81 87 02 42 01 0f 51 63 8f 2e |.....0...B..Qc..|
00000270 fa 3a 3a 15 a9 4b 7f 04 c9 23 73 be 44 f5 28 37 |.::..K...#s.D.(7|
00000280 2c 00 34 20 86 e6 94 00 bf 11 40 ec de a9 54 03 |,.4 ......@...T.|
00000290 dc 9d 19 67 39 22 5e c4 55 3b f4 b6 9a a8 4f 6e |...g9"^.U;....On|
000002a0 21 20 f0 9a 9a 10 a8 01 3a 20 ac 8b 02 41 34 ad |! ......: ...A4.|
000002b0 89 da ec cc 8b b7 d7 5a 6c fe 6f 13 fa 58 40 2e |.......Zl.o..X@.|
000002c0 a6 bf 32 69 97 a5 21 44 7c 3d d2 51 b3 b3 bb 9c |..2i..!D|=.Q....|
000002d0 ed fa 5d bd 09 f3 c0 71 ee 3d 98 24 13 e1 e2 c8 |..]....q.=.$....|
000002e0 e7 75 fc ac c3 61 9a f3 47 b2 7c 97 01 99 2d 14 |.u...a..G.|...-.|
000002f0 03 01 00 01 01 16 03 01 00 30 d7 d1 c3 57 a3 f8 |.........0...W..|
00000300 71 eb 97 9d a8 ac 15 88 f4 b4 f7 e6 8c 2e eb fe |q...............|
00000310 25 d1 77 82 20 06 d1 36 20 3d bc 82 ab 30 4d 85 |%.w. ..6 =...0M.|
00000320 1b 7b c2 9e 60 8f 7e 05 73 3e |.{..`.~.s>|
>>> Flow 4 (server to client)
00000000 14 03 01 00 01 01 16 03 01 00 30 92 07 14 a3 fa |..........0.....|
00000010 a6 8f 52 9b bf ae 2b 87 b6 c4 74 44 0f d2 c4 32 |..R...+...tD...2|
00000020 70 02 a3 48 a5 d0 e5 4d 3c c0 2e 56 e1 45 df b7 |p..H...M<..V.E..|
00000030 8a fb 84 7e 32 2c 94 cc 37 66 66 |...~2,..7ff|
00000000 14 03 01 00 01 01 16 03 01 00 30 7a 5e 9e 4b 7d |..........0z^.K}|
00000010 44 8f 70 5f fd a9 50 a9 d8 52 cf 89 f9 b0 08 ea |D.p_..P..R......|
00000020 bb a2 80 44 73 09 da 81 98 33 b1 44 88 0c ef e3 |...Ds....3.D....|
00000030 c6 8b 2f 28 9b e1 f7 59 26 9c 54 |../(...Y&.T|
>>> Flow 5 (client to server)
00000000 17 03 01 00 20 89 e2 cc e6 b6 9f 3f 60 b4 c6 88 |.... ......?`...|
00000010 33 4d 0e 05 e6 0f 31 3c 87 7c a1 d5 2b 96 1e b6 |3M....1<.|..+...|
00000020 e1 dd 72 5e a1 17 03 01 00 20 f7 53 3e de 51 fc |..r^..... .S>.Q.|
00000030 f0 dd 93 88 62 25 c0 d4 4f dd 4a ea c5 3c d7 51 |....b%..O.J..<.Q|
00000040 68 72 50 fc be ed 57 80 c5 10 15 03 01 00 20 68 |hrP...W....... h|
00000050 6f f8 4e c9 c0 cd 9b ab 71 41 b3 97 87 5c 00 99 |o.N.....qA...\..|
00000060 50 46 20 a2 48 29 14 30 63 46 84 5b 96 7e 79 |PF .H).0cF.[.~y|
00000000 17 03 01 00 20 f1 61 1b 1f 1e 91 85 c1 ce 93 38 |.... .a........8|
00000010 6b d0 ee c5 2e 00 f0 42 e3 a9 f0 82 92 a6 9b df |k......B........|
00000020 ac 3c e3 18 aa 17 03 01 00 20 2a 72 5b 1a 57 10 |.<....... *r[.W.|
00000030 cb 64 c4 5f b2 2d f9 03 41 ca 8d 72 93 f7 ae 19 |.d._.-..A..r....|
00000040 37 3a 8c d5 f5 ad d8 83 20 9c 15 03 01 00 20 f9 |7:...... ..... .|
00000050 53 1a 9f 34 27 91 f1 3f 7c 33 eb 1f 5d 0e bc 89 |S..4'..?|3..]...|
00000060 5e 08 20 9e 5c e4 a0 70 8d 03 63 c6 9a 62 14 |^. .\..p..c..b.|