Hex Artifact Content

Artifact 5ce63231871d680d1e4dafc0c6748cbb1b23b9fd:


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 34 20 32 30  DME.txt,v 1.4 20
00b0: 30 33 2f 30 35 2f 31 35 20 32 30 3a 34 34 3a 34  03/05/15 20:44:4
00c0: 36 20 72 61 7a 7a 65 6c 6c 20 45 78 70 20 24 0a  6 razzell Exp $.
00d0: 0a 54 4c 53 20 28 61 6b 61 20 53 53 4c 29 20 43  .TLS (aka SSL) C
00e0: 68 61 6e 6e 65 6c 20 2d 20 63 61 6e 20 62 65 20  hannel - can be 
00f0: 6c 61 79 65 72 65 64 20 6f 6e 20 61 6e 79 20 62  layered on any b
0100: 69 2d 64 69 72 65 63 74 69 6f 6e 61 6c 20 54 63  i-directional Tc
0110: 6c 5f 43 68 61 6e 6e 65 6c 2e 0a 0a 42 6f 74 68  l_Channel...Both
0120: 20 63 6c 69 65 6e 74 20 61 6e 64 20 73 65 72 76   client and serv
0130: 65 72 2d 73 69 64 65 20 73 6f 63 6b 65 74 73 20  er-side sockets 
0140: 61 72 65 20 70 6f 73 73 69 62 6c 65 2c 20 61 6e  are possible, an
0150: 64 20 74 68 69 73 20 63 6f 64 65 20 73 68 6f 75  d this code shou
0160: 6c 64 20 77 6f 72 6b 0a 6f 6e 20 61 6e 79 20 70  ld work.on any p
0170: 6c 61 74 66 6f 72 6d 20 61 73 20 69 74 20 75 73  latform as it us
0180: 65 73 20 61 20 67 65 6e 65 72 69 63 20 6d 65 63  es a generic mec
0190: 68 61 6e 69 73 6d 20 66 6f 72 20 6c 61 79 65 72  hanism for layer
01a0: 69 6e 67 20 6f 6e 20 53 53 4c 20 61 6e 64 20 54  ing on SSL and T
01b0: 63 6c 2e 0a 0a 54 68 65 20 54 4c 53 20 31 2e 34  cl...The TLS 1.4
01c0: 20 72 65 6c 65 61 73 65 20 72 65 71 75 69 72 65   release require
01d0: 73 20 54 63 6c 20 38 2e 32 2e 30 2b 2c 20 77 69  s Tcl 8.2.0+, wi
01e0: 74 68 20 38 2e 33 2e 32 2b 20 70 72 65 66 65 72  th 8.3.2+ prefer
01f0: 72 65 64 2e 20 20 54 68 65 0a 73 74 61 63 6b 65  red.  The.stacke
0200: 64 20 63 68 61 6e 6e 65 6c 20 69 6d 70 6c 65 6d  d channel implem
0210: 65 6e 74 61 74 69 6f 6e 20 69 6e 20 54 63 6c 20  entation in Tcl 
0220: 77 61 73 20 6f 72 69 67 69 6e 61 6c 6c 79 20 69  was originally i
0230: 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 38 2e 32  ntroduced in 8.2
0240: 2e 30 0a 28 70 72 65 76 69 6f 75 73 6c 79 20 74  .0.(previously t
0250: 68 65 20 54 72 66 20 70 61 74 63 68 29 20 61 6e  he Trf patch) an
0260: 64 20 72 65 77 72 69 74 74 65 6e 20 66 6f 72 20  d rewritten for 
0270: 38 2e 33 2e 32 2b 20 64 75 65 20 74 6f 20 69 6e  8.3.2+ due to in
0280: 68 65 72 65 6e 74 0a 6c 69 6d 69 74 61 74 69 6f  herent.limitatio
0290: 6e 73 20 69 6e 20 74 68 65 20 65 61 72 6c 69 65  ns in the earlie
02a0: 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e  r implementation
02b0: 2e 20 20 54 4c 53 20 31 2e 34 20 73 68 6f 75 6c  .  TLS 1.4 shoul
02c0: 64 20 63 6f 6d 70 69 6c 65 20 77 69 74 68 0a 61  d compile with.a
02d0: 6e 79 20 73 74 75 62 73 2d 63 61 70 61 62 6c 65  ny stubs-capable
02e0: 20 54 63 6c 20 69 6e 74 65 72 70 72 65 74 65 72   Tcl interpreter
02f0: 2c 20 62 75 74 20 77 69 6c 6c 20 72 65 71 75 69  , but will requi
0300: 72 65 20 38 2e 32 2b 20 77 68 65 6e 20 6c 6f 61  re 8.2+ when loa
0310: 64 65 64 2e 0a 54 68 65 72 65 20 61 72 65 20 6b  ded..There are k
0320: 6e 6f 77 6e 20 6c 69 6d 69 74 61 74 69 6f 6e 73  nown limitations
0330: 20 69 6e 20 74 68 65 20 38 2e 32 2e 30 2d 38 2e   in the 8.2.0-8.
0340: 33 2e 31 20 73 74 61 63 6b 65 64 20 63 68 61 6e  3.1 stacked chan
0350: 6e 65 6c 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69  nel.implementati
0360: 6f 6e 2c 20 73 6f 20 69 74 20 69 73 20 65 6e 63  on, so it is enc
0370: 6f 75 72 61 67 65 64 20 74 68 61 74 20 70 65 6f  ouraged that peo
0380: 70 6c 65 20 75 73 65 20 54 4c 53 20 31 2e 34 2b  ple use TLS 1.4+
0390: 20 77 69 74 68 20 61 6e 0a 38 2e 33 2e 32 2b 20   with an.8.3.2+ 
03a0: 54 63 6c 20 69 6e 74 65 72 70 72 65 74 65 72 2e  Tcl interpreter.
03b0: 20 20 54 68 65 73 65 20 6d 6f 64 69 66 69 63 61    These modifica
03c0: 74 69 6f 6e 73 20 61 72 65 20 62 79 20 4a 65 66  tions are by Jef
03d0: 66 20 48 6f 62 62 73 0a 3c 6a 65 66 66 40 68 6f  f Hobbs.<jeff@ho
03e0: 62 62 73 2e 6f 72 67 3e 2e 0a 0a 46 75 6c 6c 20  bbs.org>...Full 
03f0: 66 69 6c 65 76 65 6e 74 20 73 65 6d 61 74 69 63  filevent sematic
0400: 73 20 73 68 6f 75 6c 64 20 61 6c 73 6f 20 62 65  s should also be
0410: 20 69 6e 74 61 63 74 20 2d 20 73 65 65 20 74 65   intact - see te
0420: 73 74 73 20 64 69 72 65 63 74 6f 72 79 20 66 6f  sts directory fo
0430: 72 0a 62 6c 6f 63 6b 69 6e 67 20 61 6e 64 20 6e  r.blocking and n
0440: 6f 6e 2d 62 6c 6f 63 6b 69 6e 67 20 65 78 61 6d  on-blocking exam
0450: 70 6c 65 73 2e 0a 0a 54 68 69 73 20 77 61 73 20  ples...This was 
0460: 62 75 69 6c 74 20 28 61 6c 6d 6f 73 74 29 20 66  built (almost) f
0470: 72 6f 6d 20 73 63 72 61 74 63 68 20 62 61 73 65  rom scratch base
0480: 64 20 75 70 6f 6e 20 6f 62 73 65 72 76 61 74 69  d upon observati
0490: 6f 6e 20 6f 66 20 4f 70 65 6e 53 53 4c 20 30 2e  on of OpenSSL 0.
04a0: 39 2e 32 62 2e 0a 46 6f 72 20 63 6f 72 72 65 63  9.2b..For correc
04b0: 74 20 66 75 6e 63 74 69 6f 6e 69 6e 67 2c 20 75  t functioning, u
04c0: 73 65 20 4f 70 65 6e 53 53 4c 20 30 2e 39 2e 36  se OpenSSL 0.9.6
04d0: 67 20 6f 72 20 6c 61 74 65 72 2e 20 20 54 68 69  g or later.  Thi
04e0: 73 20 72 65 6c 65 61 73 65 20 63 6f 6e 74 61 69  s release contai
04f0: 6e 73 0a 69 6d 70 6f 72 74 61 6e 74 20 66 69 78  ns.important fix
0500: 65 73 20 74 6f 20 6d 65 6d 6f 72 79 20 6d 61 6e  es to memory man
0510: 61 67 65 6d 65 6e 74 2c 20 61 73 20 77 65 6c 6c  agement, as well
0520: 20 61 73 20 69 6e 63 6f 72 70 6f 72 61 74 69 6e   as incorporatin
0530: 67 20 74 68 65 20 76 65 72 69 66 79 0a 63 61 6c  g the verify.cal
0540: 6c 62 61 63 6b 20 63 6f 72 72 65 63 74 69 6f 6e  lback correction
0550: 20 77 68 69 63 68 20 61 70 70 65 61 72 65 64 20   which appeared 
0560: 69 6e 20 4f 70 65 6e 53 53 4c 20 30 2e 39 2e 36  in OpenSSL 0.9.6
0570: 63 2e 20 20 46 6f 72 20 62 65 73 74 20 73 65 63  c.  For best sec
0580: 75 72 69 74 79 2c 20 75 73 65 0a 74 68 65 20 6c  urity, use.the l
0590: 61 74 65 73 74 20 6f 66 66 69 63 69 61 6c 20 72  atest official r
05a0: 65 6c 65 61 73 65 20 6f 66 20 4f 70 65 6e 53 53  elease of OpenSS
05b0: 4c 2e 0a 0a 41 64 64 69 74 69 6f 6e 20 63 72 65  L...Addition cre
05c0: 64 69 74 20 69 73 20 64 75 65 20 66 6f 72 20 41  dit is due for A
05d0: 6e 64 72 65 61 73 20 4b 75 70 72 69 65 73 20 28  ndreas Kupries (
05e0: 61 2e 6b 75 70 72 69 65 73 40 77 65 73 74 65 6e  a.kupries@westen
05f0: 64 2e 63 6f 6d 29 2c 20 66 6f 72 0a 70 72 6f 76  d.com), for.prov
0600: 69 64 69 6e 67 20 74 68 65 20 54 63 6c 5f 52 65  iding the Tcl_Re
0610: 70 6c 61 63 65 43 68 61 6e 6e 65 6c 20 6d 65 63  placeChannel mec
0620: 68 61 6e 69 73 6d 20 61 6e 64 20 77 6f 72 6b 69  hanism and worki
0630: 6e 67 20 63 6c 6f 73 65 6c 79 20 77 69 74 68 20  ng closely with 
0640: 6d 65 0a 74 6f 20 65 6e 68 61 6e 63 65 20 69 74  me.to enhance it
0650: 20 74 6f 20 73 75 70 70 6f 72 74 20 66 75 6c 6c   to support full
0660: 20 66 69 6c 65 65 76 65 6e 74 20 73 65 6d 61 6e   fileevent seman
0670: 74 69 63 73 2e 0a 0a 41 6c 73 6f 20 77 6f 72 6b  tics...Also work
0680: 20 64 6f 6e 65 20 62 79 20 74 68 65 20 66 6f 6c   done by the fol
0690: 6c 6f 77 20 70 65 6f 70 6c 65 20 70 72 6f 76 69  low people provi
06a0: 64 65 64 20 74 68 65 20 69 6d 70 65 74 75 73 20  ded the impetus 
06b0: 74 6f 20 64 6f 20 74 68 69 73 20 22 72 69 67 68  to do this "righ
06c0: 74 22 3a 2d 0a 74 63 6c 53 53 4c 20 28 43 6f 6c  t":-.tclSSL (Col
06d0: 69 6e 20 4d 63 43 6f 72 6d 61 63 6b 2c 20 53 68  in McCormack, Sh
06e0: 61 72 65 64 20 54 65 63 68 6e 6f 6c 6f 67 79 29  ared Technology)
06f0: 0a 53 53 4c 74 63 6c 20 28 50 65 74 65 72 20 41  .SSLtcl (Peter A
0700: 6e 74 6d 61 6e 29 0a 0a 54 68 69 73 20 63 6f 64  ntman)..This cod
0710: 65 20 69 73 20 6c 69 63 65 6e 73 65 64 20 75 6e  e is licensed un
0720: 64 65 72 20 74 68 65 20 73 61 6d 65 20 74 65 72  der the same ter
0730: 6d 73 20 61 73 20 74 68 65 20 54 63 6c 20 43 6f  ms as the Tcl Co
0740: 72 65 2e 0a 0a 49 20 77 6f 75 6c 64 20 61 6c 73  re...I would als
0750: 6f 20 6c 69 6b 65 20 74 6f 20 61 63 6b 6e 6f 77  o like to acknow
0760: 6c 65 64 67 65 20 74 68 65 20 69 6e 70 75 74 20  ledge the input 
0770: 6f 66 20 4d 61 72 73 68 61 6c 6c 20 52 6f 73 65  of Marshall Rose
0780: 2c 20 77 68 6f 20 63 6f 6e 76 69 6e 63 65 64 20  , who convinced 
0790: 0a 6d 65 20 74 68 61 74 20 70 65 6f 70 6c 65 20  .me that people 
07a0: 6e 65 65 64 20 74 6f 20 62 65 20 61 62 6c 65 20  need to be able 
07b0: 74 6f 20 73 77 69 74 63 68 2d 74 6f 2d 65 6e 63  to switch-to-enc
07c0: 72 79 70 74 65 64 20 6d 6f 64 65 20 70 61 72 74  rypted mode part
07d0: 20 77 61 79 0a 74 68 72 6f 75 67 68 20 61 20 63   way.through a c
07e0: 6f 6e 76 65 72 73 61 74 69 6f 6e 2e 0a 0a 41 6c  onversation...Al
07f0: 73 6f 20 49 20 77 6f 75 6c 64 20 6c 69 6b 65 20  so I would like 
0800: 74 6f 20 61 63 6b 6e 6f 77 6c 65 64 67 65 20 74  to acknowledge t
0810: 68 65 20 6b 69 6e 64 20 73 75 70 70 6f 72 74 20  he kind support 
0820: 6f 66 20 4e 6f 76 61 64 69 67 6d 20 49 6e 63 2c  of Novadigm Inc,
0830: 20 6d 79 0a 63 75 72 72 65 6e 74 20 65 6d 70 6c   my.current empl
0840: 6f 79 65 72 2c 20 77 68 69 63 68 20 6d 61 64 65  oyer, which made
0850: 20 74 68 69 73 20 70 6f 73 73 69 62 6c 65 2e 0a   this possible..
0860: 0a 0a 4d 61 74 74 20 4e 65 77 6d 61 6e 0a        ..Matt Newman.