Artifact
810dac65b4b143418730b946cc724081fdc0b59b:
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 36 20 32 30 31 34 2f t.h,v 1.16 2014/
0090: 31 32 2f 30 38 20 31 39 3a 30 39 3a 30 36 20 61 12/08 19:09:06 a
00a0: 6e 64 72 65 61 73 5f 6b 75 70 72 69 65 73 20 45 ndreas_kupries E
00b0: 78 70 20 24 0a 20 2a 0a 20 2a 20 54 4c 53 20 28 xp $. *. * TLS (
00c0: 61 6b 61 20 53 53 4c 29 20 43 68 61 6e 6e 65 6c aka SSL) Channel
00d0: 20 2d 20 63 61 6e 20 62 65 20 6c 61 79 65 72 65 - can be layere
00e0: 64 20 6f 6e 20 61 6e 79 20 62 69 2d 64 69 72 65 d on any bi-dire
00f0: 63 74 69 6f 6e 61 6c 0a 20 2a 20 54 63 6c 5f 43 ctional. * Tcl_C
0100: 68 61 6e 6e 65 6c 20 28 4e 6f 74 65 3a 20 52 65 hannel (Note: Re
0110: 71 75 69 72 65 73 20 54 72 66 20 43 6f 72 65 20 quires Trf Core
0120: 50 61 74 63 68 29 0a 20 2a 0a 20 2a 20 54 68 69 Patch). *. * Thi
0130: 73 20 77 61 73 20 62 75 69 6c 74 20 66 72 6f 6d s was built from
0140: 20 73 63 72 61 74 63 68 20 62 61 73 65 64 20 75 scratch based u
0150: 70 6f 6e 20 6f 62 73 65 72 76 61 74 69 6f 6e 20 pon observation
0160: 6f 66 20 4f 70 65 6e 53 53 4c 20 30 2e 39 2e 32 of OpenSSL 0.9.2
0170: 42 0a 20 2a 0a 20 2a 20 41 64 64 69 74 69 6f 6e B. *. * Addition
0180: 20 63 72 65 64 69 74 20 69 73 20 64 75 65 20 66 credit is due f
0190: 6f 72 20 41 6e 64 72 65 61 73 20 4b 75 70 72 69 or Andreas Kupri
01a0: 65 73 20 28 61 2e 6b 75 70 72 69 65 73 40 77 65 es (a.kupries@we
01b0: 73 74 65 6e 64 2e 63 6f 6d 29 2c 20 66 6f 72 0a stend.com), for.
01c0: 20 2a 20 70 72 6f 76 69 64 69 6e 67 20 74 68 65 * providing the
01d0: 20 54 63 6c 5f 52 65 70 6c 61 63 65 43 68 61 6e Tcl_ReplaceChan
01e0: 6e 65 6c 20 6d 65 63 68 61 6e 69 73 6d 20 61 6e nel mechanism an
01f0: 64 20 77 6f 72 6b 69 6e 67 20 63 6c 6f 73 65 6c d working closel
0200: 79 20 77 69 74 68 20 6d 65 0a 20 2a 20 74 6f 20 y with me. * to
0210: 65 6e 68 61 6e 63 65 20 69 74 20 74 6f 20 73 75 enhance it to su
0220: 70 70 6f 72 74 20 66 75 6c 6c 20 66 69 6c 65 65 pport full filee
0230: 76 65 6e 74 20 73 65 6d 61 6e 74 69 63 73 2e 0a vent semantics..
0240: 20 2a 0a 20 2a 20 41 6c 73 6f 20 77 6f 72 6b 20 *. * Also work
0250: 64 6f 6e 65 20 62 79 20 74 68 65 20 66 6f 6c 6c done by the foll
0260: 6f 77 20 70 65 6f 70 6c 65 20 70 72 6f 76 69 64 ow people provid
0270: 65 64 20 74 68 65 20 69 6d 70 65 74 75 73 20 74 ed the impetus t
0280: 6f 20 64 6f 20 74 68 69 73 20 22 72 69 67 68 74 o do this "right
0290: 22 3a 2d 0a 20 2a 09 74 63 6c 53 53 4c 20 28 43 ":-. *.tclSSL (C
02a0: 6f 6c 69 6e 20 4d 63 43 6f 72 6d 61 63 6b 2c 20 olin McCormack,
02b0: 53 68 61 72 65 64 20 54 65 63 68 6e 6f 6c 6f 67 Shared Technolog
02c0: 79 29 0a 20 2a 09 53 53 4c 74 63 6c 20 28 50 65 y). *.SSLtcl (Pe
02d0: 74 65 72 20 41 6e 74 6d 61 6e 29 0a 20 2a 0a 20 ter Antman). *.
02e0: 2a 2f 0a 23 69 66 6e 64 65 66 20 5f 54 53 4c 49 */.#ifndef _TSLI
02f0: 4e 54 5f 48 0a 23 64 65 66 69 6e 65 20 5f 54 4c NT_H.#define _TL
0300: 53 49 4e 54 5f 48 0a 0a 23 69 6e 63 6c 75 64 65 SINT_H..#include
0310: 20 22 74 6c 73 2e 68 22 0a 23 69 6e 63 6c 75 64 "tls.h".#includ
0320: 65 20 3c 65 72 72 6e 6f 2e 68 3e 0a 23 69 6e 63 e <errno.h>.#inc
0330: 6c 75 64 65 20 3c 73 74 72 69 6e 67 2e 68 3e 0a lude <string.h>.
0340: 0a 23 69 66 64 65 66 20 5f 5f 57 49 4e 33 32 5f .#ifdef __WIN32_
0350: 5f 0a 23 64 65 66 69 6e 65 20 57 49 4e 33 32 5f _.#define WIN32_
0360: 4c 45 41 4e 5f 41 4e 44 5f 4d 45 41 4e 0a 23 69 LEAN_AND_MEAN.#i
0370: 6e 63 6c 75 64 65 20 3c 77 69 6e 64 6f 77 73 2e nclude <windows.
0380: 68 3e 0a 23 69 6e 63 6c 75 64 65 20 3c 77 69 6e h>.#include <win
0390: 63 72 79 70 74 2e 68 3e 20 2f 2a 20 4f 70 65 6e crypt.h> /* Open
03a0: 53 53 4c 20 6e 65 65 64 73 20 74 68 69 73 20 6f SSL needs this o
03b0: 6e 20 57 69 6e 64 6f 77 73 20 2a 2f 0a 23 65 6e n Windows */.#en
03c0: 64 69 66 0a 0a 2f 2a 20 48 61 6e 64 6c 65 20 74 dif../* Handle t
03d0: 63 6c 38 2e 33 2d 3e 74 63 6c 38 2e 34 20 43 4f cl8.3->tcl8.4 CO
03e0: 4e 53 54 20 63 68 61 6e 67 65 73 20 2a 2f 0a 23 NST changes */.#
03f0: 69 66 6e 64 65 66 20 43 4f 4e 53 54 38 34 0a 23 ifndef CONST84.#
0400: 64 65 66 69 6e 65 20 43 4f 4e 53 54 38 34 0a 23 define CONST84.#
0410: 65 6e 64 69 66 0a 0a 23 69 66 64 65 66 20 4e 4f endif..#ifdef NO
0420: 5f 50 41 54 45 4e 54 53 0a 23 64 65 66 69 6e 65 _PATENTS.#define
0430: 20 4e 4f 5f 49 44 45 41 0a 23 64 65 66 69 6e 65 NO_IDEA.#define
0440: 20 4e 4f 5f 52 43 32 0a 23 64 65 66 69 6e 65 20 NO_RC2.#define
0450: 4e 4f 5f 52 43 34 0a 23 64 65 66 69 6e 65 20 4e NO_RC4.#define N
0460: 4f 5f 52 43 35 0a 23 64 65 66 69 6e 65 20 4e 4f O_RC5.#define NO
0470: 5f 52 53 41 0a 23 64 65 66 69 6e 65 20 4e 4f 5f _RSA.#define NO_
0480: 53 53 4c 32 0a 23 65 6e 64 69 66 0a 0a 23 69 66 SSL2.#endif..#if
0490: 64 65 66 20 42 53 41 46 45 0a 23 69 6e 63 6c 75 def BSAFE.#inclu
04a0: 64 65 20 3c 73 73 6c 2e 68 3e 0a 23 69 6e 63 6c de <ssl.h>.#incl
04b0: 75 64 65 20 3c 65 72 72 2e 68 3e 0a 23 69 6e 63 ude <err.h>.#inc
04c0: 6c 75 64 65 20 3c 72 61 6e 64 2e 68 3e 0a 23 65 lude <rand.h>.#e
04d0: 6c 73 65 0a 23 69 6e 63 6c 75 64 65 20 3c 6f 70 lse.#include <op
04e0: 65 6e 73 73 6c 2f 73 73 6c 2e 68 3e 0a 23 69 6e enssl/ssl.h>.#in
04f0: 63 6c 75 64 65 20 3c 6f 70 65 6e 73 73 6c 2f 65 clude <openssl/e
0500: 72 72 2e 68 3e 0a 23 69 6e 63 6c 75 64 65 20 3c rr.h>.#include <
0510: 6f 70 65 6e 73 73 6c 2f 72 61 6e 64 2e 68 3e 0a openssl/rand.h>.
0520: 23 65 6e 64 69 66 0a 0a 23 69 66 6e 64 65 66 20 #endif..#ifndef
0530: 53 53 4c 5f 4f 50 5f 4e 4f 5f 54 4c 53 76 31 5f SSL_OP_NO_TLSv1_
0540: 31 0a 23 64 65 66 69 6e 65 20 4e 4f 5f 54 4c 53 1.#define NO_TLS
0550: 31 5f 31 0a 23 65 6e 64 69 66 0a 0a 23 69 66 6e 1_1.#endif..#ifn
0560: 64 65 66 20 53 53 4c 5f 4f 50 5f 4e 4f 5f 54 4c def SSL_OP_NO_TL
0570: 53 76 31 5f 32 0a 23 64 65 66 69 6e 65 20 4e 4f Sv1_2.#define NO
0580: 5f 54 4c 53 31 5f 32 0a 23 65 6e 64 69 66 0a 0a _TLS1_2.#endif..
0590: 23 69 66 64 65 66 20 54 43 4c 5f 53 54 4f 52 41 #ifdef TCL_STORA
05a0: 47 45 5f 43 4c 41 53 53 0a 23 20 75 6e 64 65 66 GE_CLASS.# undef
05b0: 20 54 43 4c 5f 53 54 4f 52 41 47 45 5f 43 4c 41 TCL_STORAGE_CLA
05c0: 53 53 0a 23 65 6e 64 69 66 0a 23 69 66 64 65 66 SS.#endif.#ifdef
05d0: 20 42 55 49 4c 44 5f 74 6c 73 0a 23 20 64 65 66 BUILD_tls.# def
05e0: 69 6e 65 20 54 43 4c 5f 53 54 4f 52 41 47 45 5f ine TCL_STORAGE_
05f0: 43 4c 41 53 53 20 44 4c 4c 45 58 50 4f 52 54 0a CLASS DLLEXPORT.
0600: 23 65 6c 73 65 0a 23 20 64 65 66 69 6e 65 20 54 #else.# define T
0610: 43 4c 5f 53 54 4f 52 41 47 45 5f 43 4c 41 53 53 CL_STORAGE_CLASS
0620: 20 44 4c 4c 49 4d 50 4f 52 54 0a 23 65 6e 64 69 DLLIMPORT.#endi
0630: 66 0a 20 0a 23 69 66 6e 64 65 66 20 45 43 4f 4e f. .#ifndef ECON
0640: 4e 41 42 4f 52 54 45 44 0a 23 64 65 66 69 6e 65 NABORTED.#define
0650: 20 45 43 4f 4e 4e 41 42 4f 52 54 45 44 09 31 33 ECONNABORTED.13
0660: 30 09 2f 2a 20 53 6f 66 74 77 61 72 65 20 63 61 0./* Software ca
0670: 75 73 65 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 used connection
0680: 61 62 6f 72 74 20 2a 2f 0a 23 65 6e 64 69 66 0a abort */.#endif.
0690: 23 69 66 6e 64 65 66 20 45 43 4f 4e 4e 52 45 53 #ifndef ECONNRES
06a0: 45 54 0a 23 64 65 66 69 6e 65 20 45 43 4f 4e 4e ET.#define ECONN
06b0: 52 45 53 45 54 09 31 33 31 09 2f 2a 20 43 6f 6e RESET.131./* Con
06c0: 6e 65 63 74 69 6f 6e 20 72 65 73 65 74 20 62 79 nection reset by
06d0: 20 70 65 65 72 20 2a 2f 0a 23 65 6e 64 69 66 0a peer */.#endif.
06e0: 0a 23 69 66 64 65 66 20 44 45 42 55 47 0a 23 64 .#ifdef DEBUG.#d
06f0: 65 66 69 6e 65 20 64 70 72 69 6e 74 66 20 66 70 efine dprintf fp
0700: 72 69 6e 74 66 0a 23 65 6c 73 65 0a 23 64 65 66 rintf.#else.#def
0710: 69 6e 65 20 64 70 72 69 6e 74 66 20 69 66 20 28 ine dprintf if (
0720: 30 29 20 66 70 72 69 6e 74 66 0a 23 65 6e 64 69 0) fprintf.#endi
0730: 66 0a 0a 23 64 65 66 69 6e 65 20 53 53 4c 5f 45 f..#define SSL_E
0740: 52 52 4f 52 28 73 73 6c 2c 65 72 72 29 09 5c 0a RROR(ssl,err).\.
0750: 20 20 20 20 28 28 63 68 61 72 2a 29 45 52 52 5f ((char*)ERR_
0760: 72 65 61 73 6f 6e 5f 65 72 72 6f 72 5f 73 74 72 reason_error_str
0770: 69 6e 67 28 28 75 6e 73 69 67 6e 65 64 20 6c 6f ing((unsigned lo
0780: 6e 67 29 53 53 4c 5f 67 65 74 5f 65 72 72 6f 72 ng)SSL_get_error
0790: 28 28 73 73 6c 29 2c 28 65 72 72 29 29 29 29 0a ((ssl),(err)))).
07a0: 2f 2a 0a 20 2a 20 4f 70 65 6e 53 53 4c 20 42 49 /*. * OpenSSL BI
07b0: 4f 20 52 6f 75 74 69 6e 65 73 0a 20 2a 2f 0a 23 O Routines. */.#
07c0: 64 65 66 69 6e 65 20 42 49 4f 5f 54 59 50 45 5f define BIO_TYPE_
07d0: 54 43 4c 09 28 31 39 7c 30 78 30 34 30 30 29 0a TCL.(19|0x0400).
07e0: 0a 2f 2a 0a 20 2a 20 44 65 66 69 6e 65 73 20 66 ./*. * Defines f
07f0: 6f 72 20 53 74 61 74 65 2e 66 6c 61 67 73 0a 20 or State.flags.
0800: 2a 2f 0a 23 64 65 66 69 6e 65 20 54 4c 53 5f 54 */.#define TLS_T
0810: 43 4c 5f 41 53 59 4e 43 09 28 31 3c 3c 30 29 09 CL_ASYNC.(1<<0).
0820: 2f 2a 20 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e 67 20 /* non-blocking
0830: 6d 6f 64 65 20 2a 2f 0a 23 64 65 66 69 6e 65 20 mode */.#define
0840: 54 4c 53 5f 54 43 4c 5f 53 45 52 56 45 52 09 28 TLS_TCL_SERVER.(
0850: 31 3c 3c 31 29 09 2f 2a 20 53 65 72 76 65 72 2d 1<<1)./* Server-
0860: 53 69 64 65 20 2a 2f 0a 23 64 65 66 69 6e 65 20 Side */.#define
0870: 54 4c 53 5f 54 43 4c 5f 49 4e 49 54 09 28 31 3c TLS_TCL_INIT.(1<
0880: 3c 32 29 09 2f 2a 20 49 6e 69 74 69 61 6c 69 7a <2)./* Initializ
0890: 69 6e 67 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 2a ing connection *
08a0: 2f 0a 23 64 65 66 69 6e 65 20 54 4c 53 5f 54 43 /.#define TLS_TC
08b0: 4c 5f 44 45 42 55 47 09 28 31 3c 3c 33 29 09 2f L_DEBUG.(1<<3)./
08c0: 2a 20 53 68 6f 77 20 64 65 62 75 67 20 74 72 61 * Show debug tra
08d0: 63 69 6e 67 20 2a 2f 0a 23 64 65 66 69 6e 65 20 cing */.#define
08e0: 54 4c 53 5f 54 43 4c 5f 43 41 4c 4c 42 41 43 4b TLS_TCL_CALLBACK
08f0: 09 28 31 3c 3c 34 29 09 2f 2a 20 49 6e 20 61 20 .(1<<4)./* In a
0900: 63 61 6c 6c 62 61 63 6b 2c 20 70 72 65 76 65 6e callback, preven
0910: 74 20 75 70 64 61 74 65 0a 09 09 09 09 09 20 2a t update...... *
0920: 20 6c 6f 6f 70 69 6e 67 20 70 72 6f 62 6c 65 6d looping problem
0930: 2e 20 5b 42 75 67 20 31 36 35 32 33 38 30 5d 20 . [Bug 1652380]
0940: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 4c 53 5f */..#define TLS_
0950: 54 43 4c 5f 44 45 4c 41 59 20 28 35 29 0a 0a 2f TCL_DELAY (5)../
0960: 2a 0a 20 2a 20 54 68 69 73 20 73 74 72 75 63 74 *. * This struct
0970: 75 72 65 20 64 65 73 63 72 69 62 65 73 20 74 68 ure describes th
0980: 65 20 70 65 72 2d 69 6e 73 74 61 6e 63 65 20 73 e per-instance s
0990: 74 61 74 65 0a 20 2a 20 6f 66 20 61 6e 20 73 73 tate. * of an ss
09a0: 6c 20 63 68 61 6e 6e 65 6c 2e 0a 20 2a 0a 20 2a l channel.. *. *
09b0: 20 54 68 65 20 53 53 4c 20 70 72 6f 63 65 73 73 The SSL process
09c0: 69 6e 67 20 63 6f 6e 74 65 78 74 20 69 73 20 6d ing context is m
09d0: 61 69 6e 74 61 69 6e 65 64 20 68 65 72 65 2c 20 aintained here,
09e0: 69 6e 20 74 68 65 20 43 6c 69 65 6e 74 44 61 74 in the ClientDat
09f0: 61 0a 20 2a 2f 0a 74 79 70 65 64 65 66 20 73 74 a. */.typedef st
0a00: 72 75 63 74 20 53 74 61 74 65 20 7b 0a 20 20 20 ruct State {.
0a10: 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 73 65 6c Tcl_Channel sel
0a20: 66 3b 09 2f 2a 20 74 68 69 73 20 73 6f 63 6b 65 f;./* this socke
0a30: 74 20 63 68 61 6e 6e 65 6c 20 2a 2f 0a 20 20 20 t channel */.
0a40: 20 54 63 6c 5f 54 69 6d 65 72 54 6f 6b 65 6e 20 Tcl_TimerToken
0a50: 74 69 6d 65 72 3b 0a 0a 20 20 20 20 69 6e 74 20 timer;.. int
0a60: 66 6c 61 67 73 3b 09 09 2f 2a 20 73 65 65 20 53 flags;../* see S
0a70: 74 61 74 65 2e 66 6c 61 67 73 20 61 62 6f 76 65 tate.flags above
0a80: 20 20 2a 2f 0a 20 20 20 20 69 6e 74 20 77 61 74 */. int wat
0a90: 63 68 4d 61 73 6b 3b 09 2f 2a 20 63 75 72 72 65 chMask;./* curre
0aa0: 6e 74 20 57 61 74 63 68 50 72 6f 63 20 6d 61 73 nt WatchProc mas
0ab0: 6b 20 2a 2f 0a 20 20 20 20 69 6e 74 20 6d 6f 64 k */. int mod
0ac0: 65 3b 09 09 2f 2a 20 63 75 72 72 65 6e 74 20 6d e;../* current m
0ad0: 6f 64 65 20 6f 66 20 70 61 72 65 6e 74 20 63 68 ode of parent ch
0ae0: 61 6e 6e 65 6c 20 2a 2f 0a 0a 20 20 20 20 54 63 annel */.. Tc
0af0: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 l_Interp *interp
0b00: 3b 09 2f 2a 20 69 6e 74 65 72 70 72 65 74 65 72 ;./* interpreter
0b10: 20 69 6e 20 77 68 69 63 68 20 74 68 69 73 20 72 in which this r
0b20: 65 73 69 64 65 73 20 2a 2f 0a 20 20 20 20 54 63 esides */. Tc
0b30: 6c 5f 4f 62 6a 20 2a 63 61 6c 6c 62 61 63 6b 3b l_Obj *callback;
0b40: 09 2f 2a 20 73 63 72 69 70 74 20 63 61 6c 6c 65 ./* script calle
0b50: 64 20 66 6f 72 20 74 72 61 63 69 6e 67 2c 20 76 d for tracing, v
0b60: 65 72 69 66 79 69 6e 67 20 61 6e 64 20 65 72 72 erifying and err
0b70: 6f 72 73 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f ors */. Tcl_O
0b80: 62 6a 20 2a 70 61 73 73 77 6f 72 64 3b 09 2f 2a bj *password;./*
0b90: 20 73 63 72 69 70 74 20 63 61 6c 6c 65 64 20 66 script called f
0ba0: 6f 72 20 63 65 72 74 69 66 69 63 61 74 65 20 70 or certificate p
0bb0: 61 73 73 77 6f 72 64 20 2a 2f 20 0a 0a 20 20 20 assword */ ..
0bc0: 20 69 6e 74 20 76 66 6c 61 67 73 3b 09 09 2f 2a int vflags;../*
0bd0: 20 76 65 72 69 66 79 20 66 6c 61 67 73 20 2a 2f verify flags */
0be0: 0a 20 20 20 20 53 53 4c 20 2a 73 73 6c 3b 09 09 . SSL *ssl;..
0bf0: 2f 2a 20 53 74 72 75 63 74 20 66 6f 72 20 53 53 /* Struct for SS
0c00: 4c 20 70 72 6f 63 65 73 73 69 6e 67 20 2a 2f 0a L processing */.
0c10: 20 20 20 20 53 53 4c 5f 43 54 58 20 2a 63 74 78 SSL_CTX *ctx
0c20: 3b 09 2f 2a 20 53 53 4c 20 43 6f 6e 74 65 78 74 ;./* SSL Context
0c30: 20 2a 2f 0a 20 20 20 20 42 49 4f 20 2a 62 69 6f */. BIO *bio
0c40: 3b 09 09 2f 2a 20 53 74 72 75 63 74 20 66 6f 72 ;../* Struct for
0c50: 20 53 53 4c 20 70 72 6f 63 65 73 73 69 6e 67 20 SSL processing
0c60: 2a 2f 0a 20 20 20 20 42 49 4f 20 2a 70 5f 62 69 */. BIO *p_bi
0c70: 6f 3b 09 09 2f 2a 20 50 61 72 65 6e 74 20 42 49 o;../* Parent BI
0c80: 4f 20 28 74 68 61 74 20 69 73 20 6c 61 79 65 72 O (that is layer
0c90: 65 64 20 6f 6e 20 54 63 6c 5f 43 68 61 6e 6e 65 ed on Tcl_Channe
0ca0: 6c 29 20 2a 2f 0a 0a 20 20 20 20 63 68 61 72 20 l) */.. char
0cb0: 2a 65 72 72 3b 0a 7d 20 53 74 61 74 65 3b 0a 0a *err;.} State;..
0cc0: 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 /*. * The follow
0cd0: 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 ing definitions
0ce0: 68 61 76 65 20 74 6f 20 62 65 20 75 73 61 62 6c have to be usabl
0cf0: 65 20 66 6f 72 20 38 2e 32 2e 30 2d 38 2e 33 2e e for 8.2.0-8.3.
0d00: 31 20 61 6e 64 20 38 2e 33 2e 32 2b 2e 0a 20 2a 1 and 8.3.2+.. *
0d10: 20 54 68 65 20 64 69 66 66 65 72 65 6e 63 65 73 The differences
0d20: 20 62 65 74 77 65 65 6e 20 74 68 65 73 65 20 76 between these v
0d30: 65 72 73 69 6f 6e 73 3a 0a 20 2a 0a 20 2a 20 38 ersions:. *. * 8
0d40: 2e 30 2d 38 2e 31 3a 09 54 68 65 72 65 20 69 73 .0-8.1:.There is
0d50: 20 6e 6f 20 73 75 70 70 6f 72 74 20 66 6f 72 20 no support for
0d60: 74 68 65 73 65 20 69 6e 20 54 4c 53 20 31 2e 34 these in TLS 1.4
0d70: 20 28 67 65 74 20 31 2e 33 29 2e 20 20 54 68 69 (get 1.3). Thi
0d80: 73 0a 20 2a 09 09 77 61 73 20 74 68 65 20 76 65 s. *..was the ve
0d90: 72 73 69 6f 6e 20 77 69 74 68 20 74 68 65 20 6f rsion with the o
0da0: 72 69 67 69 6e 61 6c 20 70 61 74 63 68 2e 0a 20 riginal patch..
0db0: 2a 0a 20 2a 20 38 2e 32 2e 30 2d 09 43 68 61 6e *. * 8.2.0-.Chan
0dc0: 67 65 64 20 73 65 6d 61 6e 74 69 63 73 20 66 6f ged semantics fo
0dd0: 72 20 54 63 6c 5f 53 74 61 63 6b 43 68 61 6e 6e r Tcl_StackChann
0de0: 65 6c 20 28 54 63 6c 5f 52 65 70 6c 61 63 65 43 el (Tcl_ReplaceC
0df0: 68 61 6e 6e 65 6c 29 2e 0a 20 2a 20 38 2e 33 2e hannel).. * 8.3.
0e00: 31 3a 09 43 68 65 63 6b 20 61 74 20 72 75 6e 74 1:.Check at runt
0e10: 69 6d 65 20 74 6f 20 73 77 69 74 63 68 20 74 68 ime to switch th
0e20: 65 20 62 65 68 61 76 69 6f 75 72 2e 20 54 68 65 e behaviour. The
0e30: 20 70 61 74 63 68 20 69 73 20 70 61 72 74 0a 20 patch is part.
0e40: 2a 09 09 6f 66 20 74 68 65 20 63 6f 72 65 20 66 *..of the core f
0e50: 72 6f 6d 20 6e 6f 77 20 6f 6e 2e 0a 20 2a 0a 20 rom now on.. *.
0e60: 2a 20 38 2e 33 2e 32 2b 3a 09 53 74 61 63 6b 65 * 8.3.2+:.Stacke
0e70: 64 20 63 68 61 6e 6e 65 6c 73 20 72 65 77 72 69 d channels rewri
0e80: 74 74 65 6e 20 66 6f 72 20 62 65 74 74 65 72 20 tten for better
0e90: 62 65 68 61 76 69 6f 75 72 20 69 6e 20 73 6f 6d behaviour in som
0ea0: 65 0a 20 2a 09 09 73 69 74 75 61 74 69 6f 6e 73 e. *..situations
0eb0: 20 28 63 6c 6f 73 69 6e 67 29 2e 20 53 6f 6d 65 (closing). Some
0ec0: 20 6e 65 77 20 41 50 49 27 73 2c 20 73 65 6d 61 new API's, sema
0ed0: 6e 74 69 63 20 63 68 61 6e 67 65 73 2e 0a 20 2a ntic changes.. *
0ee0: 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e . * The followin
0ef0: 67 20 6d 61 67 69 63 20 77 61 73 20 61 64 61 70 g magic was adap
0f00: 74 65 64 20 66 72 6f 6d 20 54 72 66 20 32 2e 31 ted from Trf 2.1
0f10: 20 28 4b 75 70 72 69 65 73 29 2e 0a 20 2a 2f 0a (Kupries).. */.
0f20: 0a 23 64 65 66 69 6e 65 20 54 4c 53 5f 43 48 41 .#define TLS_CHA
0f30: 4e 4e 45 4c 5f 56 45 52 53 49 4f 4e 5f 31 09 30 NNEL_VERSION_1.0
0f40: 78 31 0a 23 64 65 66 69 6e 65 20 54 4c 53 5f 43 x1.#define TLS_C
0f50: 48 41 4e 4e 45 4c 5f 56 45 52 53 49 4f 4e 5f 32 HANNEL_VERSION_2
0f60: 09 30 78 32 0a 65 78 74 65 72 6e 20 69 6e 74 20 .0x2.extern int
0f70: 63 68 61 6e 6e 65 6c 54 79 70 65 56 65 72 73 69 channelTypeVersi
0f80: 6f 6e 3b 0a 0a 23 69 66 64 65 66 20 55 53 45 5f on;..#ifdef USE_
0f90: 54 43 4c 5f 53 54 55 42 53 0a 23 69 66 6e 64 65 TCL_STUBS.#ifnde
0fa0: 66 20 54 63 6c 5f 53 74 61 63 6b 43 68 61 6e 6e f Tcl_StackChann
0fb0: 65 6c 0a 2f 2a 0a 20 2a 20 54 68 65 20 63 6f 72 el./*. * The cor
0fc0: 65 20 77 65 20 61 72 65 20 63 6f 6d 70 69 6c 69 e we are compili
0fd0: 6e 67 20 61 67 61 69 6e 73 74 20 69 73 20 6e 6f ng against is no
0fe0: 74 20 70 61 74 63 68 65 64 2c 20 73 6f 20 73 75 t patched, so su
0ff0: 70 70 6c 79 20 74 68 65 0a 20 2a 20 6e 65 63 65 pply the. * nece
1000: 73 73 73 61 72 79 20 64 65 66 69 6e 69 74 69 6f sssary definitio
1010: 6e 73 20 68 65 72 65 20 62 79 20 6f 75 72 73 65 ns here by ourse
1020: 6c 76 65 73 2e 20 54 68 65 20 66 6f 72 6d 20 63 lves. The form c
1030: 68 6f 73 65 6e 20 66 6f 72 0a 20 2a 20 74 68 65 hosen for. * the
1040: 20 70 72 6f 63 65 64 75 72 65 20 6d 61 63 72 6f procedure macro
1050: 73 20 28 72 65 73 65 72 76 65 64 58 58 58 29 20 s (reservedXXX)
1060: 77 69 6c 6c 20 6e 6f 74 69 66 79 20 75 73 20 69 will notify us i
1070: 66 20 74 68 65 20 63 6f 72 65 0a 20 2a 20 64 6f f the core. * do
1080: 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 65 73 es not have thes
1090: 65 20 72 65 73 65 72 76 65 64 20 6c 6f 63 61 74 e reserved locat
10a0: 69 6f 6e 73 20 61 6e 79 6d 6f 72 65 2e 0a 20 2a ions anymore.. *
10b0: 0a 20 2a 20 21 21 20 53 79 6e 63 68 72 6f 6e 69 . * !! Synchroni
10c0: 7a 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 ze the procedure
10d0: 20 69 6e 64 69 63 65 73 20 69 6e 20 74 68 65 69 indices in thei
10e0: 72 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 77 69 r definitions wi
10f0: 74 68 0a 20 2a 20 20 20 20 74 68 65 20 70 61 74 th. * the pat
1100: 63 68 20 74 6f 20 74 63 6c 2e 64 65 63 6c 73 2c ch to tcl.decls,
1110: 20 61 73 20 74 68 65 79 20 68 61 76 65 20 74 6f as they have to
1120: 20 62 65 20 74 68 65 20 73 61 6d 65 2e 0a 20 2a be the same.. *
1130: 2f 0a 0a 2f 2a 20 32 38 31 20 2a 2f 0a 74 79 70 /../* 281 */.typ
1140: 65 64 65 66 20 54 63 6c 5f 43 68 61 6e 6e 65 6c edef Tcl_Channel
1150: 20 28 74 6c 73 5f 53 74 61 63 6b 43 68 61 6e 6e (tls_StackChann
1160: 65 6c 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 el) _ANSI_ARGS_(
1170: 28 54 63 6c 5f 49 6e 74 65 72 70 2a 20 69 6e 74 (Tcl_Interp* int
1180: 65 72 70 2c 0a 09 09 09 09 09 09 20 20 20 20 54 erp,....... T
1190: 63 6c 5f 43 68 61 6e 6e 65 6c 54 79 70 65 2a 20 cl_ChannelType*
11a0: 74 79 70 65 50 74 72 2c 0a 09 09 09 09 09 09 20 typePtr,.......
11b0: 20 20 20 43 6c 69 65 6e 74 44 61 74 61 20 69 6e ClientData in
11c0: 73 74 61 6e 63 65 44 61 74 61 2c 0a 09 09 09 09 stanceData,.....
11d0: 09 09 20 20 20 20 69 6e 74 20 6d 61 73 6b 2c 0a .. int mask,.
11e0: 09 09 09 09 09 09 20 20 20 20 54 63 6c 5f 43 68 ...... Tcl_Ch
11f0: 61 6e 6e 65 6c 20 70 72 65 76 43 68 61 6e 29 29 annel prevChan))
1200: 3b 0a 2f 2a 20 32 38 32 20 2a 2f 0a 74 79 70 65 ;./* 282 */.type
1210: 64 65 66 20 76 6f 69 64 20 28 74 6c 73 5f 55 6e def void (tls_Un
1220: 73 74 61 63 6b 43 68 61 6e 6e 65 6c 29 20 5f 41 stackChannel) _A
1230: 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 49 NSI_ARGS_((Tcl_I
1240: 6e 74 65 72 70 2a 20 69 6e 74 65 72 70 2c 0a 09 nterp* interp,..
1250: 09 09 09 09 20 20 20 20 20 20 20 54 63 6c 5f 43 .... Tcl_C
1260: 68 61 6e 6e 65 6c 20 63 68 61 6e 29 29 3b 0a 0a hannel chan));..
1270: 23 64 65 66 69 6e 65 20 54 63 6c 5f 53 74 61 63 #define Tcl_Stac
1280: 6b 43 68 61 6e 6e 65 6c 20 20 20 20 20 28 28 74 kChannel ((t
1290: 6c 73 5f 53 74 61 63 6b 43 68 61 6e 6e 65 6c 2a ls_StackChannel*
12a0: 29 20 74 63 6c 53 74 75 62 73 50 74 72 2d 3e 72 ) tclStubsPtr->r
12b0: 65 73 65 72 76 65 64 32 38 31 29 0a 23 64 65 66 eserved281).#def
12c0: 69 6e 65 20 54 63 6c 5f 55 6e 73 74 61 63 6b 43 ine Tcl_UnstackC
12d0: 68 61 6e 6e 65 6c 20 28 28 74 6c 73 5f 55 6e 73 hannel ((tls_Uns
12e0: 74 61 63 6b 43 68 61 6e 6e 65 6c 2a 29 20 74 63 tackChannel*) tc
12f0: 6c 53 74 75 62 73 50 74 72 2d 3e 72 65 73 65 72 lStubsPtr->reser
1300: 76 65 64 32 38 32 29 0a 0a 23 65 6e 64 69 66 20 ved282)..#endif
1310: 2f 2a 20 54 63 6c 5f 53 74 61 63 6b 43 68 61 6e /* Tcl_StackChan
1320: 6e 65 6c 20 2a 2f 0a 0a 23 69 66 6e 64 65 66 20 nel */..#ifndef
1330: 54 63 6c 5f 47 65 74 53 74 61 63 6b 65 64 43 68 Tcl_GetStackedCh
1340: 61 6e 6e 65 6c 0a 2f 2a 0a 20 2a 20 53 65 70 61 annel./*. * Sepa
1350: 72 61 74 65 20 64 65 66 69 6e 69 74 69 6f 6e 2c rate definition,
1360: 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 38 2e available in 8.
1370: 32 2c 20 62 75 74 20 6e 6f 74 20 38 2e 31 20 61 2, but not 8.1 a
1380: 6e 64 20 62 65 66 6f 72 65 20 21 0a 20 2a 2f 0a nd before !. */.
1390: 0a 2f 2a 20 32 38 33 20 2a 2f 0a 74 79 70 65 64 ./* 283 */.typed
13a0: 65 66 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 28 ef Tcl_Channel (
13b0: 74 6c 73 5f 47 65 74 53 74 61 63 6b 65 64 43 68 tls_GetStackedCh
13c0: 61 6e 6e 65 6c 29 20 5f 41 4e 53 49 5f 41 52 47 annel) _ANSI_ARG
13d0: 53 5f 28 28 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 S_((Tcl_Channel
13e0: 63 68 61 6e 29 29 3b 0a 0a 23 64 65 66 69 6e 65 chan));..#define
13f0: 20 54 63 6c 5f 47 65 74 53 74 61 63 6b 65 64 43 Tcl_GetStackedC
1400: 68 61 6e 6e 65 6c 20 28 28 74 6c 73 5f 47 65 74 hannel ((tls_Get
1410: 53 74 61 63 6b 65 64 43 68 61 6e 6e 65 6c 2a 29 StackedChannel*)
1420: 20 74 63 6c 53 74 75 62 73 50 74 72 2d 3e 72 65 tclStubsPtr->re
1430: 73 65 72 76 65 64 32 38 33 29 0a 0a 23 65 6e 64 served283)..#end
1440: 69 66 20 2f 2a 20 54 63 6c 5f 47 65 74 53 74 61 if /* Tcl_GetSta
1450: 63 6b 65 64 43 68 61 6e 6e 65 6c 20 2a 2f 0a 0a ckedChannel */..
1460: 0a 23 69 66 6e 64 65 66 20 54 43 4c 5f 43 48 41 .#ifndef TCL_CHA
1470: 4e 4e 45 4c 5f 56 45 52 53 49 4f 4e 5f 32 0a 2f NNEL_VERSION_2./
1480: 2a 0a 20 2a 20 43 6f 72 65 20 69 73 20 6f 6c 64 *. * Core is old
1490: 65 72 20 74 68 61 6e 20 38 2e 33 2e 32 2e 20 20 er than 8.3.2.
14a0: 53 75 70 70 6c 79 20 74 68 65 20 6d 69 73 73 69 Supply the missi
14b0: 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 66 ng definitions f
14c0: 6f 72 0a 20 2a 20 74 68 65 20 6e 65 77 20 41 50 or. * the new AP
14d0: 49 27 73 20 69 6e 20 38 2e 33 2e 32 2e 0a 20 2a I's in 8.3.2.. *
14e0: 2f 0a 23 64 65 66 69 6e 65 20 45 4d 55 4c 41 54 /.#define EMULAT
14f0: 45 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53 49 4f E_CHANNEL_VERSIO
1500: 4e 5f 32 0a 0a 74 79 70 65 64 65 66 20 73 74 72 N_2..typedef str
1510: 75 63 74 20 54 6c 73 43 68 61 6e 6e 65 6c 54 79 uct TlsChannelTy
1520: 70 65 56 65 72 73 69 6f 6e 5f 2a 20 54 6c 73 43 peVersion_* TlsC
1530: 68 61 6e 6e 65 6c 54 79 70 65 56 65 72 73 69 6f hannelTypeVersio
1540: 6e 3b 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 43 n;.#define TCL_C
1550: 48 41 4e 4e 45 4c 5f 56 45 52 53 49 4f 4e 5f 32 HANNEL_VERSION_2
1560: 09 28 28 54 6c 73 43 68 61 6e 6e 65 6c 54 79 70 .((TlsChannelTyp
1570: 65 56 65 72 73 69 6f 6e 29 20 30 78 32 29 0a 0a eVersion) 0x2)..
1580: 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 6c 73 typedef int (Tls
1590: 44 72 69 76 65 72 48 61 6e 64 6c 65 72 50 72 6f DriverHandlerPro
15a0: 63 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 c) _ANSI_ARGS_((
15b0: 43 6c 69 65 6e 74 44 61 74 61 20 69 6e 73 74 61 ClientData insta
15c0: 6e 63 65 44 61 74 61 2c 0a 09 09 09 09 09 69 6e nceData,......in
15d0: 74 20 69 6e 74 65 72 65 73 74 4d 61 73 6b 29 29 t interestMask))
15e0: 3b 0a 2f 2a 20 33 39 34 20 2a 2f 0a 74 79 70 65 ;./* 394 */.type
15f0: 64 65 66 20 69 6e 74 20 28 74 6c 73 5f 52 65 61 def int (tls_Rea
1600: 64 52 61 77 29 20 20 5f 41 4e 53 49 5f 41 52 47 dRaw) _ANSI_ARG
1610: 53 5f 28 28 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 S_((Tcl_Channel
1620: 63 68 61 6e 2c 20 63 68 61 72 20 2a 64 73 74 2c chan, char *dst,
1630: 0a 09 09 09 09 09 69 6e 74 20 62 79 74 65 73 54 ......int bytesT
1640: 6f 52 65 61 64 29 29 3b 0a 2f 2a 20 33 39 35 20 oRead));./* 395
1650: 2a 2f 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 */.typedef int (
1660: 74 6c 73 5f 57 72 69 74 65 52 61 77 29 20 5f 41 tls_WriteRaw) _A
1670: 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 43 NSI_ARGS_((Tcl_C
1680: 68 61 6e 6e 65 6c 20 63 68 61 6e 2c 20 63 68 61 hannel chan, cha
1690: 72 20 2a 73 72 63 2c 0a 09 09 09 09 09 69 6e 74 r *src,......int
16a0: 20 73 72 63 4c 65 6e 29 29 3b 0a 2f 2a 20 33 39 srcLen));./* 39
16b0: 37 20 2a 2f 0a 74 79 70 65 64 65 66 20 69 6e 74 7 */.typedef int
16c0: 20 28 74 6c 73 5f 47 65 74 54 6f 70 43 68 61 6e (tls_GetTopChan
16d0: 6e 65 6c 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f nel) _ANSI_ARGS_
16e0: 28 28 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 63 68 ((Tcl_Channel ch
16f0: 61 6e 29 29 3b 0a 0a 2f 2a 0a 20 2a 20 47 65 6e an));../*. * Gen
1700: 65 72 61 74 69 6e 67 20 63 6f 64 65 20 66 6f 72 erating code for
1710: 20 61 63 63 65 73 73 69 6e 67 20 74 68 65 73 65 accessing these
1720: 20 70 61 72 74 73 20 6f 66 20 74 68 65 20 73 74 parts of the st
1730: 75 62 20 74 61 62 6c 65 20 77 68 65 6e 0a 20 2a ub table when. *
1740: 20 63 6f 6d 70 69 6c 69 6e 67 20 61 67 61 69 6e compiling again
1750: 73 74 20 61 20 63 6f 72 65 20 6f 6c 64 65 72 20 st a core older
1760: 74 68 61 6e 20 38 2e 33 2e 32 20 69 73 20 61 20 than 8.3.2 is a
1770: 68 61 73 73 6c 65 20 62 65 63 61 75 73 65 20 65 hassle because e
1780: 76 65 6e 0a 20 2a 20 74 68 65 20 27 72 65 73 65 ven. * the 'rese
1790: 72 76 65 64 58 58 58 27 20 66 69 65 6c 64 73 20 rvedXXX' fields
17a0: 6f 66 20 74 68 65 20 73 74 72 75 63 74 75 72 65 of the structure
17b0: 20 61 72 65 20 6e 6f 74 20 64 65 66 69 6e 65 64 are not defined
17c0: 20 79 65 74 2e 20 53 6f 0a 20 2a 20 77 65 20 68 yet. So. * we h
17d0: 61 76 65 20 74 6f 20 77 72 69 74 65 20 75 70 20 ave to write up
17e0: 73 6f 6d 65 20 6d 61 63 72 6f 73 20 68 69 64 69 some macros hidi
17f0: 6e 67 20 73 6f 6d 65 20 76 65 72 79 20 68 61 63 ng some very hac
1800: 6b 69 73 68 20 70 6f 69 6e 74 65 72 0a 20 2a 20 kish pointer. *
1810: 61 72 69 74 68 6d 65 74 69 63 73 20 74 6f 20 67 arithmetics to g
1820: 65 74 20 61 74 20 74 68 65 73 65 20 66 69 65 6c et at these fiel
1830: 64 73 2e 20 57 65 20 61 73 73 75 6d 65 20 74 68 ds. We assume th
1840: 61 74 20 70 6f 69 6e 74 65 72 20 74 6f 0a 20 2a at pointer to. *
1850: 20 66 75 6e 63 74 69 6f 6e 73 20 61 72 65 20 61 functions are a
1860: 6c 77 61 79 73 20 6f 66 20 74 68 65 20 73 61 6d lways of the sam
1870: 65 20 73 69 7a 65 2e 0a 20 2a 2f 0a 0a 23 64 65 e size.. */..#de
1880: 66 69 6e 65 20 53 54 55 42 5f 42 41 53 45 20 20 fine STUB_BASE
1890: 20 28 28 63 68 61 72 2a 29 28 26 28 74 63 6c 53 ((char*)(&(tclS
18a0: 74 75 62 73 50 74 72 2d 3e 74 63 6c 5f 55 74 66 tubsPtr->tcl_Utf
18b0: 4e 63 61 73 65 63 6d 70 29 29 29 20 2f 2a 20 66 Ncasecmp))) /* f
18c0: 69 65 6c 64 20 33 37 30 20 2a 2f 0a 23 64 65 66 ield 370 */.#def
18d0: 69 6e 65 20 70 72 6f 63 50 74 72 53 69 7a 65 20 ine procPtrSize
18e0: 28 73 69 7a 65 6f 66 20 28 54 63 6c 5f 44 72 69 (sizeof (Tcl_Dri
18f0: 76 65 72 42 6c 6f 63 6b 4d 6f 64 65 50 72 6f 63 verBlockModeProc
1900: 20 2a 29 29 0a 23 64 65 66 69 6e 65 20 49 44 58 *)).#define IDX
1910: 28 6e 29 20 20 20 20 20 20 28 28 28 6e 29 2d 33 (n) (((n)-3
1920: 37 30 29 20 2a 20 70 72 6f 63 50 74 72 53 69 7a 70) * procPtrSiz
1930: 65 29 0a 23 64 65 66 69 6e 65 20 53 4c 4f 54 28 e).#define SLOT(
1940: 6e 29 20 20 20 20 20 28 53 54 55 42 5f 42 41 53 n) (STUB_BAS
1950: 45 20 2b 20 49 44 58 28 6e 29 29 0a 0a 23 64 65 E + IDX(n))..#de
1960: 66 69 6e 65 20 54 63 6c 5f 52 65 61 64 52 61 77 fine Tcl_ReadRaw
1970: 09 09 28 2a 28 28 74 6c 73 5f 52 65 61 64 52 61 ..(*((tls_ReadRa
1980: 77 2a 2a 29 09 28 53 4c 4f 54 28 33 39 34 29 29 w**).(SLOT(394))
1990: 29 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 57 )).#define Tcl_W
19a0: 72 69 74 65 52 61 77 09 09 28 2a 28 28 74 6c 73 riteRaw..(*((tls
19b0: 5f 57 72 69 74 65 52 61 77 2a 2a 29 09 28 53 4c _WriteRaw**).(SL
19c0: 4f 54 28 33 39 35 29 29 29 29 0a 23 64 65 66 69 OT(395)))).#defi
19d0: 6e 65 20 54 63 6c 5f 47 65 74 54 6f 70 43 68 61 ne Tcl_GetTopCha
19e0: 6e 6e 65 6c 09 28 2a 28 28 74 6c 73 5f 47 65 74 nnel.(*((tls_Get
19f0: 54 6f 70 43 68 61 6e 6e 65 6c 2a 2a 29 28 53 4c TopChannel**)(SL
1a00: 4f 54 28 33 39 36 29 29 29 29 0a 0a 2f 2a 0a 20 OT(396))))../*.
1a10: 2a 20 52 65 71 75 69 72 65 64 2c 20 65 61 73 79 * Required, easy
1a20: 20 65 6d 75 6c 61 74 69 6f 6e 2e 0a 20 2a 2f 0a emulation.. */.
1a30: 23 64 65 66 69 6e 65 20 54 63 6c 5f 43 68 61 6e #define Tcl_Chan
1a40: 6e 65 6c 47 65 74 4f 70 74 69 6f 6e 50 72 6f 63 nelGetOptionProc
1a50: 28 63 68 61 6e 44 72 69 76 65 72 29 20 28 28 63 (chanDriver) ((c
1a60: 68 61 6e 44 72 69 76 65 72 29 2d 3e 67 65 74 4f hanDriver)->getO
1a70: 70 74 69 6f 6e 50 72 6f 63 29 0a 0a 23 65 6e 64 ptionProc)..#end
1a80: 69 66 20 2f 2a 20 54 43 4c 5f 43 48 41 4e 4e 45 if /* TCL_CHANNE
1a90: 4c 5f 56 45 52 53 49 4f 4e 5f 32 20 2a 2f 0a 0a L_VERSION_2 */..
1aa0: 23 65 6e 64 69 66 20 2f 2a 20 55 53 45 5f 54 43 #endif /* USE_TC
1ab0: 4c 5f 53 54 55 42 53 20 2a 2f 0a 0a 2f 2a 0a 20 L_STUBS */../*.
1ac0: 2a 20 46 6f 72 77 61 72 64 20 64 65 63 6c 61 72 * Forward declar
1ad0: 61 74 69 6f 6e 73 0a 20 2a 2f 0a 0a 45 58 54 45 ations. */..EXTE
1ae0: 52 4e 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 54 79 RN Tcl_ChannelTy
1af0: 70 65 20 2a 54 6c 73 5f 43 68 61 6e 6e 65 6c 54 pe *Tls_ChannelT
1b00: 79 70 65 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 ype _ANSI_ARGS_(
1b10: 28 76 6f 69 64 29 29 3b 0a 45 58 54 45 52 4e 20 (void));.EXTERN
1b20: 54 63 6c 5f 43 68 61 6e 6e 65 6c 09 54 6c 73 5f Tcl_Channel.Tls_
1b30: 47 65 74 50 61 72 65 6e 74 20 5f 41 4e 53 49 5f GetParent _ANSI_
1b40: 41 52 47 53 5f 28 28 53 74 61 74 65 20 2a 73 74 ARGS_((State *st
1b50: 61 74 65 50 74 72 29 29 3b 0a 0a 45 58 54 45 52 atePtr));..EXTER
1b60: 4e 20 54 63 6c 5f 4f 62 6a 2a 09 09 54 6c 73 5f N Tcl_Obj*..Tls_
1b70: 4e 65 77 58 35 30 39 4f 62 6a 20 5f 41 4e 53 49 NewX509Obj _ANSI
1b80: 5f 41 52 47 53 5f 20 28 28 20 54 63 6c 5f 49 6e _ARGS_ (( Tcl_In
1b90: 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 58 35 terp *interp, X5
1ba0: 30 39 20 2a 63 65 72 74 29 29 3b 0a 45 58 54 45 09 *cert));.EXTE
1bb0: 52 4e 20 76 6f 69 64 09 09 54 6c 73 5f 45 72 72 RN void..Tls_Err
1bc0: 6f 72 20 5f 41 4e 53 49 5f 41 52 47 53 5f 20 28 or _ANSI_ARGS_ (
1bd0: 28 53 74 61 74 65 20 2a 73 74 61 74 65 50 74 72 (State *statePtr
1be0: 2c 20 63 68 61 72 20 2a 6d 73 67 29 29 3b 0a 45 , char *msg));.E
1bf0: 58 54 45 52 4e 20 76 6f 69 64 09 09 54 6c 73 5f XTERN void..Tls_
1c00: 46 72 65 65 20 5f 41 4e 53 49 5f 41 52 47 53 5f Free _ANSI_ARGS_
1c10: 20 28 28 63 68 61 72 20 2a 62 6c 6f 63 6b 50 74 ((char *blockPt
1c20: 72 29 29 3b 0a 45 58 54 45 52 4e 20 76 6f 69 64 r));.EXTERN void
1c30: 09 09 54 6c 73 5f 43 6c 65 61 6e 20 5f 41 4e 53 ..Tls_Clean _ANS
1c40: 49 5f 41 52 47 53 5f 20 28 28 53 74 61 74 65 20 I_ARGS_ ((State
1c50: 2a 73 74 61 74 65 50 74 72 29 29 3b 0a 45 58 54 *statePtr));.EXT
1c60: 45 52 4e 20 69 6e 74 09 09 54 6c 73 5f 57 61 69 ERN int..Tls_Wai
1c70: 74 46 6f 72 43 6f 6e 6e 65 63 74 20 5f 41 4e 53 tForConnect _ANS
1c80: 49 5f 41 52 47 53 5f 28 28 20 53 74 61 74 65 20 I_ARGS_(( State
1c90: 2a 73 74 61 74 65 50 74 72 2c 0a 09 09 09 09 09 *statePtr,......
1ca0: 09 09 69 6e 74 20 2a 65 72 72 6f 72 43 6f 64 65 ..int *errorCode
1cb0: 50 74 72 29 29 3b 0a 0a 45 58 54 45 52 4e 20 42 Ptr));..EXTERN B
1cc0: 49 4f 5f 4d 45 54 48 4f 44 20 2a 09 42 49 4f 5f IO_METHOD *.BIO_
1cd0: 73 5f 74 63 6c 20 5f 41 4e 53 49 5f 41 52 47 53 s_tcl _ANSI_ARGS
1ce0: 5f 28 28 76 6f 69 64 29 29 3b 0a 45 58 54 45 52 _((void));.EXTER
1cf0: 4e 20 42 49 4f 20 2a 09 09 42 49 4f 5f 6e 65 77 N BIO *..BIO_new
1d00: 5f 74 63 6c 20 5f 41 4e 53 49 5f 41 52 47 53 5f _tcl _ANSI_ARGS_
1d10: 28 28 53 74 61 74 65 2a 20 73 74 61 74 65 50 74 ((State* statePt
1d20: 72 2c 20 69 6e 74 20 66 6c 61 67 73 29 29 3b 0a r, int flags));.
1d30: 0a 23 65 6e 64 69 66 20 2f 2a 20 5f 54 4c 53 49 .#endif /* _TLSI
1d40: 4e 54 5f 48 20 2a 2f 0a NT_H */.