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 01 00 59 02 00 00 55 03 01 ec 11 a0 ef 24 |....Y...U......$|
00000010 30 9c 83 8c 12 7c 61 a8 39 bd 40 41 22 5c 58 7f |0....|a.9.@A"\X.|
00000020 ca 0c b2 41 66 dc 87 2d f1 4c cc 20 f6 53 42 ce |...Af..-.L. .SB.|
00000030 56 81 58 c1 70 30 37 55 64 f1 28 e4 63 50 e0 f4 |V.X.p07Ud.(.cP..|
00000040 af 7d 01 af 5e 1a 50 19 64 e6 c2 76 c0 09 00 00 |.}..^.P.d..v....|
00000000 16 03 01 00 59 02 00 00 55 03 01 a7 ea 63 8c 7d |....Y...U....c.}|
00000010 54 70 04 d5 5e a2 2e 8b 75 4f 17 c8 a8 8c 3d bc |Tp..^...uO....=.|
00000020 08 aa 82 48 85 ed 1a ff 42 e1 54 20 3b 77 9d 32 |...H....B.T ;w.2|
00000030 4d 60 f2 81 f8 20 aa d2 b0 eb ea 7c 6a 39 52 20 |M`... .....|j9R |
00000040 94 4a 2a 88 05 8a fe 6c 50 5c 95 39 c0 09 00 00 |.J*....lP\.9....|
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....|
@ -55,37 +55,37 @@
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 b4 0c 00 00 b0 03 00 1d 20 cc 73 |*............ .s|
00000280 bf 89 65 cc cf f2 dc ed df d3 25 9b b2 16 f8 df |..e.......%.....|
00000290 97 56 f6 29 4e 08 17 19 f0 5a 2f 9d e3 57 00 8a |.V.)N....Z/..W..|
000002a0 30 81 87 02 42 01 91 4e d1 9a 13 69 44 6c 79 01 |0...B..N...iDly.|
000002b0 99 bb ac 65 c7 bd 0c c3 d1 4c ed 54 e3 7b ff ef |...e.....L.T.{..|
000002c0 c3 c2 44 ee ec 3b 8d b4 22 98 31 89 07 a7 b7 c9 |..D..;..".1.....|
000002d0 dc 6f 0c e0 78 a9 79 fc 74 20 0b 55 48 16 d7 d6 |.o..x.y.t .UH...|
000002e0 c8 c8 f8 81 67 e2 50 02 41 61 43 bd 1f e1 68 f1 |....g.P.AaC...h.|
000002f0 7c e1 bf 10 3f 58 16 74 5c 98 ee 4c 18 17 bf f0 ||...?X.t\..L....|
00000300 64 d9 9e be c6 d7 73 e8 20 89 b6 4e fa 93 7d 82 |d.....s. ..N..}.|
00000310 7c 78 96 d1 d9 d1 81 1b 66 5f 87 7b a1 20 40 3c ||x......f_.{. @<|
00000320 13 49 e1 73 8e e9 52 e4 f0 46 16 03 01 00 04 0e |.I.s..R..F......|
00000330 00 00 00 |...|
00000270 2a 16 03 01 00 b5 0c 00 00 b1 03 00 1d 20 3a 1f |*............ :.|
00000280 18 e9 f2 09 3e 79 4b a0 62 73 ef 87 0d ea 90 51 |....>yK.bs.....Q|
00000290 7f 9d d2 79 59 e4 11 7f 69 f7 a9 d7 78 7f 00 8b |...yY...i...x...|
000002a0 30 81 88 02 42 01 65 ac eb e6 b0 86 73 95 a4 27 |0...B.e.....s..'|
000002b0 e3 82 55 cf 88 16 80 c2 68 4b 39 77 2a b1 a9 d3 |..U.....hK9w*...|
000002c0 08 d5 ac 77 ce 5b 16 73 2c ad b5 57 2a 7a 75 34 |...w.[.s,..W*zu4|
000002d0 ec 99 23 bd df b2 27 36 5a 4b 40 e0 d3 b0 d2 31 |..#...'6ZK@....1|
000002e0 9b c7 9e 0a cb 5b 69 02 42 00 88 d7 5a 6a 9e 4c |.....[i.B...Zj.L|
000002f0 c5 7b 2c 8e 93 3b 75 27 b4 00 11 88 ba cf 99 8c |.{,..;u'........|
00000300 e5 f2 60 22 de f2 fe 86 a6 48 86 9c 40 31 08 75 |..`".....H..@1.u|
00000310 aa bc 5d 6d fa 2e a4 a9 a1 0d fc e1 d9 5a a1 60 |..]m.........Z.`|
00000320 93 b9 69 c7 c2 3e f5 a9 cb 31 41 16 03 01 00 04 |..i..>...1A.....|
00000330 0e 00 00 00 |....|
>>> Flow 3 (client to server)
00000000 16 03 01 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 01 00 01 01 |....._X.;t......|
00000030 16 03 01 00 30 c6 44 20 88 b8 3b e4 a9 67 ca 54 |....0.D ..;..g.T|
00000040 f6 98 79 0e c5 8d d4 da 71 ce 40 51 59 e9 3f ee |..y.....q.@QY.?.|
00000050 a0 bb 7d 8a 84 4d 0a be 37 37 a8 cc fe bb 5d b6 |..}..M..77....].|
00000060 37 1b a8 a0 04 |7....|
00000030 16 03 01 00 30 30 25 15 82 a1 7f 11 32 13 52 17 |....00%.....2.R.|
00000040 b8 bd 5b b9 1e 69 88 0b b3 5f 12 40 e3 4b 03 cb |..[..i..._.@.K..|
00000050 cd 07 3c 43 4f ab f7 5d 2c 6a a3 02 a9 64 d0 77 |..<CO..],j...d.w|
00000060 27 dc 4a ae 8a |'.J..|
>>> Flow 4 (server to client)
00000000 14 03 01 00 01 01 16 03 01 00 30 d3 c0 74 ba 22 |..........0..t."|
00000010 e5 c6 8d c6 82 ac f4 63 90 28 73 a4 7a c3 43 ca |.......c.(s.z.C.|
00000020 0d 09 5a 84 70 d6 64 de 4b 06 9b fc b9 a9 3f d8 |..Z.p.d.K.....?.|
00000030 a0 02 67 2b 63 1e 61 91 b7 f9 a2 |..g+c.a....|
00000000 14 03 01 00 01 01 16 03 01 00 30 b5 3e 18 97 a1 |..........0.>...|
00000010 ca 2e 7f 5f b9 72 cb aa d4 f6 85 86 d3 27 40 13 |..._.r.......'@.|
00000020 e3 99 35 13 67 a8 9e 6e bb 63 15 97 96 42 e4 b3 |..5.g..n.c...B..|
00000030 fc 15 ee b7 d8 cb a2 64 3d 55 b8 |.......d=U.|
>>> Flow 5 (client to server)
00000000 17 03 01 00 20 b2 55 db d3 41 5d 5c 9b b5 b8 c8 |.... .U..A]\....|
00000010 fd ab 30 74 08 59 22 e3 8c e0 43 d0 63 14 33 f8 |..0t.Y"...C.c.3.|
00000020 00 b6 3d 1e a0 17 03 01 00 20 fa 14 95 a5 e3 a0 |..=...... ......|
00000030 09 04 e1 49 35 c5 ef c1 b4 c5 7d b5 6a c7 13 db |...I5.....}.j...|
00000040 88 2f 4c 65 f8 c4 d5 2a a5 3a 15 03 01 00 20 05 |./Le...*.:.... .|
00000050 21 da 3d 87 62 0c a7 e6 eb aa f6 bd 2f 77 fd a4 |!.=.b......./w..|
00000060 cd 2a ac 22 73 7c 75 60 59 db 0f 8f df 86 73 |.*."s|u`Y.....s|
00000000 17 03 01 00 20 12 6c bf f2 39 2d e6 ad a8 38 d5 |.... .l..9-...8.|
00000010 1c ea 5b 79 e5 c7 4a 41 eb 58 70 f0 7d f7 60 e7 |..[y..JA.Xp.}.`.|
00000020 ee 77 98 75 f2 17 03 01 00 20 ac 5e 6d b0 81 0b |.w.u..... .^m...|
00000030 14 ca c2 70 53 d8 6d 55 49 63 da 8a 61 66 80 2d |...pS.mUIc..af.-|
00000040 e4 7c 2e 60 1f eb 3c f2 27 66 15 03 01 00 20 7a |.|.`..<.'f.... z|
00000050 2b 80 f8 00 0f 06 f5 6e fe b7 b7 6b 12 6c 8d 8e |+......n...k.l..|
00000060 c4 11 23 2b a2 bb 16 93 b4 e0 e0 fd 8c 42 db |..#+.........B.|