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,20 +7,20 @@
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 59 02 00 00 55 03 03 bd b8 d6 c0 5c |....Y...U......\|
00000010 0c 7f e3 50 4c 1c d3 b0 0f 67 1a 32 cc 49 18 03 |...PL....g.2.I..|
00000020 41 91 87 43 0c eb 40 53 a4 2c 0c 20 ec a4 59 bd |A..C..@S.,. ..Y.|
00000030 cb 3e b8 94 d9 74 ee ab 8e 7a 24 c8 cc af 08 87 |.>...t...z$.....|
00000040 e7 9c d1 01 4e fe 7d 1d 5d cf e0 2c c0 23 00 00 |....N.}.]..,.#..|
00000000 16 03 03 00 59 02 00 00 55 03 03 87 87 6f ce 44 |....Y...U....o.D|
00000010 94 5f 2f cc 94 03 50 68 a7 4f 37 70 8a d4 cf e3 |._/...Ph.O7p....|
00000020 23 7f 11 f5 93 c7 3f 96 87 49 45 20 9c d4 96 b2 |#.....?..IE ....|
00000030 dc 8c 16 c5 fb cc 2f 8e 0e a5 ef a3 ea cf 57 d0 |....../.......W.|
00000040 09 70 bd 16 c4 d9 e4 1b a0 40 f7 f3 c0 23 00 00 |.p.......@...#..|
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....|
@ -55,43 +55,43 @@
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 b6 0c 00 00 b2 03 00 1d 20 6d 7f |*............ m.|
00000280 23 3f 8c 08 0f db 54 cc dc 84 d7 97 f0 18 85 68 |#?....T........h|
00000290 e3 17 94 f6 48 f3 c2 9c 4c 3e 58 47 ed 29 04 03 |....H...L>XG.)..|
000002a0 00 8a 30 81 87 02 42 01 c1 d9 7a d0 fb d9 ff 31 |..0...B...z....1|
000002b0 78 20 9e 2e 5c f0 22 97 1b 24 e8 50 6f 5d 8c db |x ..\."..$.Po]..|
000002c0 fb 97 0d 2d 73 08 ae 46 14 1c 76 2b 38 ad 75 2d |...-s..F..v+8.u-|
000002d0 a2 8e 5a 99 40 47 51 1f 11 af c0 86 bc c9 3b e3 |..Z.@GQ.......;.|
000002e0 a0 ff 6a e6 87 e6 74 d8 fd 02 41 7a 72 6a 93 12 |..j...t...Azrj..|
000002f0 4b 48 f9 46 af 95 90 1e 3b c7 2c fe 67 a1 44 d8 |KH.F....;.,.g.D.|
00000300 77 1c 7e 03 fe be ba 9d a1 85 81 42 fb 18 7d 08 |w.~........B..}.|
00000310 e6 04 1f 3e 05 eb 48 87 4e 28 1c e9 00 db 7f c4 |...>..H.N(......|
00000320 17 cb 21 02 37 90 47 fd 2f db 95 a7 16 03 03 00 |..!.7.G./.......|
00000270 2a 16 03 03 00 b6 0c 00 00 b2 03 00 1d 20 3f a6 |*............ ?.|
00000280 d1 0d ae 8d c0 06 14 ca da 2c 69 1c f1 84 c4 dd |.........,i.....|
00000290 14 f4 0e a6 ce b5 d6 37 9d 9f a5 ba 7b 74 04 03 |.......7....{t..|
000002a0 00 8a 30 81 87 02 42 00 b5 2b 9a 32 9d af b9 cc |..0...B..+.2....|
000002b0 0d b6 f1 9b 87 35 af d7 dc 04 0f 1b 04 d7 fa 62 |.....5.........b|
000002c0 20 bd 2c 31 41 17 e7 c0 ea 22 78 e4 de 37 14 a8 | .,1A...."x..7..|
000002d0 f9 f3 f1 3e 0c 55 59 b3 e3 0e 31 26 ce d0 c1 19 |...>.UY...1&....|
000002e0 b8 17 07 2a 23 98 7b 17 0f 02 41 41 d5 51 80 4d |...*#.{...AA.Q.M|
000002f0 8a 14 56 b1 39 7b 8b 37 24 ef e0 ec 43 44 5a cc |..V.9{.7$...CDZ.|
00000300 9b ab dc 63 e7 cc 7b 29 c0 66 ae 9c 23 c5 1b 98 |...c..{).f..#...|
00000310 6e 35 64 97 12 43 16 73 a6 6b c8 09 2c 26 7c f5 |n5d..C.s.k..,&|.|
00000320 b1 1f 9f 55 04 9e 53 33 c1 89 7a d0 16 03 03 00 |...U..S3..z.....|
00000330 04 0e 00 00 00 |.....|
>>> Flow 3 (client to server)
00000000 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 47 cd |....%...! /.}.G.|
00000010 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 af c4 |bC.(.._.).0.....|
00000020 cf c2 ed 90 99 5f 58 cb 3b 74 14 03 03 00 01 01 |....._X.;t......|
00000030 16 03 03 00 50 00 00 00 00 00 00 00 00 00 00 00 |....P...........|
00000040 00 00 00 00 00 7a c5 98 1b ac 30 7c ea 9b cc 6d |.....z....0|...m|
00000050 5d 40 19 5d 6e 47 8a 46 d4 de 8c a3 f8 9b b1 2c |]@.]nG.F.......,|
00000060 9f 90 e9 83 2c a6 18 9f 39 92 d5 1f ab d5 5a 03 |....,...9.....Z.|
00000070 79 44 36 e3 0d b5 c9 e4 36 73 08 7d 55 e0 23 d6 |yD6.....6s.}U.#.|
00000080 82 f3 d7 4e ba |...N.|
00000040 00 00 00 00 00 d3 72 3f 9d 37 ba 97 55 83 b4 f0 |......r?.7..U...|
00000050 ad 0b f0 48 98 16 05 f1 b5 6e da a4 79 e4 d9 8e |...H.....n..y...|
00000060 62 af b9 a1 d1 a4 5c 04 d2 b1 86 32 af 64 ac 89 |b.....\....2.d..|
00000070 d3 47 5f 61 ae f4 21 5b 8d 4b ff 74 c1 b8 9c de |.G_a..![.K.t....|
00000080 fd 74 a0 99 c1 |.t...|
>>> Flow 4 (server to client)
00000000 14 03 03 00 01 01 16 03 03 00 50 a4 84 15 44 2e |..........P...D.|
00000010 6e e3 20 8d 7c a0 e4 85 36 7b a6 19 35 38 52 d0 |n. .|...6{..58R.|
00000020 bf 47 7e b4 09 a7 5b 5b e6 7c ad 4a b0 56 0a 28 |.G~...[[.|.J.V.(|
00000030 50 ef 94 89 8b 54 80 06 7a d8 b2 5d 75 ab e2 ff |P....T..z..]u...|
00000040 b1 6c 11 60 d2 0d 06 af bf 45 fd d8 5a 7b 2d 9c |.l.`.....E..Z{-.|
00000050 7c a1 b7 5e 4c 77 c9 ed 56 f0 68 ||..^Lw..V.h|
00000000 14 03 03 00 01 01 16 03 03 00 50 09 3b 3e 7e 2e |..........P.;>~.|
00000010 d8 46 04 ac b0 3d c9 7e ec 28 8c bd 6c 0f a8 b5 |.F...=.~.(..l...|
00000020 af 8c 86 ed 64 81 6c d4 98 9e 56 2a 48 0d 03 40 |....d.l...V*H..@|
00000030 64 3e 25 58 6f 03 6a 4e be a2 11 6f 6f e7 2f c2 |d>%Xo.jN...oo./.|
00000040 8f 78 c4 11 a1 07 21 91 9d 34 01 08 39 0d 07 d2 |.x....!..4..9...|
00000050 d4 a2 cc 2f 25 ea ee 8d 8b 91 f9 |.../%......|
>>> Flow 5 (client to server)
00000000 17 03 03 00 40 00 00 00 00 00 00 00 00 00 00 00 |....@...........|
00000010 00 00 00 00 00 0b 1a da c8 8a 8e 62 45 0b b3 69 |...........bE..i|
00000020 6a 6e 43 20 54 ae 4e 10 4b 64 0c e0 d6 1c 77 9d |jnC T.N.Kd....w.|
00000030 bd 23 f7 0a 7d eb 2e 54 9a d7 08 1d c6 af eb a9 |.#..}..T........|
00000040 6e c2 18 b5 95 15 03 03 00 40 00 00 00 00 00 00 |n........@......|
00000050 00 00 00 00 00 00 00 00 00 00 c7 9c 8c 71 7f 00 |.............q..|
00000060 42 8e 5b 14 4a 9b 88 a1 5b 68 b4 45 16 c0 c1 91 |B.[.J...[h.E....|
00000070 3e 9a 9f 84 b2 9b b3 f2 f5 e3 50 53 2e d8 4b 7c |>.........PS..K||
00000080 2a e8 e9 91 64 81 5a f4 43 f3 |*...d.Z.C.|
00000010 00 00 00 00 00 1d 76 4c fb 46 f8 02 9a bc 07 8d |......vL.F......|
00000020 b0 52 40 44 58 da ad be 3c a6 d7 44 0f 59 98 f3 |.R@DX...<..D.Y..|
00000030 ae 5c d2 04 bb 07 ee f6 99 9d 2c 14 44 3b 90 bc |.\........,.D;..|
00000040 2b e9 bc 37 59 15 03 03 00 40 00 00 00 00 00 00 |+..7Y....@......|
00000050 00 00 00 00 00 00 00 00 00 00 c4 ef 97 87 35 a2 |..............5.|
00000060 2f cc c2 6f 3d d5 f5 6f fd 74 56 50 37 f8 10 e8 |/..o=..o.tVP7...|
00000070 36 f5 fb 6f 7b 5d 20 07 0d 2f 72 46 a7 3a e0 de |6..o{] ../rF.:..|
00000080 39 b3 76 0e 4f c0 e7 85 4b bb |9.v.O...K.|