crypto/tls: fix client certificates support for legacy servers

signatureSchemesForCertificate was written to be used with TLS 1.3, but
ended up used for TLS 1.2 client certificates in a refactor. Since it
only supported TLS 1.3 signature algorithms, it would lead to no RSA
client certificates being sent to servers that didn't support RSA-PSS.

TestHandshakeClientCertRSAPKCS1v15 was testing *specifically* for this,
but alas the OpenSSL flag -verify accepts an empty certificates list as
valid, as opposed to -Verify...

Fixes #28925

Change-Id: I61afc02ca501d3d64ab4ad77bbb4cf10931e6f93
Reviewed-on: https://go-review.googlesource.com/c/151660
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 2018-11-29 01:38:07 -05:00 committed by Filippo Valsorda
parent 6571d32361
commit daa7ff8195
10 changed files with 298 additions and 142 deletions

View file

@ -16,11 +16,11 @@
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|
>>> Flow 2 (server to client)
00000000 16 03 01 00 59 02 00 00 55 03 01 24 74 3f be 60 |....Y...U..$t?.`|
00000010 1a db 62 d6 00 1d f6 32 81 97 cf 92 4a 24 e1 3a |..b....2....J$.:|
00000020 1b 9d 3c 3e e7 c3 fc ea 1c 44 a1 20 39 e7 5e 49 |..<>.....D. 9.^I|
00000030 7e 82 32 fa 18 2e e0 99 ad 9a 47 cd d1 13 b3 82 |~.2.......G.....|
00000040 c3 08 7f 50 8e fc 22 2b ca 0b 36 58 c0 09 00 00 |...P.."+..6X....|
00000000 16 03 01 00 59 02 00 00 55 03 01 04 4a 64 8e 4f |....Y...U...Jd.O|
00000010 f1 4e 06 19 e2 cb b8 92 93 7b f5 ec 1b 0e 30 8e |.N.......{....0.|
00000020 1f 89 6c a1 28 e7 87 7f 9e 9e 19 20 cf aa b7 1f |..l.(...... ....|
00000030 77 43 26 3e 15 5e 67 68 0d a6 a3 b1 25 e5 63 27 |wC&>.^gh....%.c'|
00000040 00 f9 59 23 e0 a3 1c d7 49 e9 dc b3 c0 09 00 00 |..Y#....I.......|
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,39 +55,79 @@
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 b5 0c 00 00 b1 03 00 1d 20 f2 e9 |*............ ..|
00000280 14 47 0b c1 59 82 1c 18 99 70 51 34 32 b7 56 10 |.G..Y....pQ42.V.|
00000290 60 10 e4 6d ba 4a 2d 71 34 54 72 ee c3 14 00 8b |`..m.J-q4Tr.....|
000002a0 30 81 88 02 42 01 98 89 43 ea 15 40 bc d1 d0 29 |0...B...C..@...)|
000002b0 55 0d 1f 44 ba ac 9f 3a 20 4e 79 ec fa 51 fb 09 |U..D...: Ny..Q..|
000002c0 91 64 bc c8 0c 7a c0 99 be 98 b4 4c 73 10 1d e6 |.d...z.....Ls...|
000002d0 62 c8 35 cf 31 b3 f8 0a 5a 2f ca ea 9b df a0 6b |b.5.1...Z/.....k|
000002e0 c0 2c eb cd 0d 06 f1 02 42 01 f7 9a 9e d5 e9 78 |.,......B......x|
000002f0 1a c3 7f 5f da d3 7d 6f d9 ff 3d 15 46 1e 2f e2 |..._..}o..=.F./.|
00000300 11 fd c7 91 fd 08 3f 53 5f 1b 35 1a 6f 01 95 2a |......?S_.5.o..*|
00000310 91 3d 67 7a 72 52 d0 7b 83 00 f4 41 06 29 f3 cb |.=gzrR.{...A.)..|
00000320 29 22 3c 27 84 cf 90 28 bf fe b6 16 03 01 00 0a |)"<'...(........|
00000330 0d 00 00 06 03 01 02 40 00 00 16 03 01 00 04 0e |.......@........|
00000340 00 00 00 |...|
00000270 2a 16 03 01 00 b4 0c 00 00 b0 03 00 1d 20 6c 3b |*............ l;|
00000280 3f 6b 18 21 57 c4 df bf 3d ac 92 ee bc 99 0b 2f |?k.!W...=....../|
00000290 d5 b3 f5 ff 5f 6c 6b 33 db a9 7c 02 f8 4c 00 8a |...._lk3..|..L..|
000002a0 30 81 87 02 42 00 8e 15 e5 bb dc f5 3d c6 10 d7 |0...B.......=...|
000002b0 67 54 3d 80 b5 6a 4d 69 f1 2c fe 99 bc 32 e1 ab |gT=..jMi.,...2..|
000002c0 42 c0 7d f2 5d e0 d6 22 95 58 25 5e 63 ba f0 9c |B.}.]..".X%^c...|
000002d0 9f 29 91 c9 a9 42 99 ab b0 4f ed a9 42 8e 1f 3a |.)...B...O..B..:|
000002e0 44 34 48 d9 5a dd 9b 02 41 44 21 e1 54 b5 a3 e7 |D4H.Z...AD!.T...|
000002f0 0a 57 45 52 ae 9d b5 fe 45 8a 3f 8b e7 50 e8 01 |.WER....E.?..P..|
00000300 8c 26 27 85 f4 ef 80 30 7e d6 d8 27 4f d5 5e 9d |.&'....0~..'O.^.|
00000310 7b 65 1a c6 5a ab 57 17 3f 6e 5c 66 aa cd 46 bc |{e..Z.W.?n\f..F.|
00000320 5d 32 db a5 48 f8 f8 35 11 8b 16 03 01 00 0a 0d |]2..H..5........|
00000330 00 00 06 03 01 02 40 00 00 16 03 01 00 04 0e 00 |......@.........|
00000340 00 00 |..|
>>> Flow 3 (client to server)
00000000 16 03 01 00 07 0b 00 00 03 00 00 00 16 03 01 00 |................|
00000010 25 10 00 00 21 20 2f e5 7d a3 47 cd 62 43 15 28 |%...! /.}.G.bC.(|
00000020 da ac 5f bb 29 07 30 ff f6 84 af c4 cf c2 ed 90 |.._.).0.........|
00000030 99 5f 58 cb 3b 74 14 03 01 00 01 01 16 03 01 00 |._X.;t..........|
00000040 30 50 c4 b8 10 a3 18 68 5a 9e f4 9b 18 0a dc 5c |0P.....hZ......\|
00000050 c7 a6 de 40 d9 1a 9d 6a 7e 11 92 62 61 bc 16 8c |...@...j~..ba...|
00000060 6f 62 9c f9 96 e9 6b d7 35 a1 2b bb 4c cf b7 17 |ob....k.5.+.L...|
00000070 e4 |.|
00000000 16 03 01 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0|
00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.|
00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.|
00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1|
00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C|
00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523|
00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231|
00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac|
00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.|
00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....|
000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x|
000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.|
000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4|
000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..|
000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#|
000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....|
00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......|
00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..|
00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U|
00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U|
00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......|
00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.|
00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0|
00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........|
00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..|
00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]|
000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A|
000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...|
000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...|
000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......|
000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{|
000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....|
00000200 e5 35 16 03 01 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.|
00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...|
00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 01 00 |......._X.;t....|
00000230 86 0f 00 00 82 00 80 9a 02 82 fb dd 68 e7 91 9f |............h...|
00000240 83 12 57 35 23 7c de 88 97 07 a3 b2 67 77 0f c1 |..W5#|......gw..|
00000250 bd 33 36 b3 ce fb f7 96 26 91 ab dc 96 26 64 fa |.36.....&....&d.|
00000260 34 66 31 2b fa 6d 52 60 3e fb a3 87 27 a7 7c ac |4f1+.mR`>...'.|.|
00000270 8c 87 ff c5 5e 6f 6f e1 db bf bc 58 3d b3 f6 89 |....^oo....X=...|
00000280 a0 8e 0b 9d 26 74 68 57 ca e9 c2 ab 79 7b 6a dd |....&thW....y{j.|
00000290 c7 89 ef 0d 62 aa 47 7b 67 18 f2 ad 00 98 56 45 |....b.G{g.....VE|
000002a0 12 ca de 6a d1 1a b5 a9 d2 53 ba 3b 90 a6 cf 69 |...j.....S.;...i|
000002b0 12 65 32 c2 95 46 01 14 03 01 00 01 01 16 03 01 |.e2..F..........|
000002c0 00 30 f7 2d b9 19 66 b2 2c 1b 96 08 bc 70 5b f5 |.0.-..f.,....p[.|
000002d0 6d 58 9e 51 fb b5 3c a6 4f 4a fc 52 1f 10 20 c4 |mX.Q..<.OJ.R.. .|
000002e0 3f d6 3c 0e 99 e3 1c b5 21 7f 0d fa 08 ec 17 27 |?.<.....!......'|
000002f0 75 9f |u.|
>>> Flow 4 (server to client)
00000000 14 03 01 00 01 01 16 03 01 00 30 61 7e fa 1d 0b |..........0a~...|
00000010 62 c3 05 92 7c 80 f4 d2 b5 66 04 d7 f5 70 4c e8 |b...|....f...pL.|
00000020 8c 6b 26 cf 82 1d 9e cd b7 f0 d3 fa 64 12 13 90 |.k&.........d...|
00000030 6f 9d e9 cf 14 9f fc 6a fb a5 e7 |o......j...|
00000000 14 03 01 00 01 01 16 03 01 00 30 db ac b4 71 dc |..........0...q.|
00000010 92 06 9c fe 87 11 69 eb a6 4e e9 50 29 6d 06 37 |......i..N.P)m.7|
00000020 02 73 b8 6d 7e ca 89 02 cf fa ad 0c 7c d0 90 cb |.s.m~.......|...|
00000030 af e5 50 68 fc 76 c5 09 a1 a1 d3 |..Ph.v.....|
>>> Flow 5 (client to server)
00000000 17 03 01 00 20 7d 85 95 00 0d e4 b4 e5 51 d8 62 |.... }.......Q.b|
00000010 6f 4c 4b 40 70 d0 38 d4 26 1d 66 68 48 e7 2c fb |oLK@p.8.&.fhH.,.|
00000020 5d c4 73 ec 56 17 03 01 00 20 b7 2a 4d 8f fd 23 |].s.V.... .*M..#|
00000030 ad 22 16 61 5f 87 56 4a 61 75 4d bc 8c e7 47 1d |.".a_.VJauM...G.|
00000040 a8 6c 7f 20 48 be ea 5d 14 65 15 03 01 00 20 da |.l. H..].e.... .|
00000050 4d e2 92 83 ea 81 8a c8 d1 50 8b 81 c5 d8 8c 72 |M........P.....r|
00000060 b1 27 00 5c 0f 35 69 1d 88 78 fa 1d ba 8a 5b |.'.\.5i..x....[|
00000000 17 03 01 00 20 cd b3 a4 99 da 5d 59 36 6f f8 26 |.... .....]Y6o.&|
00000010 2d b2 4a 47 a1 54 7f b0 b3 df 0d 52 cc 13 7a 8b |-.JG.T.....R..z.|
00000020 a3 6a 8b 1f ee 17 03 01 00 20 d6 ab 8a 3e b3 41 |.j....... ...>.A|
00000030 0a be 61 50 79 19 1a 45 03 c6 b9 b4 84 b2 18 46 |..aPy..E.......F|
00000040 86 1f c3 b7 78 77 fc 7f 4f 30 15 03 01 00 20 2d |....xw..O0.... -|
00000050 c0 f2 71 06 dc 19 9d 88 82 b9 3a 6b be a4 77 98 |..q.......:k..w.|
00000060 87 32 46 54 27 e4 17 47 8a 83 9c 5a 45 6e 6b |.2FT'..G...ZEnk|