Hex Artifact Content

Artifact 90bb6e0e94cf4d537b2278888bcfecc66bff37d3:


0000: 32 30 30 30 2d 30 38 2d 31 34 20 20 4a 65 66 66  2000-08-14  Jeff
0010: 20 48 6f 62 62 73 20 20 3c 68 6f 62 62 73 40 73   Hobbs  <hobbs@s
0020: 63 72 69 70 74 69 63 73 2e 63 6f 6d 3e 0a 0a 09  criptics.com>...
0030: 2a 20 74 6c 73 49 6e 74 2e 68 3a 0a 09 2a 20 74  * tlsInt.h:..* t
0040: 6c 73 49 4f 2e 63 3a 0a 09 2a 20 74 6c 73 42 49  lsIO.c:..* tlsBI
0050: 4f 2e 63 3a 0a 09 2a 20 74 6c 73 2e 63 3a 20 63  O.c:..* tls.c: c
0060: 68 61 6e 67 65 64 20 61 72 6f 75 6e 64 20 74 6f  hanged around to
0070: 20 6f 6e 6c 79 20 77 6f 72 6b 69 6e 67 20 77 69   only working wi
0080: 74 68 20 38 2e 32 2e 30 2b 20 28 38 2e 33 2e 32  th 8.2.0+ (8.3.2
0090: 2b 0a 09 70 72 65 66 65 72 72 65 64 29 2c 20 77  +..preferred), w
00a0: 69 74 68 20 72 75 6e 74 69 6d 65 20 63 68 65 63  ith runtime chec
00b0: 6b 73 20 66 6f 72 20 70 72 65 2d 20 61 6e 64 20  ks for pre- and 
00c0: 70 6f 73 74 2d 69 6f 2d 72 65 77 72 69 74 65 2e  post-io-rewrite.
00d0: 0a 0a 09 2a 20 74 6c 73 2e 63 20 28 54 6c 73 5f  ...* tls.c (Tls_
00e0: 49 6e 69 74 29 3a 20 63 68 61 6e 67 65 64 20 69  Init): changed i
00f0: 74 20 74 6f 20 72 65 71 75 69 72 65 20 38 2e 33  t to require 8.3
0100: 2e 32 20 77 68 65 6e 20 54 63 6c 5f 49 6e 69 74  .2 when Tcl_Init
0110: 53 74 75 62 73 0a 09 77 61 73 20 63 61 6c 6c 65  Stubs..was calle
0120: 64 20 62 65 63 61 75 73 65 20 77 65 20 64 6f 6e  d because we don
0130: 27 74 20 77 61 6e 74 20 70 65 6f 70 6c 65 20 75  't want people u
0140: 73 69 6e 67 20 54 4c 53 20 77 69 74 68 20 74 68  sing TLS with th
0150: 65 0a 09 6f 72 69 67 69 6e 61 6c 20 73 74 61 63  e..original stac
0160: 6b 65 64 20 63 68 61 6e 6e 65 6c 20 69 6d 70 6c  ked channel impl
0170: 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a 0a 32 30 30  ementation...200
0180: 30 2d 30 37 2d 32 36 20 20 4a 65 66 66 20 48 6f  0-07-26  Jeff Ho
0190: 62 62 73 20 20 3c 68 6f 62 62 73 40 73 63 72 69  bbs  <hobbs@scri
01a0: 70 74 69 63 73 2e 63 6f 6d 3e 0a 0a 09 2a 20 6d  ptics.com>...* m
01b0: 65 72 67 65 64 20 61 6c 6c 20 63 68 61 6e 67 65  erged all change
01c0: 73 20 66 72 6f 6d 20 74 6c 73 2d 31 2d 33 2d 69  s from tls-1-3-i
01d0: 6f 2d 72 65 77 72 69 74 65 20 62 61 63 6b 20 69  o-rewrite back i
01e0: 6e 74 6f 20 6d 61 69 6e 20 62 72 61 6e 63 68 0a  nto main branch.
01f0: 0a 09 2a 20 74 65 73 74 73 2f 74 6c 73 49 4f 2e  ..* tests/tlsIO.
0200: 74 65 73 74 3a 20 75 70 64 61 74 65 64 20 63 6f  test: updated co
0210: 6d 6d 65 6e 74 73 2c 20 66 69 78 65 64 20 61 20  mments, fixed a 
0220: 70 63 43 72 61 73 68 20 63 61 73 65 20 74 68 61  pcCrash case tha
0230: 74 0a 09 77 61 73 20 64 75 65 20 74 6f 20 64 65  t..was due to de
0240: 62 75 67 20 61 73 73 65 72 74 69 6f 6e 20 69 6e  bug assertion in
0250: 20 57 69 6e 64 6f 77 73 20 53 53 4c 2e 0a 0a 09   Windows SSL....
0260: 2a 20 74 6c 73 2e 63 20 28 49 6d 70 6f 72 74 4f  * tls.c (ImportO
0270: 62 6a 43 6d 64 29 3a 20 72 65 6d 6f 76 65 64 20  bjCmd): removed 
0280: 75 6e 6e 65 63 65 73 73 61 72 79 20 75 73 65 20  unnecessary use 
0290: 6f 66 20 27 62 69 6f 27 20 61 72 67 2e 0a 09 28  of 'bio' arg...(
02a0: 54 6c 73 5f 49 6e 69 74 29 3a 20 63 68 65 63 6b  Tls_Init): check
02b0: 20 72 65 74 75 72 6e 20 76 61 6c 75 65 20 6f 66   return value of
02c0: 20 53 53 4c 5f 6c 69 62 72 61 72 79 5f 69 6e 69   SSL_library_ini
02d0: 74 2e 20 20 41 6c 73 6f 20 6c 6f 74 73 20 6f 66  t.  Also lots of
02e0: 0a 09 77 68 69 74 65 73 70 61 63 65 20 63 6c 65  ..whitespace cle
02f0: 61 6e 75 70 20 28 6d 6f 72 65 20 6c 69 6b 65 20  anup (more like 
0300: 54 63 6c 20 45 6e 67 20 73 74 79 6c 65 20 67 75  Tcl Eng style gu
0310: 69 64 65 29 2c 20 62 75 74 20 6e 6f 74 20 61 6c  ide), but not al
0320: 6c 0a 09 63 6f 64 65 20 77 61 73 20 63 6c 65 61  l..code was clea
0330: 6e 65 64 20 75 70 2e 0a 0a 09 2a 20 74 6c 73 42  ned up....* tlsB
0340: 49 4f 2e 63 3a 20 6d 69 6e 6f 72 20 77 68 69 74  IO.c: minor whit
0350: 65 73 70 61 63 65 20 63 6c 65 61 6e 75 70 0a 0a  espace cleanup..
0360: 09 2a 20 74 6c 73 49 4f 2e 63 3a 20 6d 69 6e 6f  .* tlsIO.c: mino
0370: 72 20 77 68 69 74 65 73 70 61 63 65 20 63 6c 65  r whitespace cle
0380: 61 6e 75 70 2e 0a 09 28 54 6c 73 49 6e 70 75 74  anup...(TlsInput
0390: 50 72 6f 63 2c 20 54 6c 73 4f 75 74 70 75 74 50  Proc, TlsOutputP
03a0: 72 6f 63 29 3a 20 41 64 64 65 64 20 45 52 52 5f  roc): Added ERR_
03b0: 63 6c 65 61 72 5f 65 72 72 6f 72 20 62 65 66 6f  clear_error befo
03c0: 72 65 20 63 61 6c 6c 73 0a 09 74 6f 20 42 49 4f  re calls..to BIO
03d0: 5f 72 65 61 64 20 6f 72 20 42 49 4f 5f 77 72 69  _read or BIO_wri
03e0: 74 65 2c 20 62 65 63 61 75 73 65 20 77 65 20 63  te, because we c
03f0: 6f 75 6c 64 20 6f 74 68 65 72 77 69 73 65 20 65  ould otherwise e
0400: 6e 64 20 75 70 0a 09 70 75 6c 6c 69 6e 67 20 61  nd up..pulling a
0410: 6e 20 65 72 72 6f 72 20 6f 66 66 20 74 68 65 20  n error off the 
0420: 73 74 61 63 6b 20 74 68 61 74 20 64 69 64 6e 27  stack that didn'
0430: 74 20 62 65 6c 6f 6e 67 20 74 6f 20 75 73 2e 20  t belong to us. 
0440: 20 41 6c 73 6f 0a 09 63 6c 65 61 6e 75 70 20 75   Also..cleanup u
0450: 70 20 65 78 63 65 73 73 69 76 65 20 75 73 65 20  p excessive use 
0460: 6f 66 20 67 6f 74 6f 73 2e 0a 0a 32 30 30 30 2d  of gotos...2000-
0470: 30 37 2d 32 30 20 20 4a 65 66 66 20 48 6f 62 62  07-20  Jeff Hobb
0480: 73 20 20 3c 68 6f 62 62 73 40 73 63 72 69 70 74  s  <hobbs@script
0490: 69 63 73 2e 63 6f 6d 3e 0a 0a 09 2a 20 74 65 73  ics.com>...* tes
04a0: 74 73 2f 74 6c 73 49 4f 2e 74 65 73 74 3a 20 63  ts/tlsIO.test: c
04b0: 6f 72 72 65 63 74 65 64 20 76 61 72 69 6f 75 73  orrected various
04c0: 20 74 65 73 74 73 20 74 6f 20 62 65 20 63 6f 72   tests to be cor
04d0: 72 65 63 74 20 66 6f 72 20 54 4c 53 0a 09 73 74  rect for TLS..st
04e0: 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 73 20 28  acked channels (
04f0: 61 73 20 6f 70 70 6f 73 65 64 20 74 6f 20 74 68  as opposed to th
0500: 65 20 73 74 61 6e 64 61 72 64 20 73 6f 63 6b 65  e standard socke
0510: 74 73 20 74 68 65 20 74 65 73 74 0a 09 73 75 69  ts the test..sui
0520: 74 65 20 77 61 73 20 61 64 6f 70 74 65 64 20 66  te was adopted f
0530: 72 6f 6d 29 2e 20 20 4b 65 79 20 64 69 66 66 65  rom).  Key diffe
0540: 72 65 6e 63 65 73 20 61 72 65 20 74 68 61 74 20  rences are that 
0550: 54 4c 53 20 63 61 6e 6e 6f 74 0a 09 6f 70 65 72  TLS cannot..oper
0560: 61 74 65 20 69 6e 20 6f 6e 65 20 70 72 6f 63 65  ate in one proce
0570: 73 73 20 77 69 74 68 6f 75 74 20 61 6c 6c 20 63  ss without all c
0580: 68 61 6e 6e 65 6c 73 20 62 65 69 6e 67 20 6e 6f  hannels being no
0590: 6e 2d 62 6c 6f 63 6b 69 6e 67 2c 20 6f 72 0a 09  n-blocking, or..
05a0: 74 68 65 20 68 61 6e 64 73 68 61 6b 65 20 77 69  the handshake wi
05b0: 6c 6c 20 62 6c 6f 63 6b 2c 20 61 6e 64 20 68 61  ll block, and ha
05c0: 6e 64 73 68 61 6b 69 6e 67 20 6d 75 73 74 20 62  ndshaking must b
05d0: 65 20 66 6f 72 63 65 64 20 69 6e 20 73 6f 6d 65  e forced in some
05e0: 0a 09 63 61 73 65 73 2e 20 20 41 6c 73 6f 2c 20  ..cases.  Also, 
05f0: 68 61 6e 64 73 68 61 6b 65 73 20 64 6f 6e 27 74  handshakes don't
0600: 20 73 65 65 6d 20 74 6f 20 63 6f 6d 70 6c 65 74   seem to complet
0610: 65 20 75 6e 6c 65 73 73 20 74 68 65 20 63 6c 69  e unless the cli
0620: 65 6e 74 0a 09 68 61 73 20 70 6c 61 63 65 64 20  ent..has placed 
0630: 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 62 79 74  at least one byt
0640: 65 20 66 6f 72 20 74 68 65 20 73 65 72 76 65 72  e for the server
0650: 20 74 6f 20 72 65 61 64 20 69 6e 20 74 68 65 20   to read in the 
0660: 63 68 61 6e 6e 65 6c 2e 0a 0a 09 2a 20 74 65 73  channel....* tes
0670: 74 73 2f 72 65 6d 6f 74 65 2e 74 63 6c 3a 20 63  ts/remote.tcl: c
0680: 6f 72 72 65 63 74 65 64 20 74 68 65 20 66 69 6e  orrected the fin
0690: 64 69 6e 67 20 6f 66 20 74 65 73 74 73 20 63 65  ding of tests ce
06a0: 72 74 69 66 69 63 61 74 65 73 0a 0a 09 2a 20 74  rtificates...* t
06b0: 6c 73 49 4f 2e 63 20 28 54 6c 73 43 6c 6f 73 65  lsIO.c (TlsClose
06c0: 50 72 6f 63 29 3a 20 72 65 6d 6f 76 65 64 20 64  Proc): removed d
06d0: 65 6c 65 74 69 6e 67 20 6f 66 20 74 69 6d 65 72  eleting of timer
06e0: 20 68 61 6e 64 6c 65 72 20 61 73 0a 09 74 68 61   handler as..tha
06f0: 74 20 69 73 20 68 61 6e 64 6c 65 64 20 62 79 20  t is handled by 
0700: 54 6c 73 5f 43 6c 65 61 6e 2e 0a 0a 09 2a 20 74  Tls_Clean....* t
0710: 6c 73 2e 74 63 6c 20 28 74 6c 73 3a 3a 5f 61 63  ls.tcl (tls::_ac
0720: 63 65 70 74 29 3a 20 63 6f 72 72 65 63 74 65 64  cept): corrected
0730: 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 5f 61   the internal _a
0740: 63 63 65 70 74 20 74 6f 0a 09 74 72 69 63 6b 6c  ccept to..trickl
0750: 65 20 63 61 6c 6c 62 61 63 6b 20 65 72 72 6f 72  e callback error
0760: 73 20 74 6f 20 74 68 65 20 75 73 65 72 2e 0a 0a  s to the user...
0770: 09 2a 20 4d 61 6b 65 66 69 6c 65 2e 69 6e 3a 20  .* Makefile.in: 
0780: 6d 61 64 65 20 74 68 65 20 69 6e 73 74 61 6c 6c  made the install
0790: 2d 62 69 6e 61 72 69 65 73 20 74 61 72 67 65 74  -binaries target
07a0: 20 72 65 67 65 6e 65 72 61 74 65 20 74 68 65 0a   regenerate the.
07b0: 09 70 6b 67 49 6e 64 65 78 2e 74 63 6c 20 63 6f  .pkgIndex.tcl co
07c0: 72 72 65 63 74 6c 79 2e 20 20 54 68 65 20 74 65  rrectly.  The te
07d0: 73 74 20 74 61 72 67 65 74 20 70 72 6f 62 61 62  st target probab
07e0: 6c 79 20 73 68 6f 75 6c 64 6e 27 74 20 73 63 72  ly shouldn't scr
07f0: 65 77 0a 09 69 74 20 75 70 2c 20 62 75 74 20 74  ew..it up, but t
0800: 68 69 73 20 69 73 20 74 6f 20 62 65 20 6f 6e 20  his is to be on 
0810: 74 68 65 20 73 61 66 65 20 73 69 64 65 2e 0a 0a  the safe side...
0820: 32 30 30 30 2d 30 37 2d 31 37 20 20 4a 65 66 66  2000-07-17  Jeff
0830: 20 48 6f 62 62 73 20 20 3c 68 6f 62 62 73 40 73   Hobbs  <hobbs@s
0840: 63 72 69 70 74 69 63 73 2e 63 6f 6d 3e 0a 0a 09  criptics.com>...
0850: 2a 20 70 6b 67 49 6e 64 65 78 2e 74 63 6c 2e 69  * pkgIndex.tcl.i
0860: 6e 3a 0a 09 2a 20 63 6f 6e 66 69 67 75 72 65 2e  n:..* configure.
0870: 69 6e 3a 20 75 70 64 61 74 65 64 20 76 65 72 73  in: updated vers
0880: 69 6f 6e 20 74 6f 20 31 2e 34 0a 0a 32 30 30 30  ion to 1.4..2000
0890: 2d 30 37 2d 31 33 20 20 4a 65 66 66 20 48 6f 62  -07-13  Jeff Hob
08a0: 62 73 20 20 3c 68 6f 62 62 73 40 73 63 72 69 70  bs  <hobbs@scrip
08b0: 74 69 63 73 2e 63 6f 6d 3e 0a 0a 09 2a 20 74 65  tics.com>...* te
08c0: 73 74 73 2f 74 6c 73 49 4f 2e 74 65 73 74 3a 20  sts/tlsIO.test: 
08d0: 65 6e 61 62 6c 65 64 20 74 65 73 74 73 20 32 2e  enabled tests 2.
08e0: 31 30 2c 20 37 2e 5b 31 32 34 35 5d 20 28 74 68  10, 7.[1245] (th
08f0: 65 72 65 20 69 73 20 6e 6f 20 33 29 2c 0a 09 77  ere is no 3),..w
0900: 68 69 63 68 20 6e 6f 77 20 70 61 73 73 2e 20 20  hich now pass.  
0910: 41 64 64 65 64 20 73 6f 6d 65 20 63 6f 6d 6d 65  Added some comme
0920: 6e 74 73 20 74 6f 20 6f 74 68 65 72 20 66 61 69  nts to other fai
0930: 6c 69 6e 67 20 74 65 73 74 73 2e 0a 0a 32 30 30  ling tests...200
0940: 30 2d 30 37 2d 31 31 20 20 4a 65 66 66 20 48 6f  0-07-11  Jeff Ho
0950: 62 62 73 20 20 3c 68 6f 62 62 73 40 73 63 72 69  bbs  <hobbs@scri
0960: 70 74 69 63 73 2e 63 6f 6d 3e 0a 0a 09 2a 20 74  ptics.com>...* t
0970: 6c 73 49 4f 2e 63 3a 20 63 68 61 6e 67 65 64 20  lsIO.c: changed 
0980: 61 6c 6c 20 74 68 65 20 63 68 61 6e 6e 65 6c 20  all the channel 
0990: 70 72 6f 63 73 20 74 6f 20 73 74 61 72 74 20 77  procs to start w
09a0: 69 74 68 20 54 6c 73 2a 20 66 6f 72 0a 09 62 65  ith Tls* for..be
09b0: 74 74 65 72 20 70 61 72 69 74 79 20 77 68 65 6e  tter parity when
09c0: 20 63 6f 6d 70 61 72 69 6e 67 20 77 69 74 68 20   comparing with 
09d0: 54 72 61 6e 73 66 6f 72 6d 20 63 68 61 6e 6e 65  Transform channe
09e0: 6c 20 70 72 6f 63 73 2e 0a 09 52 65 77 72 6f 74  l procs...Rewrot
09f0: 65 20 54 6c 73 57 61 74 63 68 50 72 6f 63 2c 20  e TlsWatchProc, 
0a00: 61 64 64 65 64 20 54 6c 73 4e 6f 74 69 66 79 50  added TlsNotifyP
0a10: 72 6f 63 20 61 63 63 6f 72 64 69 6e 67 20 74 6f  roc according to
0a20: 20 74 68 65 20 6e 65 77 0a 09 63 68 61 6e 6e 65   the new..channe
0a30: 6c 20 64 65 73 69 67 6e 2c 20 77 68 69 63 68 20  l design, which 
0a40: 61 6c 73 6f 20 6c 65 61 76 65 73 20 54 6c 73 43  also leaves TlsC
0a50: 68 61 6e 6e 65 6c 48 61 6e 64 6c 65 72 20 75 6e  hannelHandler un
0a60: 75 73 65 64 2e 0a 0a 09 2a 20 74 6c 73 42 49 4f  used....* tlsBIO
0a70: 2e 63 20 28 42 69 6f 43 74 72 6c 29 3a 20 63 68  .c (BioCtrl): ch
0a80: 61 6e 67 65 64 20 42 49 4f 5f 43 54 52 4c 5f 46  anged BIO_CTRL_F
0a90: 4c 55 53 48 20 63 61 73 65 20 74 6f 20 75 73 65  LUSH case to use
0aa0: 0a 09 54 63 6c 5f 57 72 69 74 65 52 61 77 20 69  ..Tcl_WriteRaw i
0ab0: 6e 73 74 65 61 64 20 6f 66 20 54 63 6c 5f 46 6c  nstead of Tcl_Fl
0ac0: 75 73 68 20 28 74 6f 20 6f 70 65 72 61 74 65 20  ush (to operate 
0ad0: 6f 6e 20 63 6f 72 72 65 63 74 20 63 68 61 6e 6e  on correct chann
0ae0: 65 6c 0a 09 69 6e 20 74 68 65 20 73 74 61 63 6b  el..in the stack
0af0: 20 69 6e 73 74 65 61 64 20 6f 66 20 73 74 61 72   instead of star
0b00: 74 69 6e 67 20 61 74 20 74 68 65 20 74 6f 70 20  ting at the top 
0b10: 61 67 61 69 6e 29 2e 20 20 57 6f 75 6c 64 0a 09  again).  Would..
0b20: 6f 74 68 65 72 77 69 73 65 20 63 61 75 73 65 20  otherwise cause 
0b30: 61 20 72 65 63 75 72 73 69 76 65 20 73 74 61 63  a recursive stac
0b40: 6b 20 62 6f 6d 62 20 77 68 65 6e 20 69 6d 70 6c  k bomb when impl
0b50: 69 63 69 74 20 68 61 6e 64 73 68 61 6b 69 6e 67  icit handshaking
0b60: 0a 09 74 6f 6f 6b 20 65 66 66 65 63 74 2e 0a 0a  ..took effect...
0b70: 09 2a 20 74 65 73 74 73 2f 74 6c 73 49 4f 2e 74  .* tests/tlsIO.t
0b80: 65 73 74 3a 20 72 65 6d 6f 76 65 64 20 63 68 61  est: removed cha
0b90: 6e 67 65 73 20 6d 61 64 65 20 74 6f 20 74 65 73  nges made to tes
0ba0: 74 20 73 75 69 74 65 20 28 61 6c 6c 20 74 65 73  t suite (all tes
0bb0: 74 73 0a 09 74 68 61 74 20 72 61 6e 20 62 65 66  ts..that ran bef
0bc0: 6f 72 65 20 6e 6f 77 20 70 61 73 73 20 63 6f 72  ore now pass cor
0bd0: 72 65 63 74 6c 79 29 2c 20 61 6e 64 20 63 68 61  rectly), and cha
0be0: 6e 67 65 64 20 73 6f 6d 65 20 61 63 63 65 70 74  nged some accept
0bf0: 20 70 72 6f 63 0a 09 61 72 67 73 20 74 6f 20 72   proc..args to r
0c00: 65 66 6c 65 63 74 20 74 68 61 74 20 61 20 73 6f  eflect that a so
0c10: 63 6b 20 69 73 20 61 6e 20 61 72 67 2c 20 6e 6f  ck is an arg, no
0c20: 74 20 61 20 66 69 6c 65 2e 0a 0a 32 30 30 30 2d  t a file...2000-
0c30: 30 37 2d 31 30 20 20 4a 65 66 66 20 48 6f 62 62  07-10  Jeff Hobb
0c40: 73 20 20 3c 68 6f 62 62 73 40 73 63 72 69 70 74  s  <hobbs@script
0c50: 69 63 73 2e 63 6f 6d 3e 0a 0a 09 2a 20 74 6c 73  ics.com>...* tls
0c60: 42 49 4f 2e 63 20 28 42 69 6f 57 72 69 74 65 2c  BIO.c (BioWrite,
0c70: 20 42 69 6f 52 65 61 64 29 3a 20 63 68 61 6e 67   BioRead): chang
0c80: 65 64 20 54 63 6c 5f 52 65 61 64 2f 57 72 69 74  ed Tcl_Read/Writ
0c90: 65 20 74 6f 0a 09 54 63 6c 5f 52 65 61 64 52 61  e to..Tcl_ReadRa
0ca0: 77 2f 54 63 6c 57 72 69 74 65 52 61 77 2e 0a 0a  w/TclWriteRaw...
0cb0: 09 2a 20 74 6c 73 2e 63 3a 20 61 64 64 65 64 20  .* tls.c: added 
0cc0: 75 73 65 20 6f 66 20 54 63 6c 5f 47 65 74 54 6f  use of Tcl_GetTo
0cd0: 70 43 68 61 6e 6e 65 6c 20 61 66 74 65 72 20 54  pChannel after T
0ce0: 63 6c 5f 47 65 74 43 68 61 6e 6e 65 6c 20 61 6e  cl_GetChannel an
0cf0: 64 0a 09 67 6f 74 20 72 65 74 75 72 6e 20 76 61  d..got return va
0d00: 6c 75 65 20 66 72 6f 6d 20 54 63 6c 5f 53 74 61  lue from Tcl_Sta
0d10: 63 6b 43 68 61 6e 6e 65 6c 2e 0a 0a 09 2a 20 74  ckChannel....* t
0d20: 65 73 74 73 2f 74 6c 73 49 4f 2e 74 65 73 74 3a  ests/tlsIO.test:
0d30: 20 61 64 64 65 64 20 73 6f 6d 65 20 68 61 6e 64   added some hand
0d40: 73 68 61 6b 69 6e 67 20 74 68 61 74 20 73 68 6f  shaking that sho
0d50: 75 6c 64 6e 27 74 20 62 65 0a 09 6e 65 63 65 73  uldn't be..neces
0d60: 73 61 72 79 2c 20 62 75 74 20 77 65 20 63 72 61  sary, but we cra
0d70: 73 68 20 6f 74 68 65 72 77 69 73 65 20 28 6e 65  sh otherwise (ne
0d80: 65 64 73 20 6d 6f 72 65 20 74 65 73 74 69 6e 67  eds more testing
0d90: 29 2e 0a 0a 09 2a 20 74 6c 73 49 4f 2e 63 3a 20  )....* tlsIO.c: 
0da0: 61 64 64 65 64 20 73 75 70 70 6f 72 74 20 66 6f  added support fo
0db0: 72 20 22 63 6f 72 72 65 63 74 65 64 22 20 73 74  r "corrected" st
0dc0: 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 73 2e 20  acked channels. 
0dd0: 20 41 6c 6c 0a 09 74 68 65 20 61 62 6f 76 65 20   All..the above 
0de0: 63 68 61 6e 6e 65 6c 73 20 61 72 65 20 69 6e 20  channels are in 
0df0: 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53  TCL_CHANNEL_VERS
0e00: 49 4f 4e 5f 32 20 23 69 66 64 65 66 73 2e 0a 0a  ION_2 #ifdefs...
0e10: 32 30 30 30 2d 30 36 2d 30 35 20 20 53 63 6f 74  2000-06-05  Scot
0e20: 74 20 53 74 61 6e 74 6f 6e 20 20 3c 73 74 61 6e  t Stanton  <stan
0e30: 74 6f 6e 40 61 6a 75 62 61 73 6f 6c 75 74 69 6f  ton@ajubasolutio
0e40: 6e 73 2e 63 6f 6d 3e 0a 0a 09 2a 20 4d 61 6b 65  ns.com>...* Make
0e50: 66 69 6c 65 2e 69 6e 3a 20 46 69 78 65 64 20 62  file.in: Fixed b
0e60: 72 6f 6b 65 6e 20 74 65 73 74 20 74 61 72 67 65  roken test targe
0e70: 74 2e 0a 0a 09 2a 20 74 6c 73 49 6e 74 2e 68 3a  t....* tlsInt.h:
0e80: 20 0a 09 2a 20 74 6c 73 2e 63 3a 20 43 6c 65 61   ..* tls.c: Clea
0e90: 6e 65 64 20 75 70 20 64 65 63 6c 61 72 61 74 69  ned up declarati
0ea0: 6f 6e 73 20 6f 66 20 54 6c 73 5f 43 6c 65 61 6e  ons of Tls_Clean
0eb0: 20 74 6f 20 61 76 6f 69 64 20 65 72 72 6f 72 73   to avoid errors
0ec0: 20 6f 6e 0a 09 57 69 6e 64 6f 77 73 20 28 6c 69   on..Windows (li
0ed0: 6e 74 29 2e 0a 0a 32 30 30 30 2d 30 36 2d 30 35  nt)...2000-06-05
0ee0: 20 20 42 72 65 6e 74 20 57 65 6c 63 68 20 3c 77    Brent Welch <w
0ef0: 65 6c 63 68 40 61 6a 75 62 61 73 6f 6c 75 74 69  elch@ajubasoluti
0f00: 6f 6e 73 2e 63 6f 6d 3e 0a 0a 09 2a 20 74 6c 73  ons.com>...* tls
0f10: 2e 63 2c 20 74 6c 73 49 4f 2e 63 3a 20 20 53 70  .c, tlsIO.c:  Sp
0f20: 6c 69 74 20 54 6c 73 5f 46 72 65 65 20 69 6e 74  lit Tls_Free int
0f30: 6f 20 54 6c 73 5f 43 6c 65 61 6e 2c 20 77 68 69  o Tls_Clean, whi
0f40: 63 68 20 64 6f 65 73 0a 09 74 68 65 20 53 53 4c  ch does..the SSL
0f50: 20 63 6c 65 61 6e 75 70 2c 20 61 6e 64 20 74 68   cleanup, and th
0f60: 65 20 54 63 6c 5f 46 72 65 65 20 63 61 6c 6c 2e  e Tcl_Free call.
0f70: 20 20 49 74 20 69 73 20 69 6d 70 6f 72 74 61 6e    It is importan
0f80: 74 20 74 6f 20 73 68 75 74 64 6f 77 6e 0a 09 74  t to shutdown..t
0f90: 68 65 20 53 53 4c 20 73 74 61 74 65 20 22 73 79  he SSL state "sy
0fa0: 6e 63 68 72 6f 6e 6f 75 73 6c 79 22 20 64 75 72  nchronously" dur
0fb0: 69 6e 67 20 61 20 73 74 61 63 6b 65 64 20 66 6c  ing a stacked fl
0fc0: 75 73 68 2e 0a 0a 32 30 30 30 2d 30 36 2d 30 31  ush...2000-06-01
0fd0: 20 20 53 63 6f 74 74 20 53 74 61 6e 74 6f 6e 20    Scott Stanton 
0fe0: 20 3c 73 74 61 6e 74 6f 6e 40 61 6a 75 62 61 73   <stanton@ajubas
0ff0: 6f 6c 75 74 69 6f 6e 73 2e 63 6f 6d 3e 0a 0a 09  olutions.com>...
1000: 2a 20 74 6c 73 49 4f 2e 63 3a 20 52 65 73 74 6f  * tlsIO.c: Resto
1010: 72 65 64 20 63 61 6c 6c 20 74 6f 20 54 63 6c 5f  red call to Tcl_
1020: 4e 6f 74 69 66 79 43 68 61 6e 6e 65 6c 20 66 72  NotifyChannel fr
1030: 6f 6d 20 43 68 61 6e 6e 65 6c 48 61 6e 64 6c 65  om ChannelHandle
1040: 72 0a 09 74 6f 20 65 6e 73 75 72 65 20 74 68 61  r..to ensure tha
1050: 74 20 65 76 65 6e 74 73 20 70 72 6f 70 61 67 61  t events propaga
1060: 74 65 20 66 72 6f 6d 20 74 68 65 20 6c 6f 77 65  te from the lowe
1070: 72 20 64 72 69 76 65 72 2e 20 20 54 68 69 73 20  r driver.  This 
1080: 6d 61 79 0a 09 72 65 73 75 6c 74 20 69 6e 20 61  may..result in a
1090: 6e 20 69 6e 66 69 6e 69 74 65 20 6c 6f 6f 70 20  n infinite loop 
10a0: 69 6e 20 73 6f 6d 65 20 63 61 73 65 73 2c 20 73  in some cases, s
10b0: 6f 20 74 68 69 73 20 69 73 20 6e 6f 74 20 61 20  o this is not a 
10c0: 74 6f 74 61 6c 0a 09 66 69 78 2e 20 20 54 68 69  total..fix.  Thi
10d0: 73 20 6d 61 79 20 62 65 20 73 75 66 66 69 63 69  s may be suffici
10e0: 65 6e 74 20 66 6f 72 20 6e 6f 77 2c 20 68 6f 77  ent for now, how
10f0: 65 76 65 72 2e 20 5b 42 75 67 3a 20 35 36 32 33  ever. [Bug: 5623
1100: 5d 0a 0a 32 30 30 30 2d 30 36 2d 30 31 20 20 53  ]..2000-06-01  S
1110: 63 6f 74 74 20 53 74 61 6e 74 6f 6e 20 20 3c 73  cott Stanton  <s
1120: 74 61 6e 74 6f 6e 40 73 63 72 69 70 74 69 63 73  tanton@scriptics
1130: 2e 63 6f 6d 3e 0a 0a 09 2a 20 74 6c 73 49 4f 2e  .com>...* tlsIO.
1140: 63 3a 20 52 65 73 74 6f 72 65 20 74 68 65 20 70  c: Restore the p
1150: 72 65 76 69 6f 75 73 20 76 65 72 73 69 6f 6e 2e  revious version.
1160: 20 20 46 69 78 65 64 20 74 68 65 20 43 6c 6f 73    Fixed the Clos
1170: 65 50 72 6f 63 20 73 6f 0a 09 69 74 20 75 6e 72  eProc so..it unr
1180: 65 67 69 73 74 65 72 73 20 74 68 65 20 63 68 61  egisters the cha
1190: 6e 6e 65 6c 20 68 61 6e 64 6c 65 72 20 6f 6e 20  nnel handler on 
11a0: 74 68 65 20 73 75 70 65 72 63 65 64 65 64 20 63  the superceded c
11b0: 68 61 6e 6e 65 6c 0a 09 69 6e 73 74 65 61 64 20  hannel..instead 
11c0: 6f 66 20 74 68 65 20 75 70 70 65 72 20 63 68 61  of the upper cha
11d0: 6e 6e 65 6c 2e 20 41 6c 73 6f 20 72 65 6d 6f 76  nnel. Also remov
11e0: 65 64 20 74 68 65 20 63 61 6c 6c 20 74 6f 0a 09  ed the call to..
11f0: 54 63 6c 5f 4e 6f 74 69 66 79 43 68 61 6e 6e 65  Tcl_NotifyChanne
1200: 6c 20 69 6e 20 74 68 65 20 43 68 61 6e 6e 65 6c  l in the Channel
1210: 48 61 6e 64 6c 65 72 20 62 65 63 61 75 73 65 20  Handler because 
1220: 74 68 69 73 20 77 69 6c 6c 20 72 65 73 75 6c 74  this will result
1230: 0a 09 69 6e 20 61 6e 20 69 6e 66 69 6e 69 74 65  ..in an infinite
1240: 20 6c 6f 6f 70 20 69 66 20 64 61 74 61 20 69 73   loop if data is
1250: 20 65 76 65 72 20 62 75 66 66 65 72 65 64 20 69   ever buffered i
1260: 6e 20 74 68 65 20 42 49 4f 0a 09 73 74 72 75 63  n the BIO..struc
1270: 74 75 72 65 2e 20 5b 42 75 67 3a 20 35 36 32 33  ture. [Bug: 5623
1280: 5d 0a 0a 32 30 30 30 2d 30 35 2d 33 31 20 20 42  ]..2000-05-31  B
1290: 72 65 6e 74 20 57 65 6c 63 68 20 3c 77 65 6c 63  rent Welch <welc
12a0: 68 40 73 63 72 69 70 74 69 63 73 2e 63 6f 6d 3e  h@scriptics.com>
12b0: 0a 0a 09 2a 20 74 6c 73 2e 63 3a 20 43 68 61 6e  ...* tls.c: Chan
12c0: 67 65 20 74 68 65 20 43 68 61 6e 6e 65 6c 48 61  ge the ChannelHa
12d0: 6e 64 6c 65 72 20 74 6f 20 62 65 20 72 65 67 69  ndler to be regi
12e0: 73 74 65 72 65 64 20 6f 6e 20 74 68 65 20 6d 61  stered on the ma
12f0: 69 6e 0a 09 63 68 61 6e 6e 65 6c 20 61 73 20 6f  in..channel as o
1300: 70 70 73 65 64 20 74 6f 20 74 68 65 20 22 70 61  ppsed to the "pa
1310: 72 65 6e 74 22 2c 20 6f 72 20 73 75 70 65 72 63  rent", or superc
1320: 65 65 64 65 64 2c 20 63 68 61 6e 6e 65 6c 2e 20  eeded, channel. 
1330: 20 54 68 69 73 0a 09 69 73 20 62 65 63 61 75 73   This..is becaus
1340: 65 20 74 68 65 20 73 6f 63 6b 65 74 20 64 72 69  e the socket dri
1350: 76 65 72 20 6e 6f 74 69 66 69 65 73 20 74 68 65  ver notifies the
1360: 20 6d 61 69 6e 20 63 68 61 6e 6e 65 6c 2c 20 61   main channel, a
1370: 6e 64 20 74 68 65 72 65 0a 09 61 72 65 20 74 69  nd there..are ti
1380: 6d 65 73 20 77 69 74 68 20 74 68 65 20 6d 61 69  mes with the mai
1390: 6e 20 63 68 61 6e 6e 65 6c 20 67 65 74 73 20 63  n channel gets c
13a0: 6c 6f 73 65 64 2c 20 62 75 74 20 74 68 65 20 73  losed, but the s
13b0: 75 70 65 72 63 65 64 65 64 0a 09 6f 6e 65 20 69  uperceded..one i
13c0: 73 20 6e 6f 74 20 79 65 74 20 63 6c 6f 73 65 64  s not yet closed
13d0: 2e 20 20 49 66 20 74 68 65 20 63 68 61 6e 6e 65  .  If the channe
13e0: 6c 20 68 61 6e 64 6c 65 72 20 67 65 74 73 20 74  l handler gets t
13f0: 72 69 67 67 65 72 65 64 20 69 6e 0a 09 74 68 69  riggered in..thi
1400: 73 20 68 61 6c 66 2d 6f 70 65 6e 20 73 74 61 74  s half-open stat
1410: 65 20 69 74 20 69 73 20 61 73 73 6f 63 69 61 74  e it is associat
1420: 65 64 20 77 69 74 68 20 74 68 65 20 73 75 70 65  ed with the supe
1430: 72 63 65 65 64 65 64 0a 09 63 68 61 6e 6e 65 64  rceeded..channed
1440: 6c 2c 20 62 75 74 20 75 73 65 73 20 69 74 73 20  l, but uses its 
1450: 70 72 69 76 61 74 65 20 70 6f 69 6e 74 65 72 20  private pointer 
1460: 74 6f 20 74 68 65 20 6d 61 69 6e 20 63 68 61 6e  to the main chan
1470: 6e 65 6c 2c 20 77 68 69 63 68 0a 09 69 73 20 6d  nel, which..is m
1480: 6f 73 74 6c 79 20 64 65 73 74 72 6f 79 65 64 2e  ostly destroyed.
1490: 20 20 45 6c 69 6d 69 6e 61 74 65 64 20 74 68 65    Eliminated the
14a0: 20 72 65 64 75 6e 64 61 6e 74 20 63 61 6c 6c 20   redundant call 
14b0: 74 6f 0a 09 54 63 6c 5f 4e 6f 74 69 66 79 43 68  to..Tcl_NotifyCh
14c0: 61 6e 6e 65 6c 20 66 72 6f 6d 20 54 6c 73 57 61  annel from TlsWa
14d0: 74 63 68 50 72 6f 63 2e 20 5b 42 75 67 3a 20 35  tchProc. [Bug: 5
14e0: 36 32 33 5d 0a                                   623].