Artifact
94b77ef2745f3a8d3fb10f2f286c521f88c01e27:
0000: 4f 72 69 67 69 6e 61 6c 20 54 4c 53 20 43 6f 70 Original TLS Cop
0010: 79 72 69 67 68 74 20 28 43 29 20 31 39 39 37 2d yright (C) 1997-
0020: 32 30 30 30 20 4d 61 74 74 20 4e 65 77 6d 61 6e 2000 Matt Newman
0030: 20 3c 6d 61 74 74 40 6e 6f 76 61 64 69 67 6d 2e <matt@novadigm.
0040: 63 6f 6d 3e 0a 54 4c 53 20 31 2e 34 2e 31 20 20 com>.TLS 1.4.1
0050: 20 20 43 6f 70 79 72 69 67 68 74 20 28 43 29 20 Copyright (C)
0060: 32 30 30 30 20 41 6a 75 62 61 20 53 6f 6c 75 74 2000 Ajuba Solut
0070: 69 6f 6e 73 0a 54 4c 53 20 31 2e 36 20 20 20 20 ions.TLS 1.6
0080: 20 20 43 6f 70 79 72 69 67 68 74 20 28 43 29 20 Copyright (C)
0090: 32 30 30 38 20 41 63 74 69 76 65 53 74 61 74 65 2008 ActiveState
00a0: 20 53 6f 66 74 77 61 72 65 20 49 6e 63 2e 0a 54 Software Inc..T
00b0: 4c 53 20 31 2e 37 20 20 20 20 20 20 43 6f 70 79 LS 1.7 Copy
00c0: 72 69 67 68 74 20 28 43 29 20 32 30 31 36 20 4d right (C) 2016 M
00d0: 61 74 74 20 4e 65 77 6d 61 6e 2c 20 41 6a 75 62 att Newman, Ajub
00e0: 61 20 53 6f 6c 75 74 69 6f 6e 73 2c 20 41 63 74 a Solutions, Act
00f0: 69 76 65 53 74 61 74 65 0a 20 20 20 20 20 20 20 iveState.
0100: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0110: 20 20 20 20 20 20 20 20 20 53 6f 66 74 77 61 72 Softwar
0120: 65 20 49 6e 63 2c 20 52 6f 79 20 4b 65 65 6e 65 e Inc, Roy Keene
0130: 20 3c 74 63 6c 74 6c 73 40 72 6b 65 65 6e 65 2e <tcltls@rkeene.
0140: 6f 72 67 3e 0a 0a 54 4c 53 20 28 61 6b 61 20 53 org>..TLS (aka S
0150: 53 4c 29 20 43 68 61 6e 6e 65 6c 20 2d 20 63 61 SL) Channel - ca
0160: 6e 20 62 65 20 6c 61 79 65 72 65 64 20 6f 6e 20 n be layered on
0170: 61 6e 79 20 62 69 2d 64 69 72 65 63 74 69 6f 6e any bi-direction
0180: 61 6c 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 2e 0a al Tcl_Channel..
0190: 0a 42 6f 74 68 20 63 6c 69 65 6e 74 20 61 6e 64 .Both client and
01a0: 20 73 65 72 76 65 72 2d 73 69 64 65 20 73 6f 63 server-side soc
01b0: 6b 65 74 73 20 61 72 65 20 70 6f 73 73 69 62 6c kets are possibl
01c0: 65 2c 20 61 6e 64 20 74 68 69 73 20 63 6f 64 65 e, and this code
01d0: 20 73 68 6f 75 6c 64 20 77 6f 72 6b 0a 6f 6e 20 should work.on
01e0: 61 6e 79 20 70 6c 61 74 66 6f 72 6d 20 61 73 20 any platform as
01f0: 69 74 20 75 73 65 73 20 61 20 67 65 6e 65 72 69 it uses a generi
0200: 63 20 6d 65 63 68 61 6e 69 73 6d 20 66 6f 72 20 c mechanism for
0210: 6c 61 79 65 72 69 6e 67 20 6f 6e 20 53 53 4c 20 layering on SSL
0220: 61 6e 64 20 54 63 6c 2e 0a 0a 46 75 6c 6c 20 66 and Tcl...Full f
0230: 69 6c 65 76 65 6e 74 20 73 65 6d 61 74 69 63 73 ilevent sematics
0240: 20 73 68 6f 75 6c 64 20 61 6c 73 6f 20 62 65 20 should also be
0250: 69 6e 74 61 63 74 20 2d 20 73 65 65 20 74 65 73 intact - see tes
0260: 74 73 20 64 69 72 65 63 74 6f 72 79 20 66 6f 72 ts directory for
0270: 0a 62 6c 6f 63 6b 69 6e 67 20 61 6e 64 20 6e 6f .blocking and no
0280: 6e 2d 62 6c 6f 63 6b 69 6e 67 20 65 78 61 6d 70 n-blocking examp
0290: 6c 65 73 2e 0a 0a 54 68 65 20 63 75 72 72 65 6e les...The curren
02a0: 74 20 72 65 6c 65 61 73 65 20 69 73 20 54 4c 53 t release is TLS
02b0: 20 31 2e 36 2c 20 77 69 74 68 20 62 69 6e 61 72 1.6, with binar
02c0: 69 65 73 20 62 75 69 6c 74 20 61 67 61 69 6e 73 ies built agains
02d0: 74 20 4f 70 65 6e 53 53 4c 20 30 2e 39 2e 38 67 t OpenSSL 0.9.8g
02e0: 2e 0a 46 6f 72 20 62 65 73 74 20 73 65 63 75 72 ..For best secur
02f0: 69 74 79 20 61 6e 64 20 66 75 6e 63 74 69 6f 6e ity and function
0300: 2c 20 61 6c 77 61 79 73 20 63 6f 6d 70 69 6c 65 , always compile
0310: 20 66 72 6f 6d 20 73 6f 75 72 63 65 20 77 69 74 from source wit
0320: 68 20 74 68 65 20 6c 61 74 65 73 74 0a 6f 66 66 h the latest.off
0330: 69 63 69 61 6c 20 72 65 6c 65 61 73 65 20 6f 66 icial release of
0340: 20 4f 70 65 6e 53 53 4c 20 28 68 74 74 70 3a 2f OpenSSL (http:/
0350: 2f 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 /www.openssl.org
0360: 2f 29 2e 0a 0a 54 4c 53 20 72 65 71 75 69 72 65 /)...TLS require
0370: 73 20 54 63 6c 20 38 2e 32 2e 30 2b 2c 20 77 69 s Tcl 8.2.0+, wi
0380: 74 68 20 38 2e 33 2e 32 2b 20 70 72 65 66 65 72 th 8.3.2+ prefer
0390: 72 65 64 2e 20 20 54 68 65 20 73 74 61 63 6b 65 red. The stacke
03a0: 64 20 63 68 61 6e 6e 65 6c 0a 69 6d 70 6c 65 6d d channel.implem
03b0: 65 6e 74 61 74 69 6f 6e 20 69 6e 20 54 63 6c 20 entation in Tcl
03c0: 77 61 73 20 6f 72 69 67 69 6e 61 6c 6c 79 20 69 was originally i
03d0: 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 38 2e 32 ntroduced in 8.2
03e0: 2e 30 20 28 70 72 65 76 69 6f 75 73 6c 79 20 74 .0 (previously t
03f0: 68 65 0a 54 72 66 20 70 61 74 63 68 29 20 61 6e he.Trf patch) an
0400: 64 20 72 65 77 72 69 74 74 65 6e 20 66 6f 72 20 d rewritten for
0410: 38 2e 33 2e 32 2b 20 64 75 65 20 74 6f 20 69 6e 8.3.2+ due to in
0420: 68 65 72 65 6e 74 20 6c 69 6d 69 74 61 74 69 6f herent limitatio
0430: 6e 73 20 69 6e 20 74 68 65 0a 65 61 72 6c 69 65 ns in the.earlie
0440: 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e r implementation
0450: 2e 20 20 54 4c 53 20 73 68 6f 75 6c 64 20 63 6f . TLS should co
0460: 6d 70 69 6c 65 20 77 69 74 68 20 61 6e 79 20 73 mpile with any s
0470: 74 75 62 73 2d 63 61 70 61 62 6c 65 20 54 63 6c tubs-capable Tcl
0480: 0a 69 6e 74 65 72 70 72 65 74 65 72 2c 20 62 75 .interpreter, bu
0490: 74 20 77 69 6c 6c 20 72 65 71 75 69 72 65 20 38 t will require 8
04a0: 2e 32 2b 20 77 68 65 6e 20 6c 6f 61 64 65 64 2e .2+ when loaded.
04b0: 20 20 54 68 65 72 65 20 61 72 65 20 6b 6e 6f 77 There are know
04c0: 6e 0a 6c 69 6d 69 74 61 74 69 6f 6e 73 20 69 6e n.limitations in
04d0: 20 74 68 65 20 38 2e 32 2e 30 2d 38 2e 33 2e 31 the 8.2.0-8.3.1
04e0: 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c stacked channel
04f0: 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c implementation,
0500: 20 73 6f 20 69 74 20 69 73 0a 65 6e 63 6f 75 72 so it is.encour
0510: 61 67 65 64 20 74 68 61 74 20 70 65 6f 70 6c 65 aged that people
0520: 20 75 73 65 20 54 4c 53 20 77 69 74 68 20 61 6e use TLS with an
0530: 20 38 2e 33 2e 32 2b 20 54 63 6c 20 69 6e 74 65 8.3.2+ Tcl inte
0540: 72 70 72 65 74 65 72 2e 20 20 54 68 65 73 65 0a rpreter. These.
0550: 6d 6f 64 69 66 69 63 61 74 69 6f 6e 73 20 61 72 modifications ar
0560: 65 20 62 79 20 4a 65 66 66 20 48 6f 62 62 73 2e e by Jeff Hobbs.
0570: 0a 0a 4e 6f 6e 2d 65 78 63 6c 75 73 69 76 65 20 ..Non-exclusive
0580: 63 72 65 64 69 74 73 20 66 6f 72 20 54 4c 53 20 credits for TLS
0590: 61 72 65 3a 0a 20 20 20 4f 72 69 67 69 6e 61 6c are:. Original
05a0: 20 77 6f 72 6b 3a 20 4d 61 74 74 20 4e 65 77 6d work: Matt Newm
05b0: 61 6e 20 40 20 4e 6f 76 61 64 69 67 6d 0a 20 20 an @ Novadigm.
05c0: 20 55 70 64 61 74 65 73 3a 20 4a 65 66 66 20 48 Updates: Jeff H
05d0: 6f 62 62 73 20 40 20 41 63 74 69 76 65 53 74 61 obbs @ ActiveSta
05e0: 74 65 0a 20 20 20 54 63 6c 20 43 68 61 6e 6e 65 te. Tcl Channe
05f0: 6c 20 6d 65 63 68 61 6e 69 73 6d 3a 20 41 6e 64 l mechanism: And
0600: 72 65 61 73 20 4b 75 70 72 69 65 73 0a 20 20 20 reas Kupries.
0610: 49 6d 70 65 74 75 73 2f 52 65 6c 61 74 65 64 20 Impetus/Related
0620: 77 6f 72 6b 3a 20 74 63 6c 53 53 4c 20 28 43 6f work: tclSSL (Co
0630: 6c 69 6e 20 4d 63 43 6f 72 6d 61 63 6b 2c 20 53 lin McCormack, S
0640: 68 61 72 65 64 20 54 65 63 68 6e 6f 6c 6f 67 79 hared Technology
0650: 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ).
0660: 20 20 20 20 20 20 20 20 20 20 20 53 53 4c 74 63 SSLtc
0670: 6c 20 28 50 65 74 65 72 20 41 6e 74 6d 61 6e 29 l (Peter Antman)
0680: 0a 0a 54 68 69 73 20 63 6f 64 65 20 69 73 20 6c ..This code is l
0690: 69 63 65 6e 73 65 64 20 75 6e 64 65 72 20 74 68 icensed under th
06a0: 65 20 73 61 6d 65 20 74 65 72 6d 73 20 61 73 20 e same terms as
06b0: 74 68 65 20 54 63 6c 20 43 6f 72 65 2e 0a the Tcl Core..