crypto/tls: add support for Ed25519 certificates in TLS 1.2 and 1.3

Support for Ed25519 certificates was added in CL 175478, this wires them
up into the TLS stack according to RFC 8422 (TLS 1.2) and RFC 8446 (TLS 1.3).

RFC 8422 also specifies support for TLS 1.0 and 1.1, and I initially
implemented that, but even OpenSSL doesn't take the complexity, so I
just dropped it. It would have required keeping a buffer of the
handshake transcript in order to do the direct Ed25519 signatures. We
effectively need to support TLS 1.2 because it shares ClientHello
signature algorithms with TLS 1.3.

While at it, reordered the advertised signature algorithms in the rough
order we would want to use them, also based on what curves have fast
constant-time implementations.

Client and client auth tests changed because of the change in advertised
signature algorithms in ClientHello and CertificateRequest.

Fixes #25355

Change-Id: I9fdd839afde4fd6b13fcbc5cc7017fd8c35085ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/177698
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
This commit is contained in:
Filippo Valsorda 2019-05-16 19:13:29 -04:00
parent 6c11745f0b
commit 28958b0da6
84 changed files with 4977 additions and 3938 deletions

View file

@ -1,5 +1,5 @@
>>> Flow 1 (client to server)
00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................|
00000000 16 03 01 00 fa 01 00 00 f6 03 03 00 00 00 00 00 |................|
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 00 00 00 00 |........... ....|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
@ -7,86 +7,86 @@
00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#|
00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5|
00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................|
00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............|
00000080 01 00 00 7b 00 05 00 05 01 00 00 00 00 00 0a 00 |...{............|
00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................|
000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................|
000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................|
000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........|
000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}|
000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..|
000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t|
000000a0 00 00 0d 00 1a 00 18 08 04 04 03 08 07 08 05 08 |................|
000000b0 06 04 01 05 01 06 01 05 03 06 03 02 01 02 03 ff |................|
000000c0 01 00 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 |.........+......|
000000d0 03 03 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f |......3.&.$... /|
000000e0 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0|
000000f0 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |.........._X.;t|
>>> Flow 2 (server to client)
00000000 16 03 03 00 7a 02 00 00 76 03 03 fa ff 71 26 f0 |....z...v....q&.|
00000010 2c ee 80 2c 1c f9 ea 4b de ad d0 61 83 7f 89 6f |,..,...K...a...o|
00000020 db e6 a9 53 ff c5 b5 ec 04 08 4c 20 00 00 00 00 |...S......L ....|
00000000 16 03 03 00 7a 02 00 00 76 03 03 dd df 8d 85 da |....z...v.......|
00000010 3c 99 a3 0c 01 90 5f ec b8 3d 28 ce e4 32 c0 e8 |<....._..=(..2..|
00000020 fe 77 03 ad 0f e1 33 1f dc 89 cb 20 00 00 00 00 |.w....3.... ....|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 02 00 00 |................|
00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 6f |..+.....3.$... o|
00000060 2a 3a fe 8e dc cf 2e 7d 26 bd 12 fb da 0a 00 16 |*:.....}&.......|
00000070 b7 12 79 72 a0 a8 95 11 81 d5 b3 ae f8 d7 26 14 |..yr..........&.|
00000080 03 03 00 01 01 17 03 03 00 17 42 95 95 65 84 db |..........B..e..|
00000090 3e dc c4 41 bb e2 21 94 27 2d 9e 27 4e dd 3e 9d |>..A..!.'-.'N.>.|
000000a0 6e 17 03 03 02 6d 71 24 bb 82 cf aa 37 52 4c 15 |n....mq$....7RL.|
000000b0 6d 5c 74 44 c5 08 21 31 ab 47 5a 75 b9 31 d6 97 |m\tD..!1.GZu.1..|
000000c0 69 64 40 b5 09 1c 2b 36 1d 54 19 52 4b ad c9 1c |id@...+6.T.RK...|
000000d0 d4 51 33 80 a4 b9 df 47 17 6a eb 7a d7 bc 12 3e |.Q3....G.j.z...>|
000000e0 7b 28 fa 15 16 aa 23 6f b5 5f a4 f6 8e 2b 00 11 |{(....#o._...+..|
000000f0 1b f2 00 e4 c8 31 38 ee 61 71 bc 7f dd a1 45 2d |.....18.aq....E-|
00000100 ac 1c 2b fd cd 40 51 29 4e 07 fd f4 04 45 09 56 |..+..@Q)N....E.V|
00000110 72 c8 83 22 3e 20 06 3a 93 16 89 21 4a 9f 3b bc |r.."> .:...!J.;.|
00000120 63 7f c0 1b 6a b2 30 d1 49 43 90 08 af 28 4a c1 |c...j.0.IC...(J.|
00000130 79 96 a1 72 0a 82 fe fb 20 1d 18 f8 b7 03 01 89 |y..r.... .......|
00000140 05 04 d7 98 1b 77 2e ad 81 56 de 08 f1 83 1e 9c |.....w...V......|
00000150 7d 2b 16 e1 15 87 12 db 5f 59 5d a3 95 75 ab f8 |}+......_Y]..u..|
00000160 54 87 91 0d 7f 80 76 6e d8 44 f3 c5 ef d6 b4 3d |T.....vn.D.....=|
00000170 6e 91 4c 65 b7 94 2d 05 d1 1e e6 49 d4 78 1c 34 |n.Le..-....I.x.4|
00000180 48 4a 5b 8c ed ad f7 cb 60 98 56 b5 98 ed 7e 88 |HJ[.....`.V...~.|
00000190 4b 98 ec aa 7d 79 71 2c f2 2f 15 5e c1 ed a6 14 |K...}yq,./.^....|
000001a0 01 df 25 df 79 35 1c f0 52 85 7b 2b 46 2c 09 14 |..%.y5..R.{+F,..|
000001b0 26 86 2c 6a d5 ec cf 24 04 49 9c d8 61 65 02 aa |&.,j...$.I..ae..|
000001c0 d6 ce 55 07 2f b6 23 f3 a7 8d 78 f9 72 fc 77 8b |..U./.#...x.r.w.|
000001d0 45 72 0e 61 c2 e8 8d 65 00 50 8b 00 42 48 d1 10 |Er.a...e.P..BH..|
000001e0 1f 3e cc ca 21 10 4c 0b 6b fc f8 c1 b7 83 3e 25 |.>..!.L.k.....>%|
000001f0 8e 40 11 55 32 34 83 0b 98 38 ad 2a ff e0 ae 71 |.@.U24...8.*...q|
00000200 86 0d 9a ef 50 e8 8a 32 53 ba c8 71 4e 96 46 95 |....P..2S..qN.F.|
00000210 c2 31 b5 64 6c 74 8e b6 be 8c e7 bd 5c 79 fd 87 |.1.dlt......\y..|
00000220 db 7e 39 82 7c 7b 38 58 42 34 a1 64 e9 15 f8 f3 |.~9.|{8XB4.d....|
00000230 56 2c ec c9 4f f3 4d e0 3d a6 ec 87 5f 48 be 75 |V,..O.M.=..._H.u|
00000240 d0 9e a6 6c ef 97 db a8 66 ff 8b 5e 34 28 bb 34 |...l....f..^4(.4|
00000250 e0 9c a0 a1 18 2a f4 98 71 e7 8b 18 2c 7c 37 a9 |.....*..q...,|7.|
00000260 c0 75 b4 24 7f ce 85 42 fe ed 7f fd 6d 7c 3d 5b |.u.$...B....m|=[|
00000270 bf d4 72 b9 2f 6d b6 09 86 cd 48 2f 69 a5 94 86 |..r./m....H/i...|
00000280 ab e9 04 b7 b3 88 3b 49 6b 28 e5 8a 30 73 60 9a |......;Ik(..0s`.|
00000290 c9 ff c5 ff 62 0b cc 3a ec 8b 4b a5 f2 2e c3 9d |....b..:..K.....|
000002a0 a1 5d 51 9d f0 2d 88 20 24 cc bf cf 79 69 aa 4d |.]Q..-. $...yi.M|
000002b0 f0 86 ba 9f 7c b4 f0 e3 97 54 7b f5 68 f8 da 26 |....|....T{.h..&|
000002c0 38 a5 5c 86 c5 0a f5 06 af 58 66 e3 40 a0 33 d4 |8.\......Xf.@.3.|
000002d0 cb 90 52 1b 81 3d 31 9d f9 8f 4f d9 38 80 f3 ea |..R..=1...O.8...|
000002e0 79 c4 2c 55 3f ea 9b 79 51 24 dc 70 6e 5c 68 ce |y.,U?..yQ$.pn\h.|
000002f0 b0 65 58 ec 3d 62 27 f3 1c 34 b4 7c b5 8e 91 1d |.eX.=b'..4.|....|
00000300 dc 6b 21 b5 3d 9c 6f 30 91 f8 39 d8 11 03 65 95 |.k!.=.o0..9...e.|
00000310 72 71 36 17 03 03 00 99 4f 82 32 b2 1c df 6d 0d |rq6.....O.2...m.|
00000320 c5 6f d7 89 39 07 42 4d d5 ae 7d 0d 6f a8 68 41 |.o..9.BM..}.o.hA|
00000330 ca 64 5c 38 5a 31 85 02 d7 99 28 ac 0d 33 1b e2 |.d\8Z1....(..3..|
00000340 d8 f7 f2 d3 13 30 50 0f e9 21 3c 9e 53 1c fb cd |.....0P..!<.S...|
00000350 96 e7 00 ef 35 5d d6 a7 64 77 fd 76 07 fa e6 e0 |....5]..dw.v....|
00000360 04 ec cf c0 76 41 a7 12 37 e0 c3 42 43 11 54 7e |....vA..7..BC.T~|
00000370 4f b8 38 3a 3e 60 0f 9c ac 65 d1 84 d3 6e b1 c2 |O.8:>`...e...n..|
00000380 fc be a7 96 59 89 87 c7 b9 d7 09 c0 ef 68 d7 10 |....Y........h..|
00000390 a5 08 8a 45 23 17 47 e3 eb f7 9f d3 ab 54 d1 4a |...E#.G......T.J|
000003a0 8c 69 1f aa a3 43 af dd ce 76 a3 9a 6f e5 4c 6a |.i...C...v..o.Lj|
000003b0 07 17 03 03 00 45 b8 72 a2 fb af 1c 5e 8f ed 0a |.....E.r....^...|
000003c0 53 85 d3 cd 32 ad 56 ba 38 82 1c 23 40 83 7e c1 |S...2.V.8..#@.~.|
000003d0 ce 0f 53 f5 74 a0 54 39 aa fb f1 13 8d 5f 3a 93 |..S.t.T9....._:.|
000003e0 fc 98 72 3f e5 70 e2 e5 97 fb 92 ca 2b 52 50 96 |..r?.p......+RP.|
000003f0 3f d0 8d 94 d5 17 2b 0d 90 4a 12 |?.....+..J.|
00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 03 |..+.....3.$... .|
00000060 6b 91 90 36 f0 54 da 66 8e 47 9b 26 9f 9f ae 30 |k..6.T.f.G.&...0|
00000070 69 9e a2 6a 70 fb ef b2 f1 76 2b 32 90 0e 63 14 |i..jp....v+2..c.|
00000080 03 03 00 01 01 17 03 03 00 17 46 47 2e ae ea 9b |..........FG....|
00000090 78 7b 0c d4 74 e2 b5 bf 7b 64 da c3 d3 c9 55 7f |x{..t...{d....U.|
000000a0 e3 17 03 03 02 6d a8 c1 57 27 66 9d 16 f6 4f 1b |.....m..W'f...O.|
000000b0 17 b6 5d 8c 3c fe f5 d5 4a d3 c6 8d e2 a8 2d d0 |..].<...J.....-.|
000000c0 01 8d db 18 e8 c8 69 74 eb 81 9e 97 20 01 60 d5 |......it.... .`.|
000000d0 96 d1 8f 9c de 09 ff 1d e7 45 97 97 36 fa 89 77 |.........E..6..w|
000000e0 88 20 30 c6 5b 42 d6 0e 85 9a 11 43 60 a1 86 34 |. 0.[B.....C`..4|
000000f0 22 47 25 23 a5 35 87 a9 74 5d fe eb c9 70 32 44 |"G%#.5..t]...p2D|
00000100 17 60 55 99 7a 93 b5 92 8b 66 31 ce dc e0 39 f2 |.`U.z....f1...9.|
00000110 6a b3 db 43 5d 3f ba e5 12 12 1f 0e 3c 35 3b 72 |j..C]?......<5;r|
00000120 9f 9d 69 d5 d6 cb ac b5 9e f4 af f5 74 68 67 f4 |..i.........thg.|
00000130 e9 5f a4 4a d7 27 5b a5 2a 39 b7 30 49 4d 64 bb |._.J.'[.*9.0IMd.|
00000140 5d 89 10 ff a6 2c 42 a1 4a 2a 0c 28 c6 cd 4a e8 |]....,B.J*.(..J.|
00000150 7d 24 d0 75 ff 61 08 3f 3b 05 ec f3 d6 61 ed 43 |}$.u.a.?;....a.C|
00000160 08 5e 07 1c f2 15 96 22 2a c0 3c 5f 04 d1 17 82 |.^....."*.<_....|
00000170 ea ee ee c7 49 cc 3e e4 65 15 97 6e 6f 36 24 a9 |....I.>.e..no6$.|
00000180 27 34 3a 75 dc 07 1e 4c f1 29 d1 e3 22 31 7d 84 |'4:u...L.).."1}.|
00000190 a8 2a 7f 37 03 ab 13 ae 15 e2 74 50 bd 54 5b 32 |.*.7......tP.T[2|
000001a0 ea 75 10 ed 39 5c 69 90 f6 74 09 53 c1 ce 44 49 |.u..9\i..t.S..DI|
000001b0 64 fb f2 c6 bd 93 b2 07 06 96 94 04 a5 9e ed 67 |d..............g|
000001c0 10 cb 01 fc 85 45 d7 22 76 3c c6 2f 14 4c 31 e1 |.....E."v<./.L1.|
000001d0 73 81 7b 8b 6b 54 d6 34 15 d2 eb d0 03 10 c7 3d |s.{.kT.4.......=|
000001e0 f5 07 48 cc 72 9b e9 48 ee 13 9f 80 b5 13 86 77 |..H.r..H.......w|
000001f0 33 91 79 6f f2 13 17 68 ca 72 6b 0d 93 9a 20 30 |3.yo...h.rk... 0|
00000200 70 c3 30 ab 13 7e 14 39 97 4b ce c5 3d 8b 03 7f |p.0..~.9.K..=...|
00000210 cd 4b 67 c4 c5 79 0c bb cd ba 17 c5 d5 15 51 cb |.Kg..y........Q.|
00000220 ac b7 f7 19 43 ff f5 c4 09 8c 44 67 ca e6 a1 5f |....C.....Dg..._|
00000230 1d 27 29 63 f2 0d 75 6d b7 62 52 c9 1d 8e 0e 3b |.')c..um.bR....;|
00000240 6c cb 04 3e f7 13 74 bb 03 35 2e 4e 41 9a b7 72 |l..>..t..5.NA..r|
00000250 15 ed 02 79 c7 bc 38 b3 65 75 0a 8e 82 dc d4 79 |...y..8.eu.....y|
00000260 1c 10 3f 78 8c be 78 b0 73 18 cc 52 1d 3b 91 66 |..?x..x.s..R.;.f|
00000270 33 fe 63 b2 ec 19 92 44 8f 06 4e 20 85 94 5c b4 |3.c....D..N ..\.|
00000280 ad 22 16 a0 b3 76 03 dc 62 e9 0c ac 8c e1 67 c9 |."...v..b.....g.|
00000290 d8 6f 40 51 b5 39 9a 61 b6 63 e0 d5 60 6a 27 78 |.o@Q.9.a.c..`j'x|
000002a0 62 ec 94 1c 75 2c 38 f2 a6 f2 f0 c4 8f 98 ad cc |b...u,8.........|
000002b0 2e ce 7d 13 76 f4 4f 94 78 3f 85 cf ea 52 c4 6e |..}.v.O.x?...R.n|
000002c0 16 65 f9 48 5e f9 0b 07 bc 3e 38 91 06 e1 b0 76 |.e.H^....>8....v|
000002d0 82 60 25 03 36 9c 3e 5e 54 73 8d cf df 91 19 33 |.`%.6.>^Ts.....3|
000002e0 a7 18 96 d4 86 ea 7c 00 88 e6 a3 fe ea a1 14 db |......|.........|
000002f0 ae da 07 ef 1e 6f 16 bb ad fb c0 f4 60 2f 75 5c |.....o......`/u\|
00000300 a4 43 a0 fc 3c d6 5e 89 cf 6e 1a c6 de 61 65 34 |.C..<.^..n...ae4|
00000310 03 e5 cd 17 03 03 00 99 0a f3 a2 45 fe 53 22 37 |...........E.S"7|
00000320 cd 31 9d 67 31 56 f9 99 c2 d1 bc 6d 47 de 9a e7 |.1.g1V.....mG...|
00000330 67 c0 89 84 ac bf 27 b5 32 f0 e9 a5 9d f2 e0 ad |g.....'.2.......|
00000340 fd 12 6a a4 5d 50 4c b9 ed f1 f4 0e c0 c0 6c c4 |..j.]PL.......l.|
00000350 39 9b 10 02 fa 10 64 a6 8b af 9d 6e d9 40 6d 0c |9.....d....n.@m.|
00000360 b0 6c b8 8d d5 b0 14 f0 ed 85 d6 66 8f 6f 61 43 |.l.........f.oaC|
00000370 49 dd 95 08 94 2e a8 a6 19 b9 7b 6b 99 09 af 4c |I.........{k...L|
00000380 5f 41 48 da 10 b6 cf ee 68 b6 6e 03 d7 29 93 8e |_AH.....h.n..)..|
00000390 1a ab d1 ad d4 bf 33 2a 53 87 92 05 d1 1a de c0 |......3*S.......|
000003a0 aa ef b9 9c 4d 2d f6 b1 72 60 22 80 bb 46 24 75 |....M-..r`"..F$u|
000003b0 35 17 03 03 00 45 46 9e b3 7f d0 82 b6 ef 45 1f |5....EF.......E.|
000003c0 18 6d 3b b6 23 f5 c9 f4 54 e3 08 d0 8b 30 c7 31 |.m;.#...T....0.1|
000003d0 af 98 26 69 b7 6e 08 1d 1f be 1a 7e 5b 97 91 28 |..&i.n.....~[..(|
000003e0 fa b7 78 05 ee 3f a1 9e a0 79 fc 45 51 4c 96 fb |..x..?...y.EQL..|
000003f0 03 46 24 7d fe ec a4 40 51 d6 73 |.F$}...@Q.s|
>>> Flow 3 (client to server)
00000000 14 03 03 00 01 01 17 03 03 00 45 f6 a2 b0 dd 25 |..........E....%|
00000010 6e 65 f4 c5 74 2b 60 e0 14 12 92 b3 fc 8c 18 06 |ne..t+`.........|
00000020 fb 5d c4 de d9 41 df 39 47 b1 d0 2f 3c 4e 90 fb |.]...A.9G../<N..|
00000030 d3 8f 32 93 2c 7e 66 5d a2 96 91 91 df ec a5 6f |..2.,~f].......o|
00000040 2e 4a 7b b4 1b 77 1e 16 76 66 c3 80 c8 d9 b0 eb |.J{..w..vf......|
00000050 17 03 03 00 17 8e d8 13 8e af f8 41 d2 63 19 3b |...........A.c.;|
00000060 e0 a8 0a 73 6c dd 76 31 b8 51 17 bc 17 03 03 00 |...sl.v1.Q......|
00000070 13 1a ee 55 37 e1 4c d3 fc 81 4d 37 84 e6 88 52 |...U7.L...M7...R|
00000080 65 b5 02 78 |e..x|
00000000 14 03 03 00 01 01 17 03 03 00 45 44 15 b9 ed d8 |..........ED....|
00000010 10 2c 88 80 79 f3 38 a4 bc 42 9b 22 09 44 d9 19 |.,..y.8..B.".D..|
00000020 e1 0a ec 15 aa d5 15 e9 19 6d b8 6b 71 63 86 ce |.........m.kqc..|
00000030 e7 16 0d 8e 3f 9a 3b 52 25 1e 96 f6 d9 d1 6c dd |....?.;R%.....l.|
00000040 e3 20 e9 97 f9 60 81 f5 4a b2 26 b5 d3 9e 84 46 |. ...`..J.&....F|
00000050 17 03 03 00 17 de 4a e9 44 21 88 ef ce 78 35 6d |......J.D!...x5m|
00000060 b2 e4 78 47 39 8d 1f fd 9b 2d a4 47 17 03 03 00 |..xG9....-.G....|
00000070 13 98 f9 1c 9c d4 b1 42 f7 e7 a1 9b 6d b1 b1 cb |.......B....m...|
00000080 86 e3 c2 27 |...'|