Artifact
0b15f3a7be240aa09ad8e8150d5590505f0618f1:
0000: 43 6f 70 79 72 69 67 68 74 20 28 43 29 20 31 39 Copyright (C) 19
0010: 39 37 2d 32 30 30 30 20 4d 61 74 74 20 4e 65 77 97-2000 Matt New
0020: 6d 61 6e 20 3c 6d 61 74 74 40 6e 6f 76 61 64 69 man <matt@novadi
0030: 67 6d 2e 63 6f 6d 3e 0a 54 4c 53 20 31 2e 34 2e gm.com>.TLS 1.4.
0040: 31 20 43 6f 70 79 72 69 67 68 74 20 28 43 29 20 1 Copyright (C)
0050: 32 30 30 30 20 41 6a 75 62 61 20 53 6f 6c 75 74 2000 Ajuba Solut
0060: 69 6f 6e 73 0a 0a 24 48 65 61 64 65 72 3a 20 2f ions..$Header: /
0070: 68 6f 6d 65 2f 72 6b 65 65 6e 65 2f 74 6d 70 2f home/rkeene/tmp/
0080: 63 76 73 32 66 6f 73 73 69 6c 2f 2e 2e 2f 74 63 cvs2fossil/../tc
0090: 6c 74 6c 73 2f 74 6c 73 2f 74 6c 73 2f 52 45 41 ltls/tls/tls/REA
00a0: 44 4d 45 2e 74 78 74 2c 76 20 31 2e 33 20 32 30 DME.txt,v 1.3 20
00b0: 30 31 2f 30 36 2f 32 31 20 32 33 3a 33 34 3a 32 01/06/21 23:34:2
00c0: 30 20 68 6f 62 62 73 20 45 78 70 20 24 0a 0a 54 0 hobbs Exp $..T
00d0: 4c 53 20 28 61 6b 61 20 53 53 4c 29 20 43 68 61 LS (aka SSL) Cha
00e0: 6e 6e 65 6c 20 2d 20 63 61 6e 20 62 65 20 6c 61 nnel - can be la
00f0: 79 65 72 65 64 20 6f 6e 20 61 6e 79 20 62 69 2d yered on any bi-
0100: 64 69 72 65 63 74 69 6f 6e 61 6c 20 54 63 6c 5f directional Tcl_
0110: 43 68 61 6e 6e 65 6c 2e 0a 0a 42 6f 74 68 20 63 Channel...Both c
0120: 6c 69 65 6e 74 20 61 6e 64 20 73 65 72 76 65 72 lient and server
0130: 2d 73 69 64 65 20 73 6f 63 6b 65 74 73 20 61 72 -side sockets ar
0140: 65 20 70 6f 73 73 69 62 6c 65 2c 20 61 6e 64 20 e possible, and
0150: 74 68 69 73 20 63 6f 64 65 20 73 68 6f 75 6c 64 this code should
0160: 20 77 6f 72 6b 0a 6f 6e 20 61 6e 79 20 70 6c 61 work.on any pla
0170: 74 66 6f 72 6d 20 61 73 20 69 74 20 75 73 65 73 tform as it uses
0180: 20 61 20 67 65 6e 65 72 69 63 20 6d 65 63 68 61 a generic mecha
0190: 6e 69 73 6d 20 66 6f 72 20 6c 61 79 65 72 69 6e nism for layerin
01a0: 67 20 6f 6e 20 53 53 4c 20 61 6e 64 20 54 63 6c g on SSL and Tcl
01b0: 2e 0a 0a 54 68 65 20 54 4c 53 20 31 2e 34 20 72 ...The TLS 1.4 r
01c0: 65 6c 65 61 73 65 20 72 65 71 75 69 72 65 73 20 elease requires
01d0: 54 63 6c 20 38 2e 32 2e 30 2b 2c 20 77 69 74 68 Tcl 8.2.0+, with
01e0: 20 38 2e 33 2e 32 2b 20 70 72 65 66 65 72 72 65 8.3.2+ preferre
01f0: 64 2e 20 20 54 68 65 0a 73 74 61 63 6b 65 64 20 d. The.stacked
0200: 63 68 61 6e 6e 65 6c 20 69 6d 70 6c 65 6d 65 6e channel implemen
0210: 74 61 74 69 6f 6e 20 69 6e 20 54 63 6c 20 77 61 tation in Tcl wa
0220: 73 20 6f 72 69 67 69 6e 61 6c 6c 79 20 69 6e 74 s originally int
0230: 72 6f 64 75 63 65 64 20 69 6e 20 38 2e 32 2e 30 roduced in 8.2.0
0240: 0a 28 70 72 65 76 69 6f 75 73 6c 79 20 74 68 65 .(previously the
0250: 20 54 72 66 20 70 61 74 63 68 29 20 61 6e 64 20 Trf patch) and
0260: 72 65 77 72 69 74 74 65 6e 20 66 6f 72 20 38 2e rewritten for 8.
0270: 33 2e 32 2b 20 64 75 65 20 74 6f 20 69 6e 68 65 3.2+ due to inhe
0280: 72 65 6e 74 0a 6c 69 6d 69 74 61 74 69 6f 6e 73 rent.limitations
0290: 20 69 6e 20 74 68 65 20 65 61 72 6c 69 65 72 20 in the earlier
02a0: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 20 implementation.
02b0: 20 54 4c 53 20 31 2e 34 20 73 68 6f 75 6c 64 20 TLS 1.4 should
02c0: 63 6f 6d 70 69 6c 65 20 77 69 74 68 0a 61 6e 79 compile with.any
02d0: 20 73 74 75 62 73 2d 63 61 70 61 62 6c 65 20 54 stubs-capable T
02e0: 63 6c 20 69 6e 74 65 72 70 72 65 74 65 72 2c 20 cl interpreter,
02f0: 62 75 74 20 77 69 6c 6c 20 72 65 71 75 69 72 65 but will require
0300: 20 38 2e 32 2b 20 77 68 65 6e 20 6c 6f 61 64 65 8.2+ when loade
0310: 64 2e 0a 54 68 65 72 65 20 61 72 65 20 6b 6e 6f d..There are kno
0320: 77 6e 20 6c 69 6d 69 74 61 74 69 6f 6e 73 20 69 wn limitations i
0330: 6e 20 74 68 65 20 38 2e 32 2e 30 2d 38 2e 33 2e n the 8.2.0-8.3.
0340: 31 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 1 stacked channe
0350: 6c 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e l.implementation
0360: 2c 20 73 6f 20 69 74 20 69 73 20 65 6e 63 6f 75 , so it is encou
0370: 72 61 67 65 64 20 74 68 61 74 20 70 65 6f 70 6c raged that peopl
0380: 65 20 75 73 65 20 54 4c 53 20 31 2e 34 2b 20 77 e use TLS 1.4+ w
0390: 69 74 68 20 61 6e 0a 38 2e 33 2e 32 2b 20 54 63 ith an.8.3.2+ Tc
03a0: 6c 20 69 6e 74 65 72 70 72 65 74 65 72 2e 20 20 l interpreter.
03b0: 54 68 65 73 65 20 6d 6f 64 69 66 69 63 61 74 69 These modificati
03c0: 6f 6e 73 20 61 72 65 20 62 79 20 4a 65 66 66 20 ons are by Jeff
03d0: 48 6f 62 62 73 0a 3c 6a 65 66 66 40 68 6f 62 62 Hobbs.<jeff@hobb
03e0: 73 2e 6f 72 67 3e 2e 0a 0a 46 75 6c 6c 20 66 69 s.org>...Full fi
03f0: 6c 65 76 65 6e 74 20 73 65 6d 61 74 69 63 73 20 levent sematics
0400: 73 68 6f 75 6c 64 20 61 6c 73 6f 20 62 65 20 69 should also be i
0410: 6e 74 61 63 74 20 2d 20 73 65 65 20 74 65 73 74 ntact - see test
0420: 73 20 64 69 72 65 63 74 6f 72 79 20 66 6f 72 0a s directory for.
0430: 62 6c 6f 63 6b 69 6e 67 20 61 6e 64 20 6e 6f 6e blocking and non
0440: 2d 62 6c 6f 63 6b 69 6e 67 20 65 78 61 6d 70 6c -blocking exampl
0450: 65 73 2e 0a 0a 54 68 69 73 20 77 61 73 20 62 75 es...This was bu
0460: 69 6c 74 20 28 61 6c 6d 6f 73 74 29 20 66 72 6f ilt (almost) fro
0470: 6d 20 73 63 72 61 74 63 68 20 62 61 73 65 64 20 m scratch based
0480: 75 70 6f 6e 20 6f 62 73 65 72 76 61 74 69 6f 6e upon observation
0490: 20 6f 66 20 4f 70 65 6e 53 53 4c 20 30 2e 39 2e of OpenSSL 0.9.
04a0: 32 42 0a 0a 41 64 64 69 74 69 6f 6e 20 63 72 65 2B..Addition cre
04b0: 64 69 74 20 69 73 20 64 75 65 20 66 6f 72 20 41 dit is due for A
04c0: 6e 64 72 65 61 73 20 4b 75 70 72 69 65 73 20 28 ndreas Kupries (
04d0: 61 2e 6b 75 70 72 69 65 73 40 77 65 73 74 65 6e a.kupries@westen
04e0: 64 2e 63 6f 6d 29 2c 20 66 6f 72 0a 70 72 6f 76 d.com), for.prov
04f0: 69 64 69 6e 67 20 74 68 65 20 54 63 6c 5f 52 65 iding the Tcl_Re
0500: 70 6c 61 63 65 43 68 61 6e 6e 65 6c 20 6d 65 63 placeChannel mec
0510: 68 61 6e 69 73 6d 20 61 6e 64 20 77 6f 72 6b 69 hanism and worki
0520: 6e 67 20 63 6c 6f 73 65 6c 79 20 77 69 74 68 20 ng closely with
0530: 6d 65 0a 74 6f 20 65 6e 68 61 6e 63 65 20 69 74 me.to enhance it
0540: 20 74 6f 20 73 75 70 70 6f 72 74 20 66 75 6c 6c to support full
0550: 20 66 69 6c 65 65 76 65 6e 74 20 73 65 6d 61 6e fileevent seman
0560: 74 69 63 73 2e 0a 0a 41 6c 73 6f 20 77 6f 72 6b tics...Also work
0570: 20 64 6f 6e 65 20 62 79 20 74 68 65 20 66 6f 6c done by the fol
0580: 6c 6f 77 20 70 65 6f 70 6c 65 20 70 72 6f 76 69 low people provi
0590: 64 65 64 20 74 68 65 20 69 6d 70 65 74 75 73 20 ded the impetus
05a0: 74 6f 20 64 6f 20 74 68 69 73 20 22 72 69 67 68 to do this "righ
05b0: 74 22 3a 2d 0a 74 63 6c 53 53 4c 20 28 43 6f 6c t":-.tclSSL (Col
05c0: 69 6e 20 4d 63 43 6f 72 6d 61 63 6b 2c 20 53 68 in McCormack, Sh
05d0: 61 72 65 64 20 54 65 63 68 6e 6f 6c 6f 67 79 29 ared Technology)
05e0: 0a 53 53 4c 74 63 6c 20 28 50 65 74 65 72 20 41 .SSLtcl (Peter A
05f0: 6e 74 6d 61 6e 29 0a 0a 54 68 69 73 20 63 6f 64 ntman)..This cod
0600: 65 20 69 73 20 6c 69 63 65 6e 73 65 64 20 75 6e e is licensed un
0610: 64 65 72 20 74 68 65 20 73 61 6d 65 20 74 65 72 der the same ter
0620: 6d 73 20 61 73 20 74 68 65 20 54 63 6c 20 43 6f ms as the Tcl Co
0630: 72 65 2e 0a 0a 49 20 77 6f 75 6c 64 20 61 6c 73 re...I would als
0640: 6f 20 6c 69 6b 65 20 74 6f 20 61 63 6b 6e 6f 77 o like to acknow
0650: 6c 65 64 67 65 20 74 68 65 20 69 6e 70 75 74 20 ledge the input
0660: 6f 66 20 4d 61 72 73 68 61 6c 6c 20 52 6f 73 65 of Marshall Rose
0670: 2c 20 77 68 6f 20 63 6f 6e 76 69 6e 63 65 64 20 , who convinced
0680: 0a 6d 65 20 74 68 61 74 20 70 65 6f 70 6c 65 20 .me that people
0690: 6e 65 65 64 20 74 6f 20 62 65 20 61 62 6c 65 20 need to be able
06a0: 74 6f 20 73 77 69 74 63 68 2d 74 6f 2d 65 6e 63 to switch-to-enc
06b0: 72 79 70 74 65 64 20 6d 6f 64 65 20 70 61 72 74 rypted mode part
06c0: 20 77 61 79 0a 74 68 72 6f 75 67 68 20 61 20 63 way.through a c
06d0: 6f 6e 76 65 72 73 61 74 69 6f 6e 2e 0a 0a 41 6c onversation...Al
06e0: 73 6f 20 49 20 77 6f 75 6c 64 20 6c 69 6b 65 20 so I would like
06f0: 74 6f 20 61 63 6b 6e 6f 77 6c 65 64 67 65 20 74 to acknowledge t
0700: 68 65 20 6b 69 6e 64 20 73 75 70 70 6f 72 74 20 he kind support
0710: 6f 66 20 4e 6f 76 61 64 69 67 6d 20 49 6e 63 2c of Novadigm Inc,
0720: 20 6d 79 0a 63 75 72 72 65 6e 74 20 65 6d 70 6c my.current empl
0730: 6f 79 65 72 2c 20 77 68 69 63 68 20 6d 61 64 65 oyer, which made
0740: 20 74 68 69 73 20 70 6f 73 73 69 62 6c 65 2e 0a this possible..
0750: 0a 0a 4d 61 74 74 20 4e 65 77 6d 61 6e 0a ..Matt Newman.