Artifact
23eb5ff467b299f1493d9ffaa7c68d66963f0d62:
0000: 2f 2a 0a 20 2a 20 43 6f 70 79 72 69 67 68 74 20 /*. * Copyright
0010: 28 43 29 20 31 39 39 37 2d 32 30 30 30 20 4d 61 (C) 1997-2000 Ma
0020: 74 74 20 4e 65 77 6d 61 6e 20 3c 6d 61 74 74 40 tt Newman <matt@
0030: 6e 6f 76 61 64 69 67 6d 2e 63 6f 6d 3e 0a 20 2a novadigm.com>. *
0040: 0a 20 2a 20 24 48 65 61 64 65 72 3a 20 2f 68 6f . * $Header: /ho
0050: 6d 65 2f 72 6b 65 65 6e 65 2f 74 6d 70 2f 63 76 me/rkeene/tmp/cv
0060: 73 32 66 6f 73 73 69 6c 2f 2e 2e 2f 74 63 6c 74 s2fossil/../tclt
0070: 6c 73 2f 74 6c 73 2f 74 6c 73 2f 74 6c 73 49 6e ls/tls/tls/tlsIn
0080: 74 2e 68 2c 76 20 31 2e 31 33 20 32 30 30 34 2f t.h,v 1.13 2004/
0090: 30 36 2f 32 39 20 31 30 3a 35 38 3a 30 38 20 70 06/29 10:58:08 p
00a0: 61 74 74 68 6f 79 74 73 20 45 78 70 20 24 0a 20 atthoyts Exp $.
00b0: 2a 0a 20 2a 20 54 4c 53 20 28 61 6b 61 20 53 53 *. * TLS (aka SS
00c0: 4c 29 20 43 68 61 6e 6e 65 6c 20 2d 20 63 61 6e L) Channel - can
00d0: 20 62 65 20 6c 61 79 65 72 65 64 20 6f 6e 20 61 be layered on a
00e0: 6e 79 20 62 69 2d 64 69 72 65 63 74 69 6f 6e 61 ny bi-directiona
00f0: 6c 0a 20 2a 20 54 63 6c 5f 43 68 61 6e 6e 65 6c l. * Tcl_Channel
0100: 20 28 4e 6f 74 65 3a 20 52 65 71 75 69 72 65 73 (Note: Requires
0110: 20 54 72 66 20 43 6f 72 65 20 50 61 74 63 68 29 Trf Core Patch)
0120: 0a 20 2a 0a 20 2a 20 54 68 69 73 20 77 61 73 20 . *. * This was
0130: 62 75 69 6c 74 20 66 72 6f 6d 20 73 63 72 61 74 built from scrat
0140: 63 68 20 62 61 73 65 64 20 75 70 6f 6e 20 6f 62 ch based upon ob
0150: 73 65 72 76 61 74 69 6f 6e 20 6f 66 20 4f 70 65 servation of Ope
0160: 6e 53 53 4c 20 30 2e 39 2e 32 42 0a 20 2a 0a 20 nSSL 0.9.2B. *.
0170: 2a 20 41 64 64 69 74 69 6f 6e 20 63 72 65 64 69 * Addition credi
0180: 74 20 69 73 20 64 75 65 20 66 6f 72 20 41 6e 64 t is due for And
0190: 72 65 61 73 20 4b 75 70 72 69 65 73 20 28 61 2e reas Kupries (a.
01a0: 6b 75 70 72 69 65 73 40 77 65 73 74 65 6e 64 2e kupries@westend.
01b0: 63 6f 6d 29 2c 20 66 6f 72 0a 20 2a 20 70 72 6f com), for. * pro
01c0: 76 69 64 69 6e 67 20 74 68 65 20 54 63 6c 5f 52 viding the Tcl_R
01d0: 65 70 6c 61 63 65 43 68 61 6e 6e 65 6c 20 6d 65 eplaceChannel me
01e0: 63 68 61 6e 69 73 6d 20 61 6e 64 20 77 6f 72 6b chanism and work
01f0: 69 6e 67 20 63 6c 6f 73 65 6c 79 20 77 69 74 68 ing closely with
0200: 20 6d 65 0a 20 2a 20 74 6f 20 65 6e 68 61 6e 63 me. * to enhanc
0210: 65 20 69 74 20 74 6f 20 73 75 70 70 6f 72 74 20 e it to support
0220: 66 75 6c 6c 20 66 69 6c 65 65 76 65 6e 74 20 73 full fileevent s
0230: 65 6d 61 6e 74 69 63 73 2e 0a 20 2a 0a 20 2a 20 emantics.. *. *
0240: 41 6c 73 6f 20 77 6f 72 6b 20 64 6f 6e 65 20 62 Also work done b
0250: 79 20 74 68 65 20 66 6f 6c 6c 6f 77 20 70 65 6f y the follow peo
0260: 70 6c 65 20 70 72 6f 76 69 64 65 64 20 74 68 65 ple provided the
0270: 20 69 6d 70 65 74 75 73 20 74 6f 20 64 6f 20 74 impetus to do t
0280: 68 69 73 20 22 72 69 67 68 74 22 3a 2d 0a 20 2a his "right":-. *
0290: 09 74 63 6c 53 53 4c 20 28 43 6f 6c 69 6e 20 4d .tclSSL (Colin M
02a0: 63 43 6f 72 6d 61 63 6b 2c 20 53 68 61 72 65 64 cCormack, Shared
02b0: 20 54 65 63 68 6e 6f 6c 6f 67 79 29 0a 20 2a 09 Technology). *.
02c0: 53 53 4c 74 63 6c 20 28 50 65 74 65 72 20 41 6e SSLtcl (Peter An
02d0: 74 6d 61 6e 29 0a 20 2a 0a 20 2a 2f 0a 23 69 66 tman). *. */.#if
02e0: 6e 64 65 66 20 5f 54 53 4c 49 4e 54 5f 48 0a 23 ndef _TSLINT_H.#
02f0: 64 65 66 69 6e 65 20 5f 54 4c 53 49 4e 54 5f 48 define _TLSINT_H
0300: 0a 0a 23 69 6e 63 6c 75 64 65 20 22 74 6c 73 2e ..#include "tls.
0310: 68 22 0a 23 69 6e 63 6c 75 64 65 20 3c 65 72 72 h".#include <err
0320: 6e 6f 2e 68 3e 0a 23 69 6e 63 6c 75 64 65 20 3c no.h>.#include <
0330: 73 74 72 69 6e 67 2e 68 3e 0a 0a 23 69 66 64 65 string.h>..#ifde
0340: 66 20 57 49 4e 33 32 0a 23 64 65 66 69 6e 65 20 f WIN32.#define
0350: 57 49 4e 33 32 5f 4c 45 41 4e 5f 41 4e 44 5f 4d WIN32_LEAN_AND_M
0360: 45 41 4e 0a 23 69 6e 63 6c 75 64 65 20 3c 77 69 EAN.#include <wi
0370: 6e 64 6f 77 73 2e 68 3e 0a 23 69 6e 63 6c 75 64 ndows.h>.#includ
0380: 65 20 3c 77 69 6e 63 72 79 70 74 2e 68 3e 20 2f e <wincrypt.h> /
0390: 2a 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73 20 * OpenSSL needs
03a0: 74 68 69 73 20 6f 6e 20 57 69 6e 64 6f 77 73 20 this on Windows
03b0: 2a 2f 0a 23 65 6e 64 69 66 0a 0a 23 69 66 64 65 */.#endif..#ifde
03c0: 66 20 4e 4f 5f 50 41 54 45 4e 54 53 0a 23 64 65 f NO_PATENTS.#de
03d0: 66 69 6e 65 20 4e 4f 5f 49 44 45 41 0a 23 64 65 fine NO_IDEA.#de
03e0: 66 69 6e 65 20 4e 4f 5f 52 43 32 0a 23 64 65 66 fine NO_RC2.#def
03f0: 69 6e 65 20 4e 4f 5f 52 43 34 0a 23 64 65 66 69 ine NO_RC4.#defi
0400: 6e 65 20 4e 4f 5f 52 43 35 0a 23 64 65 66 69 6e ne NO_RC5.#defin
0410: 65 20 4e 4f 5f 52 53 41 0a 23 64 65 66 69 6e 65 e NO_RSA.#define
0420: 20 4e 4f 5f 53 53 4c 32 0a 23 65 6e 64 69 66 0a NO_SSL2.#endif.
0430: 0a 23 69 66 64 65 66 20 42 53 41 46 45 0a 23 69 .#ifdef BSAFE.#i
0440: 6e 63 6c 75 64 65 20 3c 73 73 6c 2e 68 3e 0a 23 nclude <ssl.h>.#
0450: 69 6e 63 6c 75 64 65 20 3c 65 72 72 2e 68 3e 0a include <err.h>.
0460: 23 69 6e 63 6c 75 64 65 20 3c 72 61 6e 64 2e 68 #include <rand.h
0470: 3e 0a 23 65 6c 73 65 0a 23 69 6e 63 6c 75 64 65 >.#else.#include
0480: 20 3c 6f 70 65 6e 73 73 6c 2f 73 73 6c 2e 68 3e <openssl/ssl.h>
0490: 0a 23 69 6e 63 6c 75 64 65 20 3c 6f 70 65 6e 73 .#include <opens
04a0: 73 6c 2f 65 72 72 2e 68 3e 0a 23 69 6e 63 6c 75 sl/err.h>.#inclu
04b0: 64 65 20 3c 6f 70 65 6e 73 73 6c 2f 72 61 6e 64 de <openssl/rand
04c0: 2e 68 3e 0a 23 65 6e 64 69 66 0a 0a 23 69 66 64 .h>.#endif..#ifd
04d0: 65 66 20 54 43 4c 5f 53 54 4f 52 41 47 45 5f 43 ef TCL_STORAGE_C
04e0: 4c 41 53 53 0a 23 20 75 6e 64 65 66 20 54 43 4c LASS.# undef TCL
04f0: 5f 53 54 4f 52 41 47 45 5f 43 4c 41 53 53 0a 23 _STORAGE_CLASS.#
0500: 65 6e 64 69 66 0a 23 69 66 64 65 66 20 42 55 49 endif.#ifdef BUI
0510: 4c 44 5f 74 6c 73 0a 23 20 64 65 66 69 6e 65 20 LD_tls.# define
0520: 54 43 4c 5f 53 54 4f 52 41 47 45 5f 43 4c 41 53 TCL_STORAGE_CLAS
0530: 53 20 44 4c 4c 45 58 50 4f 52 54 0a 23 65 6c 73 S DLLEXPORT.#els
0540: 65 0a 23 20 64 65 66 69 6e 65 20 54 43 4c 5f 53 e.# define TCL_S
0550: 54 4f 52 41 47 45 5f 43 4c 41 53 53 20 44 4c 4c TORAGE_CLASS DLL
0560: 49 4d 50 4f 52 54 0a 23 65 6e 64 69 66 0a 20 0a IMPORT.#endif. .
0570: 23 69 66 6e 64 65 66 20 45 43 4f 4e 4e 41 42 4f #ifndef ECONNABO
0580: 52 54 45 44 0a 23 64 65 66 69 6e 65 20 45 43 4f RTED.#define ECO
0590: 4e 4e 41 42 4f 52 54 45 44 09 31 33 30 09 2f 2a NNABORTED.130./*
05a0: 20 53 6f 66 74 77 61 72 65 20 63 61 75 73 65 64 Software caused
05b0: 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 61 62 6f 72 connection abor
05c0: 74 20 2a 2f 0a 23 65 6e 64 69 66 0a 23 69 66 6e t */.#endif.#ifn
05d0: 64 65 66 20 45 43 4f 4e 4e 52 45 53 45 54 0a 23 def ECONNRESET.#
05e0: 64 65 66 69 6e 65 20 45 43 4f 4e 4e 52 45 53 45 define ECONNRESE
05f0: 54 09 31 33 31 09 2f 2a 20 43 6f 6e 6e 65 63 74 T.131./* Connect
0600: 69 6f 6e 20 72 65 73 65 74 20 62 79 20 70 65 65 ion reset by pee
0610: 72 20 2a 2f 0a 23 65 6e 64 69 66 0a 0a 23 69 66 r */.#endif..#if
0620: 64 65 66 20 44 45 42 55 47 0a 23 64 65 66 69 6e def DEBUG.#defin
0630: 65 20 64 70 72 69 6e 74 66 20 66 70 72 69 6e 74 e dprintf fprint
0640: 66 0a 23 65 6c 73 65 0a 23 64 65 66 69 6e 65 20 f.#else.#define
0650: 64 70 72 69 6e 74 66 20 69 66 20 28 30 29 20 66 dprintf if (0) f
0660: 70 72 69 6e 74 66 0a 23 65 6e 64 69 66 0a 0a 23 printf.#endif..#
0670: 64 65 66 69 6e 65 20 53 53 4c 5f 45 52 52 4f 52 define SSL_ERROR
0680: 28 73 73 6c 2c 65 72 72 29 09 5c 0a 20 20 20 20 (ssl,err).\.
0690: 28 28 63 68 61 72 2a 29 45 52 52 5f 72 65 61 73 ((char*)ERR_reas
06a0: 6f 6e 5f 65 72 72 6f 72 5f 73 74 72 69 6e 67 28 on_error_string(
06b0: 28 75 6e 73 69 67 6e 65 64 20 6c 6f 6e 67 29 53 (unsigned long)S
06c0: 53 4c 5f 67 65 74 5f 65 72 72 6f 72 28 28 73 73 SL_get_error((ss
06d0: 6c 29 2c 28 65 72 72 29 29 29 29 0a 2f 2a 0a 20 l),(err))))./*.
06e0: 2a 20 4f 70 65 6e 53 53 4c 20 42 49 4f 20 52 6f * OpenSSL BIO Ro
06f0: 75 74 69 6e 65 73 0a 20 2a 2f 0a 23 64 65 66 69 utines. */.#defi
0700: 6e 65 20 42 49 4f 5f 54 59 50 45 5f 54 43 4c 09 ne BIO_TYPE_TCL.
0710: 28 31 39 7c 30 78 30 34 30 30 29 0a 0a 2f 2a 0a (19|0x0400)../*.
0720: 20 2a 20 44 65 66 69 6e 65 73 20 66 6f 72 20 53 * Defines for S
0730: 74 61 74 65 2e 66 6c 61 67 73 0a 20 2a 2f 0a 23 tate.flags. */.#
0740: 64 65 66 69 6e 65 20 54 4c 53 5f 54 43 4c 5f 41 define TLS_TCL_A
0750: 53 59 4e 43 09 28 31 3c 3c 30 29 09 2f 2a 20 6e SYNC.(1<<0)./* n
0760: 6f 6e 2d 62 6c 6f 63 6b 69 6e 67 20 6d 6f 64 65 on-blocking mode
0770: 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 4c 53 5f */.#define TLS_
0780: 54 43 4c 5f 53 45 52 56 45 52 09 28 31 3c 3c 31 TCL_SERVER.(1<<1
0790: 29 09 2f 2a 20 53 65 72 76 65 72 2d 53 69 64 65 )./* Server-Side
07a0: 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 4c 53 5f */.#define TLS_
07b0: 54 43 4c 5f 49 4e 49 54 09 28 31 3c 3c 32 29 09 TCL_INIT.(1<<2).
07c0: 2f 2a 20 49 6e 69 74 69 61 6c 69 7a 69 6e 67 20 /* Initializing
07d0: 63 6f 6e 6e 65 63 74 69 6f 6e 20 2a 2f 0a 23 64 connection */.#d
07e0: 65 66 69 6e 65 20 54 4c 53 5f 54 43 4c 5f 44 45 efine TLS_TCL_DE
07f0: 42 55 47 09 28 31 3c 3c 33 29 09 2f 2a 20 53 68 BUG.(1<<3)./* Sh
0800: 6f 77 20 64 65 62 75 67 20 74 72 61 63 69 6e 67 ow debug tracing
0810: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 4c 53 */..#define TLS
0820: 5f 54 43 4c 5f 44 45 4c 41 59 20 28 35 29 0a 0a _TCL_DELAY (5)..
0830: 2f 2a 0a 20 2a 20 54 68 69 73 20 73 74 72 75 63 /*. * This struc
0840: 74 75 72 65 20 64 65 73 63 72 69 62 65 73 20 74 ture describes t
0850: 68 65 20 70 65 72 2d 69 6e 73 74 61 6e 63 65 20 he per-instance
0860: 73 74 61 74 65 0a 20 2a 20 6f 66 20 61 6e 20 73 state. * of an s
0870: 73 6c 20 63 68 61 6e 6e 65 6c 2e 0a 20 2a 0a 20 sl channel.. *.
0880: 2a 20 54 68 65 20 53 53 4c 20 70 72 6f 63 65 73 * The SSL proces
0890: 73 69 6e 67 20 63 6f 6e 74 65 78 74 20 69 73 20 sing context is
08a0: 6d 61 69 6e 74 61 69 6e 65 64 20 68 65 72 65 2c maintained here,
08b0: 20 69 6e 20 74 68 65 20 43 6c 69 65 6e 74 44 61 in the ClientDa
08c0: 74 61 0a 20 2a 2f 0a 74 79 70 65 64 65 66 20 73 ta. */.typedef s
08d0: 74 72 75 63 74 20 53 74 61 74 65 20 7b 0a 20 20 truct State {.
08e0: 20 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 73 65 Tcl_Channel se
08f0: 6c 66 3b 09 2f 2a 20 74 68 69 73 20 73 6f 63 6b lf;./* this sock
0900: 65 74 20 63 68 61 6e 6e 65 6c 20 2a 2f 0a 20 20 et channel */.
0910: 20 20 54 63 6c 5f 54 69 6d 65 72 54 6f 6b 65 6e Tcl_TimerToken
0920: 20 74 69 6d 65 72 3b 0a 0a 20 20 20 20 69 6e 74 timer;.. int
0930: 20 66 6c 61 67 73 3b 09 09 2f 2a 20 63 75 72 72 flags;../* curr
0940: 65 6e 74 6c 79 20 6f 6e 6c 79 20 43 48 41 4e 4e ently only CHANN
0950: 45 4c 5f 41 53 59 4e 43 20 2a 2f 0a 20 20 20 20 EL_ASYNC */.
0960: 69 6e 74 20 77 61 74 63 68 4d 61 73 6b 3b 09 2f int watchMask;./
0970: 2a 20 63 75 72 72 65 6e 74 20 57 61 74 63 68 50 * current WatchP
0980: 72 6f 63 20 6d 61 73 6b 20 2a 2f 0a 20 20 20 20 roc mask */.
0990: 69 6e 74 20 6d 6f 64 65 3b 09 09 2f 2a 20 63 75 int mode;../* cu
09a0: 72 72 65 6e 74 20 6d 6f 64 65 20 6f 66 20 70 61 rrent mode of pa
09b0: 72 65 6e 74 20 63 68 61 6e 6e 65 6c 20 2a 2f 0a rent channel */.
09c0: 0a 20 20 20 20 54 63 6c 5f 49 6e 74 65 72 70 20 . Tcl_Interp
09d0: 2a 69 6e 74 65 72 70 3b 09 2f 2a 20 69 6e 74 65 *interp;./* inte
09e0: 72 70 72 65 74 65 72 20 69 6e 20 77 68 69 63 68 rpreter in which
09f0: 20 74 68 69 73 20 72 65 73 69 64 65 73 20 2a 2f this resides */
0a00: 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 63 61 . Tcl_Obj *ca
0a10: 6c 6c 62 61 63 6b 3b 09 2f 2a 20 73 63 72 69 70 llback;./* scrip
0a20: 74 20 63 61 6c 6c 65 64 20 66 6f 72 20 74 72 61 t called for tra
0a30: 63 69 6e 67 2c 20 76 65 72 69 66 79 69 6e 67 20 cing, verifying
0a40: 61 6e 64 20 65 72 72 6f 72 73 20 2a 2f 0a 20 20 and errors */.
0a50: 20 20 54 63 6c 5f 4f 62 6a 20 2a 70 61 73 73 77 Tcl_Obj *passw
0a60: 6f 72 64 3b 09 2f 2a 20 73 63 72 69 70 74 20 63 ord;./* script c
0a70: 61 6c 6c 65 64 20 66 6f 72 20 63 65 72 74 69 66 alled for certif
0a80: 69 63 61 74 65 20 70 61 73 73 77 6f 72 64 20 2a icate password *
0a90: 2f 20 0a 0a 20 20 20 20 69 6e 74 20 76 66 6c 61 / .. int vfla
0aa0: 67 73 3b 09 09 2f 2a 20 76 65 72 69 66 79 20 66 gs;../* verify f
0ab0: 6c 61 67 73 20 2a 2f 0a 20 20 20 20 53 53 4c 20 lags */. SSL
0ac0: 2a 73 73 6c 3b 09 09 2f 2a 20 53 74 72 75 63 74 *ssl;../* Struct
0ad0: 20 66 6f 72 20 53 53 4c 20 70 72 6f 63 65 73 73 for SSL process
0ae0: 69 6e 67 20 2a 2f 0a 20 20 20 20 53 53 4c 5f 43 ing */. SSL_C
0af0: 54 58 20 2a 63 74 78 3b 09 2f 2a 20 53 53 4c 20 TX *ctx;./* SSL
0b00: 43 6f 6e 74 65 78 74 20 2a 2f 0a 20 20 20 20 42 Context */. B
0b10: 49 4f 20 2a 62 69 6f 3b 09 09 2f 2a 20 53 74 72 IO *bio;../* Str
0b20: 75 63 74 20 66 6f 72 20 53 53 4c 20 70 72 6f 63 uct for SSL proc
0b30: 65 73 73 69 6e 67 20 2a 2f 0a 20 20 20 20 42 49 essing */. BI
0b40: 4f 20 2a 70 5f 62 69 6f 3b 09 09 2f 2a 20 50 61 O *p_bio;../* Pa
0b50: 72 65 6e 74 20 42 49 4f 20 28 74 68 61 74 20 69 rent BIO (that i
0b60: 73 20 6c 61 79 65 72 65 64 20 6f 6e 20 54 63 6c s layered on Tcl
0b70: 5f 43 68 61 6e 6e 65 6c 29 20 2a 2f 0a 0a 20 20 _Channel) */..
0b80: 20 20 63 68 61 72 20 2a 65 72 72 3b 0a 7d 20 53 char *err;.} S
0b90: 74 61 74 65 3b 0a 0a 2f 2a 0a 20 2a 20 54 68 65 tate;../*. * The
0ba0: 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e following defin
0bb0: 69 74 69 6f 6e 73 20 68 61 76 65 20 74 6f 20 62 itions have to b
0bc0: 65 20 75 73 61 62 6c 65 20 66 6f 72 20 38 2e 32 e usable for 8.2
0bd0: 2e 30 2d 38 2e 33 2e 31 20 61 6e 64 20 38 2e 33 .0-8.3.1 and 8.3
0be0: 2e 32 2b 2e 0a 20 2a 20 54 68 65 20 64 69 66 66 .2+.. * The diff
0bf0: 65 72 65 6e 63 65 73 20 62 65 74 77 65 65 6e 20 erences between
0c00: 74 68 65 73 65 20 76 65 72 73 69 6f 6e 73 3a 0a these versions:.
0c10: 20 2a 0a 20 2a 20 38 2e 30 2d 38 2e 31 3a 09 54 *. * 8.0-8.1:.T
0c20: 68 65 72 65 20 69 73 20 6e 6f 20 73 75 70 70 6f here is no suppo
0c30: 72 74 20 66 6f 72 20 74 68 65 73 65 20 69 6e 20 rt for these in
0c40: 54 4c 53 20 31 2e 34 20 28 67 65 74 20 31 2e 33 TLS 1.4 (get 1.3
0c50: 29 2e 20 20 54 68 69 73 0a 20 2a 09 09 77 61 73 ). This. *..was
0c60: 20 74 68 65 20 76 65 72 73 69 6f 6e 20 77 69 74 the version wit
0c70: 68 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 70 h the original p
0c80: 61 74 63 68 2e 0a 20 2a 0a 20 2a 20 38 2e 32 2e atch.. *. * 8.2.
0c90: 30 2d 09 43 68 61 6e 67 65 64 20 73 65 6d 61 6e 0-.Changed seman
0ca0: 74 69 63 73 20 66 6f 72 20 54 63 6c 5f 53 74 61 tics for Tcl_Sta
0cb0: 63 6b 43 68 61 6e 6e 65 6c 20 28 54 63 6c 5f 52 ckChannel (Tcl_R
0cc0: 65 70 6c 61 63 65 43 68 61 6e 6e 65 6c 29 2e 0a eplaceChannel)..
0cd0: 20 2a 20 38 2e 33 2e 31 3a 09 43 68 65 63 6b 20 * 8.3.1:.Check
0ce0: 61 74 20 72 75 6e 74 69 6d 65 20 74 6f 20 73 77 at runtime to sw
0cf0: 69 74 63 68 20 74 68 65 20 62 65 68 61 76 69 6f itch the behavio
0d00: 75 72 2e 20 54 68 65 20 70 61 74 63 68 20 69 73 ur. The patch is
0d10: 20 70 61 72 74 0a 20 2a 09 09 6f 66 20 74 68 65 part. *..of the
0d20: 20 63 6f 72 65 20 66 72 6f 6d 20 6e 6f 77 20 6f core from now o
0d30: 6e 2e 0a 20 2a 0a 20 2a 20 38 2e 33 2e 32 2b 3a n.. *. * 8.3.2+:
0d40: 09 53 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c .Stacked channel
0d50: 73 20 72 65 77 72 69 74 74 65 6e 20 66 6f 72 20 s rewritten for
0d60: 62 65 74 74 65 72 20 62 65 68 61 76 69 6f 75 72 better behaviour
0d70: 20 69 6e 20 73 6f 6d 65 0a 20 2a 09 09 73 69 74 in some. *..sit
0d80: 75 61 74 69 6f 6e 73 20 28 63 6c 6f 73 69 6e 67 uations (closing
0d90: 29 2e 20 53 6f 6d 65 20 6e 65 77 20 41 50 49 27 ). Some new API'
0da0: 73 2c 20 73 65 6d 61 6e 74 69 63 20 63 68 61 6e s, semantic chan
0db0: 67 65 73 2e 0a 20 2a 0a 20 2a 20 54 68 65 20 66 ges.. *. * The f
0dc0: 6f 6c 6c 6f 77 69 6e 67 20 6d 61 67 69 63 20 77 ollowing magic w
0dd0: 61 73 20 61 64 61 70 74 65 64 20 66 72 6f 6d 20 as adapted from
0de0: 54 72 66 20 32 2e 31 20 28 4b 75 70 72 69 65 73 Trf 2.1 (Kupries
0df0: 29 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 ).. */..#define
0e00: 54 4c 53 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53 TLS_CHANNEL_VERS
0e10: 49 4f 4e 5f 31 09 30 78 31 0a 23 64 65 66 69 6e ION_1.0x1.#defin
0e20: 65 20 54 4c 53 5f 43 48 41 4e 4e 45 4c 5f 56 45 e TLS_CHANNEL_VE
0e30: 52 53 49 4f 4e 5f 32 09 30 78 32 0a 65 78 74 65 RSION_2.0x2.exte
0e40: 72 6e 20 69 6e 74 20 63 68 61 6e 6e 65 6c 54 79 rn int channelTy
0e50: 70 65 56 65 72 73 69 6f 6e 3b 0a 0a 23 69 66 64 peVersion;..#ifd
0e60: 65 66 20 55 53 45 5f 54 43 4c 5f 53 54 55 42 53 ef USE_TCL_STUBS
0e70: 0a 23 69 66 6e 64 65 66 20 54 63 6c 5f 53 74 61 .#ifndef Tcl_Sta
0e80: 63 6b 43 68 61 6e 6e 65 6c 0a 2f 2a 0a 20 2a 20 ckChannel./*. *
0e90: 54 68 65 20 63 6f 72 65 20 77 65 20 61 72 65 20 The core we are
0ea0: 63 6f 6d 70 69 6c 69 6e 67 20 61 67 61 69 6e 73 compiling agains
0eb0: 74 20 69 73 20 6e 6f 74 20 70 61 74 63 68 65 64 t is not patched
0ec0: 2c 20 73 6f 20 73 75 70 70 6c 79 20 74 68 65 0a , so supply the.
0ed0: 20 2a 20 6e 65 63 65 73 73 73 61 72 79 20 64 65 * necesssary de
0ee0: 66 69 6e 69 74 69 6f 6e 73 20 68 65 72 65 20 62 finitions here b
0ef0: 79 20 6f 75 72 73 65 6c 76 65 73 2e 20 54 68 65 y ourselves. The
0f00: 20 66 6f 72 6d 20 63 68 6f 73 65 6e 20 66 6f 72 form chosen for
0f10: 0a 20 2a 20 74 68 65 20 70 72 6f 63 65 64 75 72 . * the procedur
0f20: 65 20 6d 61 63 72 6f 73 20 28 72 65 73 65 72 76 e macros (reserv
0f30: 65 64 58 58 58 29 20 77 69 6c 6c 20 6e 6f 74 69 edXXX) will noti
0f40: 66 79 20 75 73 20 69 66 20 74 68 65 20 63 6f 72 fy us if the cor
0f50: 65 0a 20 2a 20 64 6f 65 73 20 6e 6f 74 20 68 61 e. * does not ha
0f60: 76 65 20 74 68 65 73 65 20 72 65 73 65 72 76 65 ve these reserve
0f70: 64 20 6c 6f 63 61 74 69 6f 6e 73 20 61 6e 79 6d d locations anym
0f80: 6f 72 65 2e 0a 20 2a 0a 20 2a 20 21 21 20 53 79 ore.. *. * !! Sy
0f90: 6e 63 68 72 6f 6e 69 7a 65 20 74 68 65 20 70 72 nchronize the pr
0fa0: 6f 63 65 64 75 72 65 20 69 6e 64 69 63 65 73 20 ocedure indices
0fb0: 69 6e 20 74 68 65 69 72 20 64 65 66 69 6e 69 74 in their definit
0fc0: 69 6f 6e 73 20 77 69 74 68 0a 20 2a 20 20 20 20 ions with. *
0fd0: 74 68 65 20 70 61 74 63 68 20 74 6f 20 74 63 6c the patch to tcl
0fe0: 2e 64 65 63 6c 73 2c 20 61 73 20 74 68 65 79 20 .decls, as they
0ff0: 68 61 76 65 20 74 6f 20 62 65 20 74 68 65 20 73 have to be the s
1000: 61 6d 65 2e 0a 20 2a 2f 0a 0a 2f 2a 20 32 38 31 ame.. */../* 281
1010: 20 2a 2f 0a 74 79 70 65 64 65 66 20 54 63 6c 5f */.typedef Tcl_
1020: 43 68 61 6e 6e 65 6c 20 28 74 6c 73 5f 53 74 61 Channel (tls_Sta
1030: 63 6b 43 68 61 6e 6e 65 6c 29 20 5f 41 4e 53 49 ckChannel) _ANSI
1040: 5f 41 52 47 53 5f 28 28 54 63 6c 5f 49 6e 74 65 _ARGS_((Tcl_Inte
1050: 72 70 2a 20 69 6e 74 65 72 70 2c 0a 09 09 09 09 rp* interp,.....
1060: 09 09 20 20 20 20 54 63 6c 5f 43 68 61 6e 6e 65 .. Tcl_Channe
1070: 6c 54 79 70 65 2a 20 74 79 70 65 50 74 72 2c 0a lType* typePtr,.
1080: 09 09 09 09 09 09 20 20 20 20 43 6c 69 65 6e 74 ...... Client
1090: 44 61 74 61 20 69 6e 73 74 61 6e 63 65 44 61 74 Data instanceDat
10a0: 61 2c 0a 09 09 09 09 09 09 20 20 20 20 69 6e 74 a,....... int
10b0: 20 6d 61 73 6b 2c 0a 09 09 09 09 09 09 20 20 20 mask,.......
10c0: 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 70 72 65 Tcl_Channel pre
10d0: 76 43 68 61 6e 29 29 3b 0a 2f 2a 20 32 38 32 20 vChan));./* 282
10e0: 2a 2f 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 */.typedef void
10f0: 28 74 6c 73 5f 55 6e 73 74 61 63 6b 43 68 61 6e (tls_UnstackChan
1100: 6e 65 6c 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f nel) _ANSI_ARGS_
1110: 28 28 54 63 6c 5f 49 6e 74 65 72 70 2a 20 69 6e ((Tcl_Interp* in
1120: 74 65 72 70 2c 0a 09 09 09 09 09 20 20 20 20 20 terp,......
1130: 20 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 63 68 Tcl_Channel ch
1140: 61 6e 29 29 3b 0a 0a 23 64 65 66 69 6e 65 20 54 an));..#define T
1150: 63 6c 5f 53 74 61 63 6b 43 68 61 6e 6e 65 6c 20 cl_StackChannel
1160: 20 20 20 20 28 28 74 6c 73 5f 53 74 61 63 6b 43 ((tls_StackC
1170: 68 61 6e 6e 65 6c 2a 29 20 74 63 6c 53 74 75 62 hannel*) tclStub
1180: 73 50 74 72 2d 3e 72 65 73 65 72 76 65 64 32 38 sPtr->reserved28
1190: 31 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 55 1).#define Tcl_U
11a0: 6e 73 74 61 63 6b 43 68 61 6e 6e 65 6c 20 28 28 nstackChannel ((
11b0: 74 6c 73 5f 55 6e 73 74 61 63 6b 43 68 61 6e 6e tls_UnstackChann
11c0: 65 6c 2a 29 20 74 63 6c 53 74 75 62 73 50 74 72 el*) tclStubsPtr
11d0: 2d 3e 72 65 73 65 72 76 65 64 32 38 32 29 0a 0a ->reserved282)..
11e0: 23 65 6e 64 69 66 20 2f 2a 20 54 63 6c 5f 53 74 #endif /* Tcl_St
11f0: 61 63 6b 43 68 61 6e 6e 65 6c 20 2a 2f 0a 0a 23 ackChannel */..#
1200: 69 66 6e 64 65 66 20 54 63 6c 5f 47 65 74 53 74 ifndef Tcl_GetSt
1210: 61 63 6b 65 64 43 68 61 6e 6e 65 6c 0a 2f 2a 0a ackedChannel./*.
1220: 20 2a 20 53 65 70 61 72 61 74 65 20 64 65 66 69 * Separate defi
1230: 6e 69 74 69 6f 6e 2c 20 61 76 61 69 6c 61 62 6c nition, availabl
1240: 65 20 69 6e 20 38 2e 32 2c 20 62 75 74 20 6e 6f e in 8.2, but no
1250: 74 20 38 2e 31 20 61 6e 64 20 62 65 66 6f 72 65 t 8.1 and before
1260: 20 21 0a 20 2a 2f 0a 0a 2f 2a 20 32 38 33 20 2a !. */../* 283 *
1270: 2f 0a 74 79 70 65 64 65 66 20 54 63 6c 5f 43 68 /.typedef Tcl_Ch
1280: 61 6e 6e 65 6c 20 28 74 6c 73 5f 47 65 74 53 74 annel (tls_GetSt
1290: 61 63 6b 65 64 43 68 61 6e 6e 65 6c 29 20 5f 41 ackedChannel) _A
12a0: 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 43 NSI_ARGS_((Tcl_C
12b0: 68 61 6e 6e 65 6c 20 63 68 61 6e 29 29 3b 0a 0a hannel chan));..
12c0: 23 64 65 66 69 6e 65 20 54 63 6c 5f 47 65 74 53 #define Tcl_GetS
12d0: 74 61 63 6b 65 64 43 68 61 6e 6e 65 6c 20 28 28 tackedChannel ((
12e0: 74 6c 73 5f 47 65 74 53 74 61 63 6b 65 64 43 68 tls_GetStackedCh
12f0: 61 6e 6e 65 6c 2a 29 20 74 63 6c 53 74 75 62 73 annel*) tclStubs
1300: 50 74 72 2d 3e 72 65 73 65 72 76 65 64 32 38 33 Ptr->reserved283
1310: 29 0a 0a 23 65 6e 64 69 66 20 2f 2a 20 54 63 6c )..#endif /* Tcl
1320: 5f 47 65 74 53 74 61 63 6b 65 64 43 68 61 6e 6e _GetStackedChann
1330: 65 6c 20 2a 2f 0a 0a 0a 23 69 66 6e 64 65 66 20 el */...#ifndef
1340: 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53 TCL_CHANNEL_VERS
1350: 49 4f 4e 5f 32 0a 2f 2a 0a 20 2a 20 43 6f 72 65 ION_2./*. * Core
1360: 20 69 73 20 6f 6c 64 65 72 20 74 68 61 6e 20 38 is older than 8
1370: 2e 33 2e 32 2e 20 20 53 75 70 70 6c 79 20 74 68 .3.2. Supply th
1380: 65 20 6d 69 73 73 69 6e 67 20 64 65 66 69 6e 69 e missing defini
1390: 74 69 6f 6e 73 20 66 6f 72 0a 20 2a 20 74 68 65 tions for. * the
13a0: 20 6e 65 77 20 41 50 49 27 73 20 69 6e 20 38 2e new API's in 8.
13b0: 33 2e 32 2e 0a 20 2a 2f 0a 23 64 65 66 69 6e 65 3.2.. */.#define
13c0: 20 45 4d 55 4c 41 54 45 5f 43 48 41 4e 4e 45 4c EMULATE_CHANNEL
13d0: 5f 56 45 52 53 49 4f 4e 5f 32 0a 0a 74 79 70 65 _VERSION_2..type
13e0: 64 65 66 20 73 74 72 75 63 74 20 54 6c 73 43 68 def struct TlsCh
13f0: 61 6e 6e 65 6c 54 79 70 65 56 65 72 73 69 6f 6e annelTypeVersion
1400: 5f 2a 20 54 6c 73 43 68 61 6e 6e 65 6c 54 79 70 _* TlsChannelTyp
1410: 65 56 65 72 73 69 6f 6e 3b 0a 23 64 65 66 69 6e eVersion;.#defin
1420: 65 20 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f 56 45 e TCL_CHANNEL_VE
1430: 52 53 49 4f 4e 5f 32 09 28 28 54 6c 73 43 68 61 RSION_2.((TlsCha
1440: 6e 6e 65 6c 54 79 70 65 56 65 72 73 69 6f 6e 29 nnelTypeVersion)
1450: 20 30 78 32 29 0a 0a 74 79 70 65 64 65 66 20 69 0x2)..typedef i
1460: 6e 74 20 28 54 6c 73 44 72 69 76 65 72 48 61 6e nt (TlsDriverHan
1470: 64 6c 65 72 50 72 6f 63 29 20 5f 41 4e 53 49 5f dlerProc) _ANSI_
1480: 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 74 ARGS_((ClientDat
1490: 61 20 69 6e 73 74 61 6e 63 65 44 61 74 61 2c 0a a instanceData,.
14a0: 09 09 09 09 09 69 6e 74 20 69 6e 74 65 72 65 73 .....int interes
14b0: 74 4d 61 73 6b 29 29 3b 0a 2f 2a 20 33 39 34 20 tMask));./* 394
14c0: 2a 2f 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 */.typedef int (
14d0: 74 6c 73 5f 52 65 61 64 52 61 77 29 20 20 5f 41 tls_ReadRaw) _A
14e0: 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 43 NSI_ARGS_((Tcl_C
14f0: 68 61 6e 6e 65 6c 20 63 68 61 6e 2c 20 63 68 61 hannel chan, cha
1500: 72 20 2a 64 73 74 2c 0a 09 09 09 09 09 69 6e 74 r *dst,......int
1510: 20 62 79 74 65 73 54 6f 52 65 61 64 29 29 3b 0a bytesToRead));.
1520: 2f 2a 20 33 39 35 20 2a 2f 0a 74 79 70 65 64 65 /* 395 */.typede
1530: 66 20 69 6e 74 20 28 74 6c 73 5f 57 72 69 74 65 f int (tls_Write
1540: 52 61 77 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f Raw) _ANSI_ARGS_
1550: 28 28 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 63 68 ((Tcl_Channel ch
1560: 61 6e 2c 20 63 68 61 72 20 2a 73 72 63 2c 0a 09 an, char *src,..
1570: 09 09 09 09 69 6e 74 20 73 72 63 4c 65 6e 29 29 ....int srcLen))
1580: 3b 0a 2f 2a 20 33 39 37 20 2a 2f 0a 74 79 70 65 ;./* 397 */.type
1590: 64 65 66 20 69 6e 74 20 28 74 6c 73 5f 47 65 74 def int (tls_Get
15a0: 54 6f 70 43 68 61 6e 6e 65 6c 29 20 5f 41 4e 53 TopChannel) _ANS
15b0: 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 43 68 61 I_ARGS_((Tcl_Cha
15c0: 6e 6e 65 6c 20 63 68 61 6e 29 29 3b 0a 0a 2f 2a nnel chan));../*
15d0: 0a 20 2a 20 47 65 6e 65 72 61 74 69 6e 67 20 63 . * Generating c
15e0: 6f 64 65 20 66 6f 72 20 61 63 63 65 73 73 69 6e ode for accessin
15f0: 67 20 74 68 65 73 65 20 70 61 72 74 73 20 6f 66 g these parts of
1600: 20 74 68 65 20 73 74 75 62 20 74 61 62 6c 65 20 the stub table
1610: 77 68 65 6e 0a 20 2a 20 63 6f 6d 70 69 6c 69 6e when. * compilin
1620: 67 20 61 67 61 69 6e 73 74 20 61 20 63 6f 72 65 g against a core
1630: 20 6f 6c 64 65 72 20 74 68 61 6e 20 38 2e 33 2e older than 8.3.
1640: 32 20 69 73 20 61 20 68 61 73 73 6c 65 20 62 65 2 is a hassle be
1650: 63 61 75 73 65 20 65 76 65 6e 0a 20 2a 20 74 68 cause even. * th
1660: 65 20 27 72 65 73 65 72 76 65 64 58 58 58 27 20 e 'reservedXXX'
1670: 66 69 65 6c 64 73 20 6f 66 20 74 68 65 20 73 74 fields of the st
1680: 72 75 63 74 75 72 65 20 61 72 65 20 6e 6f 74 20 ructure are not
1690: 64 65 66 69 6e 65 64 20 79 65 74 2e 20 53 6f 0a defined yet. So.
16a0: 20 2a 20 77 65 20 68 61 76 65 20 74 6f 20 77 72 * we have to wr
16b0: 69 74 65 20 75 70 20 73 6f 6d 65 20 6d 61 63 72 ite up some macr
16c0: 6f 73 20 68 69 64 69 6e 67 20 73 6f 6d 65 20 76 os hiding some v
16d0: 65 72 79 20 68 61 63 6b 69 73 68 20 70 6f 69 6e ery hackish poin
16e0: 74 65 72 0a 20 2a 20 61 72 69 74 68 6d 65 74 69 ter. * arithmeti
16f0: 63 73 20 74 6f 20 67 65 74 20 61 74 20 74 68 65 cs to get at the
1700: 73 65 20 66 69 65 6c 64 73 2e 20 57 65 20 61 73 se fields. We as
1710: 73 75 6d 65 20 74 68 61 74 20 70 6f 69 6e 74 65 sume that pointe
1720: 72 20 74 6f 0a 20 2a 20 66 75 6e 63 74 69 6f 6e r to. * function
1730: 73 20 61 72 65 20 61 6c 77 61 79 73 20 6f 66 20 s are always of
1740: 74 68 65 20 73 61 6d 65 20 73 69 7a 65 2e 0a 20 the same size..
1750: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 53 54 55 42 */..#define STUB
1760: 5f 42 41 53 45 20 20 20 28 28 63 68 61 72 2a 29 _BASE ((char*)
1770: 28 26 28 74 63 6c 53 74 75 62 73 50 74 72 2d 3e (&(tclStubsPtr->
1780: 74 63 6c 5f 55 74 66 4e 63 61 73 65 63 6d 70 29 tcl_UtfNcasecmp)
1790: 29 29 20 2f 2a 20 66 69 65 6c 64 20 33 37 30 20 )) /* field 370
17a0: 2a 2f 0a 23 64 65 66 69 6e 65 20 70 72 6f 63 50 */.#define procP
17b0: 74 72 53 69 7a 65 20 28 73 69 7a 65 6f 66 20 28 trSize (sizeof (
17c0: 54 63 6c 5f 44 72 69 76 65 72 42 6c 6f 63 6b 4d Tcl_DriverBlockM
17d0: 6f 64 65 50 72 6f 63 20 2a 29 29 0a 23 64 65 66 odeProc *)).#def
17e0: 69 6e 65 20 49 44 58 28 6e 29 20 20 20 20 20 20 ine IDX(n)
17f0: 28 28 28 6e 29 2d 33 37 30 29 20 2a 20 70 72 6f (((n)-370) * pro
1800: 63 50 74 72 53 69 7a 65 29 0a 23 64 65 66 69 6e cPtrSize).#defin
1810: 65 20 53 4c 4f 54 28 6e 29 20 20 20 20 20 28 53 e SLOT(n) (S
1820: 54 55 42 5f 42 41 53 45 20 2b 20 49 44 58 28 6e TUB_BASE + IDX(n
1830: 29 29 0a 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f ))..#define Tcl_
1840: 52 65 61 64 52 61 77 09 09 28 2a 28 28 74 6c 73 ReadRaw..(*((tls
1850: 5f 52 65 61 64 52 61 77 2a 2a 29 09 28 53 4c 4f _ReadRaw**).(SLO
1860: 54 28 33 39 34 29 29 29 29 0a 23 64 65 66 69 6e T(394)))).#defin
1870: 65 20 54 63 6c 5f 57 72 69 74 65 52 61 77 09 09 e Tcl_WriteRaw..
1880: 28 2a 28 28 74 6c 73 5f 57 72 69 74 65 52 61 77 (*((tls_WriteRaw
1890: 2a 2a 29 09 28 53 4c 4f 54 28 33 39 35 29 29 29 **).(SLOT(395)))
18a0: 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 47 65 ).#define Tcl_Ge
18b0: 74 54 6f 70 43 68 61 6e 6e 65 6c 09 28 2a 28 28 tTopChannel.(*((
18c0: 74 6c 73 5f 47 65 74 54 6f 70 43 68 61 6e 6e 65 tls_GetTopChanne
18d0: 6c 2a 2a 29 28 53 4c 4f 54 28 33 39 36 29 29 29 l**)(SLOT(396)))
18e0: 29 0a 0a 2f 2a 0a 20 2a 20 52 65 71 75 69 72 65 )../*. * Require
18f0: 64 2c 20 65 61 73 79 20 65 6d 75 6c 61 74 69 6f d, easy emulatio
1900: 6e 2e 0a 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 n.. */.#define T
1910: 63 6c 5f 43 68 61 6e 6e 65 6c 47 65 74 4f 70 74 cl_ChannelGetOpt
1920: 69 6f 6e 50 72 6f 63 28 63 68 61 6e 44 72 69 76 ionProc(chanDriv
1930: 65 72 29 20 28 28 63 68 61 6e 44 72 69 76 65 72 er) ((chanDriver
1940: 29 2d 3e 67 65 74 4f 70 74 69 6f 6e 50 72 6f 63 )->getOptionProc
1950: 29 0a 0a 23 65 6e 64 69 66 20 2f 2a 20 54 43 4c )..#endif /* TCL
1960: 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53 49 4f 4e _CHANNEL_VERSION
1970: 5f 32 20 2a 2f 0a 0a 23 65 6e 64 69 66 20 2f 2a _2 */..#endif /*
1980: 20 55 53 45 5f 54 43 4c 5f 53 54 55 42 53 20 2a USE_TCL_STUBS *
1990: 2f 0a 0a 2f 2a 0a 20 2a 20 46 6f 72 77 61 72 64 /../*. * Forward
19a0: 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 0a 20 2a declarations. *
19b0: 2f 0a 0a 45 58 54 45 52 4e 20 54 63 6c 5f 43 68 /..EXTERN Tcl_Ch
19c0: 61 6e 6e 65 6c 54 79 70 65 20 2a 54 6c 73 5f 43 annelType *Tls_C
19d0: 68 61 6e 6e 65 6c 54 79 70 65 20 5f 41 4e 53 49 hannelType _ANSI
19e0: 5f 41 52 47 53 5f 28 28 76 6f 69 64 29 29 3b 0a _ARGS_((void));.
19f0: 45 58 54 45 52 4e 20 54 63 6c 5f 43 68 61 6e 6e EXTERN Tcl_Chann
1a00: 65 6c 09 54 6c 73 5f 47 65 74 50 61 72 65 6e 74 el.Tls_GetParent
1a10: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 53 74 _ANSI_ARGS_((St
1a20: 61 74 65 20 2a 73 74 61 74 65 50 74 72 29 29 3b ate *statePtr));
1a30: 0a 0a 45 58 54 45 52 4e 20 54 63 6c 5f 4f 62 6a ..EXTERN Tcl_Obj
1a40: 2a 09 09 54 6c 73 5f 4e 65 77 58 35 30 39 4f 62 *..Tls_NewX509Ob
1a50: 6a 20 5f 41 4e 53 49 5f 41 52 47 53 5f 20 28 28 j _ANSI_ARGS_ ((
1a60: 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 Tcl_Interp *int
1a70: 65 72 70 2c 20 58 35 30 39 20 2a 63 65 72 74 29 erp, X509 *cert)
1a80: 29 3b 0a 45 58 54 45 52 4e 20 76 6f 69 64 09 09 );.EXTERN void..
1a90: 54 6c 73 5f 45 72 72 6f 72 20 5f 41 4e 53 49 5f Tls_Error _ANSI_
1aa0: 41 52 47 53 5f 20 28 28 53 74 61 74 65 20 2a 73 ARGS_ ((State *s
1ab0: 74 61 74 65 50 74 72 2c 20 63 68 61 72 20 2a 6d tatePtr, char *m
1ac0: 73 67 29 29 3b 0a 45 58 54 45 52 4e 20 76 6f 69 sg));.EXTERN voi
1ad0: 64 09 09 54 6c 73 5f 46 72 65 65 20 5f 41 4e 53 d..Tls_Free _ANS
1ae0: 49 5f 41 52 47 53 5f 20 28 28 63 68 61 72 20 2a I_ARGS_ ((char *
1af0: 62 6c 6f 63 6b 50 74 72 29 29 3b 0a 45 58 54 45 blockPtr));.EXTE
1b00: 52 4e 20 76 6f 69 64 09 09 54 6c 73 5f 43 6c 65 RN void..Tls_Cle
1b10: 61 6e 20 5f 41 4e 53 49 5f 41 52 47 53 5f 20 28 an _ANSI_ARGS_ (
1b20: 28 53 74 61 74 65 20 2a 73 74 61 74 65 50 74 72 (State *statePtr
1b30: 29 29 3b 0a 45 58 54 45 52 4e 20 69 6e 74 09 09 ));.EXTERN int..
1b40: 54 6c 73 5f 57 61 69 74 46 6f 72 43 6f 6e 6e 65 Tls_WaitForConne
1b50: 63 74 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 ct _ANSI_ARGS_((
1b60: 20 53 74 61 74 65 20 2a 73 74 61 74 65 50 74 72 State *statePtr
1b70: 2c 0a 09 09 09 09 09 09 09 69 6e 74 20 2a 65 72 ,........int *er
1b80: 72 6f 72 43 6f 64 65 50 74 72 29 29 3b 0a 0a 45 rorCodePtr));..E
1b90: 58 54 45 52 4e 20 42 49 4f 5f 4d 45 54 48 4f 44 XTERN BIO_METHOD
1ba0: 20 2a 09 42 49 4f 5f 73 5f 74 63 6c 20 5f 41 4e *.BIO_s_tcl _AN
1bb0: 53 49 5f 41 52 47 53 5f 28 28 76 6f 69 64 29 29 SI_ARGS_((void))
1bc0: 3b 0a 45 58 54 45 52 4e 20 42 49 4f 20 2a 09 09 ;.EXTERN BIO *..
1bd0: 42 49 4f 5f 6e 65 77 5f 74 63 6c 20 5f 41 4e 53 BIO_new_tcl _ANS
1be0: 49 5f 41 52 47 53 5f 28 28 53 74 61 74 65 2a 20 I_ARGS_((State*
1bf0: 73 74 61 74 65 50 74 72 2c 20 69 6e 74 20 66 6c statePtr, int fl
1c00: 61 67 73 29 29 3b 0a 0a 23 65 6e 64 69 66 20 2f ags));..#endif /
1c10: 2a 20 5f 54 4c 53 49 4e 54 5f 48 20 2a 2f 0a * _TLSINT_H */.