Artifact
fe15261c7512712b2dc24a37b5e65c0e98b699e0:
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 54 4c 53 20 28 61 6b 61 20 53 53 4c . * TLS (aka SSL
0050: 29 20 43 68 61 6e 6e 65 6c 20 2d 20 63 61 6e 20 ) Channel - can
0060: 62 65 20 6c 61 79 65 72 65 64 20 6f 6e 20 61 6e be layered on an
0070: 79 20 62 69 2d 64 69 72 65 63 74 69 6f 6e 61 6c y bi-directional
0080: 0a 20 2a 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 . * Tcl_Channel
0090: 28 4e 6f 74 65 3a 20 52 65 71 75 69 72 65 73 20 (Note: Requires
00a0: 54 72 66 20 43 6f 72 65 20 50 61 74 63 68 29 0a Trf Core Patch).
00b0: 20 2a 0a 20 2a 20 54 68 69 73 20 77 61 73 20 62 *. * This was b
00c0: 75 69 6c 74 20 66 72 6f 6d 20 73 63 72 61 74 63 uilt from scratc
00d0: 68 20 62 61 73 65 64 20 75 70 6f 6e 20 6f 62 73 h based upon obs
00e0: 65 72 76 61 74 69 6f 6e 20 6f 66 20 4f 70 65 6e ervation of Open
00f0: 53 53 4c 20 30 2e 39 2e 32 42 0a 20 2a 0a 20 2a SSL 0.9.2B. *. *
0100: 20 41 64 64 69 74 69 6f 6e 20 63 72 65 64 69 74 Addition credit
0110: 20 69 73 20 64 75 65 20 66 6f 72 20 41 6e 64 72 is due for Andr
0120: 65 61 73 20 4b 75 70 72 69 65 73 20 28 61 2e 6b eas Kupries (a.k
0130: 75 70 72 69 65 73 40 77 65 73 74 65 6e 64 2e 63 upries@westend.c
0140: 6f 6d 29 2c 20 66 6f 72 0a 20 2a 20 70 72 6f 76 om), for. * prov
0150: 69 64 69 6e 67 20 74 68 65 20 54 63 6c 5f 52 65 iding the Tcl_Re
0160: 70 6c 61 63 65 43 68 61 6e 6e 65 6c 20 6d 65 63 placeChannel mec
0170: 68 61 6e 69 73 6d 20 61 6e 64 20 77 6f 72 6b 69 hanism and worki
0180: 6e 67 20 63 6c 6f 73 65 6c 79 20 77 69 74 68 20 ng closely with
0190: 6d 65 0a 20 2a 20 74 6f 20 65 6e 68 61 6e 63 65 me. * to enhance
01a0: 20 69 74 20 74 6f 20 73 75 70 70 6f 72 74 20 66 it to support f
01b0: 75 6c 6c 20 66 69 6c 65 65 76 65 6e 74 20 73 65 ull fileevent se
01c0: 6d 61 6e 74 69 63 73 2e 0a 20 2a 0a 20 2a 20 41 mantics.. *. * A
01d0: 6c 73 6f 20 77 6f 72 6b 20 64 6f 6e 65 20 62 79 lso work done by
01e0: 20 74 68 65 20 66 6f 6c 6c 6f 77 20 70 65 6f 70 the follow peop
01f0: 6c 65 20 70 72 6f 76 69 64 65 64 20 74 68 65 20 le provided the
0200: 69 6d 70 65 74 75 73 20 74 6f 20 64 6f 20 74 68 impetus to do th
0210: 69 73 20 22 72 69 67 68 74 22 3a 2d 0a 20 2a 09 is "right":-. *.
0220: 74 63 6c 53 53 4c 20 28 43 6f 6c 69 6e 20 4d 63 tclSSL (Colin Mc
0230: 43 6f 72 6d 61 63 6b 2c 20 53 68 61 72 65 64 20 Cormack, Shared
0240: 54 65 63 68 6e 6f 6c 6f 67 79 29 0a 20 2a 09 53 Technology). *.S
0250: 53 4c 74 63 6c 20 28 50 65 74 65 72 20 41 6e 74 SLtcl (Peter Ant
0260: 6d 61 6e 29 0a 20 2a 0a 20 2a 2f 0a 23 69 66 6e man). *. */.#ifn
0270: 64 65 66 20 5f 54 4c 53 49 4e 54 5f 48 0a 23 64 def _TLSINT_H.#d
0280: 65 66 69 6e 65 20 5f 54 4c 53 49 4e 54 5f 48 0a efine _TLSINT_H.
0290: 0a 23 69 6e 63 6c 75 64 65 20 22 74 6c 73 2e 68 .#include "tls.h
02a0: 22 0a 23 69 6e 63 6c 75 64 65 20 3c 65 72 72 6e ".#include <errn
02b0: 6f 2e 68 3e 0a 23 69 6e 63 6c 75 64 65 20 3c 73 o.h>.#include <s
02c0: 74 72 69 6e 67 2e 68 3e 0a 0a 23 69 66 64 65 66 tring.h>..#ifdef
02d0: 20 5f 5f 57 49 4e 33 32 5f 5f 0a 23 64 65 66 69 __WIN32__.#defi
02e0: 6e 65 20 57 49 4e 33 32 5f 4c 45 41 4e 5f 41 4e ne WIN32_LEAN_AN
02f0: 44 5f 4d 45 41 4e 0a 23 69 6e 63 6c 75 64 65 20 D_MEAN.#include
0300: 3c 77 69 6e 64 6f 77 73 2e 68 3e 0a 23 69 6e 63 <windows.h>.#inc
0310: 6c 75 64 65 20 3c 77 69 6e 63 72 79 70 74 2e 68 lude <wincrypt.h
0320: 3e 20 2f 2a 20 4f 70 65 6e 53 53 4c 20 6e 65 65 > /* OpenSSL nee
0330: 64 73 20 74 68 69 73 20 6f 6e 20 57 69 6e 64 6f ds this on Windo
0340: 77 73 20 2a 2f 0a 23 65 6e 64 69 66 0a 0a 2f 2a ws */.#endif../*
0350: 20 48 61 6e 64 6c 65 20 74 63 6c 38 2e 33 2d 3e Handle tcl8.3->
0360: 74 63 6c 38 2e 34 20 43 4f 4e 53 54 20 63 68 61 tcl8.4 CONST cha
0370: 6e 67 65 73 20 2a 2f 0a 23 69 66 6e 64 65 66 20 nges */.#ifndef
0380: 43 4f 4e 53 54 38 34 0a 23 64 65 66 69 6e 65 20 CONST84.#define
0390: 43 4f 4e 53 54 38 34 0a 23 65 6e 64 69 66 0a 0a CONST84.#endif..
03a0: 23 69 66 64 65 66 20 4e 4f 5f 50 41 54 45 4e 54 #ifdef NO_PATENT
03b0: 53 0a 23 20 20 64 65 66 69 6e 65 20 4e 4f 5f 49 S.# define NO_I
03c0: 44 45 41 0a 23 20 20 64 65 66 69 6e 65 20 4e 4f DEA.# define NO
03d0: 5f 52 43 32 0a 23 20 20 64 65 66 69 6e 65 20 4e _RC2.# define N
03e0: 4f 5f 52 43 34 0a 23 20 20 64 65 66 69 6e 65 20 O_RC4.# define
03f0: 4e 4f 5f 52 43 35 0a 23 20 20 64 65 66 69 6e 65 NO_RC5.# define
0400: 20 4e 4f 5f 52 53 41 0a 23 20 20 69 66 6e 64 65 NO_RSA.# ifnde
0410: 66 20 4e 4f 5f 53 53 4c 32 0a 23 20 20 20 20 64 f NO_SSL2.# d
0420: 65 66 69 6e 65 20 4e 4f 5f 53 53 4c 32 0a 23 20 efine NO_SSL2.#
0430: 20 65 6e 64 69 66 0a 23 65 6e 64 69 66 0a 0a 23 endif.#endif..#
0440: 69 6e 63 6c 75 64 65 20 3c 6f 70 65 6e 73 73 6c include <openssl
0450: 2f 73 73 6c 2e 68 3e 0a 23 69 6e 63 6c 75 64 65 /ssl.h>.#include
0460: 20 3c 6f 70 65 6e 73 73 6c 2f 65 72 72 2e 68 3e <openssl/err.h>
0470: 0a 23 69 6e 63 6c 75 64 65 20 3c 6f 70 65 6e 73 .#include <opens
0480: 73 6c 2f 72 61 6e 64 2e 68 3e 0a 23 69 6e 63 6c sl/rand.h>.#incl
0490: 75 64 65 20 3c 6f 70 65 6e 73 73 6c 2f 6f 70 65 ude <openssl/ope
04a0: 6e 73 73 6c 76 2e 68 3e 0a 0a 2f 2a 0a 20 2a 20 nsslv.h>../*. *
04b0: 44 65 74 65 72 6d 69 6e 65 20 69 66 20 77 65 20 Determine if we
04c0: 73 68 6f 75 6c 64 20 75 73 65 20 74 68 65 20 70 should use the p
04d0: 72 65 2d 4f 70 65 6e 53 53 4c 20 31 2e 31 2e 30 re-OpenSSL 1.1.0
04e0: 20 41 50 49 0a 20 2a 2f 0a 23 75 6e 64 65 66 20 API. */.#undef
04f0: 54 43 4c 54 4c 53 5f 4f 50 45 4e 53 53 4c 5f 50 TCLTLS_OPENSSL_P
0500: 52 45 5f 31 5f 31 0a 23 69 66 20 28 64 65 66 69 RE_1_1.#if (defi
0510: 6e 65 64 28 4c 49 42 52 45 53 53 4c 5f 56 45 52 ned(LIBRESSL_VER
0520: 53 49 4f 4e 5f 4e 55 4d 42 45 52 29 29 20 7c 7c SION_NUMBER)) ||
0530: 20 4f 50 45 4e 53 53 4c 5f 56 45 52 53 49 4f 4e OPENSSL_VERSION
0540: 5f 4e 55 4d 42 45 52 20 3c 20 30 78 31 30 31 30 _NUMBER < 0x1010
0550: 30 30 30 30 4c 0a 23 20 20 64 65 66 69 6e 65 20 0000L.# define
0560: 54 43 4c 54 4c 53 5f 4f 50 45 4e 53 53 4c 5f 50 TCLTLS_OPENSSL_P
0570: 52 45 5f 31 5f 31 5f 41 50 49 20 31 0a 23 65 6e RE_1_1_API 1.#en
0580: 64 69 66 0a 0a 23 69 66 6e 64 65 66 20 45 43 4f dif..#ifndef ECO
0590: 4e 4e 41 42 4f 52 54 45 44 0a 23 64 65 66 69 6e NNABORTED.#defin
05a0: 65 20 45 43 4f 4e 4e 41 42 4f 52 54 45 44 09 31 e ECONNABORTED.1
05b0: 33 30 09 2f 2a 20 53 6f 66 74 77 61 72 65 20 63 30./* Software c
05c0: 61 75 73 65 64 20 63 6f 6e 6e 65 63 74 69 6f 6e aused connection
05d0: 20 61 62 6f 72 74 20 2a 2f 0a 23 65 6e 64 69 66 abort */.#endif
05e0: 0a 23 69 66 6e 64 65 66 20 45 43 4f 4e 4e 52 45 .#ifndef ECONNRE
05f0: 53 45 54 0a 23 64 65 66 69 6e 65 20 45 43 4f 4e SET.#define ECON
0600: 4e 52 45 53 45 54 09 31 33 31 09 2f 2a 20 43 6f NRESET.131./* Co
0610: 6e 6e 65 63 74 69 6f 6e 20 72 65 73 65 74 20 62 nnection reset b
0620: 79 20 70 65 65 72 20 2a 2f 0a 23 65 6e 64 69 66 y peer */.#endif
0630: 0a 0a 23 69 66 64 65 66 20 54 43 4c 45 58 54 5f ..#ifdef TCLEXT_
0640: 54 43 4c 54 4c 53 5f 44 45 42 55 47 0a 23 64 65 TCLTLS_DEBUG.#de
0650: 66 69 6e 65 20 64 70 72 69 6e 74 66 28 2e 2e 2e fine dprintf(...
0660: 29 20 7b 20 66 70 72 69 6e 74 66 28 73 74 64 65 ) { fprintf(stde
0670: 72 72 2c 20 22 25 73 3a 25 69 3a 22 2c 20 5f 5f rr, "%s:%i:", __
0680: 66 75 6e 63 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f func__, __LINE__
0690: 29 3b 20 66 70 72 69 6e 74 66 28 73 74 64 65 72 ); fprintf(stder
06a0: 72 2c 20 5f 5f 56 41 5f 41 52 47 53 5f 5f 29 3b r, __VA_ARGS__);
06b0: 20 66 70 72 69 6e 74 66 28 73 74 64 65 72 72 2c fprintf(stderr,
06c0: 20 22 5c 6e 22 29 3b 20 7d 0a 23 65 6c 73 65 0a "\n"); }.#else.
06d0: 23 64 65 66 69 6e 65 20 64 70 72 69 6e 74 66 28 #define dprintf(
06e0: 2e 2e 2e 29 20 69 66 20 28 30 29 20 7b 20 66 70 ...) if (0) { fp
06f0: 72 69 6e 74 66 28 73 74 64 65 72 72 2c 20 5f 5f rintf(stderr, __
0700: 56 41 5f 41 52 47 53 5f 5f 29 3b 20 7d 0a 23 65 VA_ARGS__); }.#e
0710: 6e 64 69 66 0a 0a 23 64 65 66 69 6e 65 20 54 43 ndif..#define TC
0720: 4c 54 4c 53 5f 53 53 4c 5f 45 52 52 4f 52 28 73 LTLS_SSL_ERROR(s
0730: 73 6c 2c 65 72 72 29 20 28 28 63 68 61 72 2a 29 sl,err) ((char*)
0740: 45 52 52 5f 72 65 61 73 6f 6e 5f 65 72 72 6f 72 ERR_reason_error
0750: 5f 73 74 72 69 6e 67 28 28 75 6e 73 69 67 6e 65 _string((unsigne
0760: 64 20 6c 6f 6e 67 29 53 53 4c 5f 67 65 74 5f 65 d long)SSL_get_e
0770: 72 72 6f 72 28 28 73 73 6c 29 2c 28 65 72 72 29 rror((ssl),(err)
0780: 29 29 29 0a 2f 2a 0a 20 2a 20 4f 70 65 6e 53 53 )))./*. * OpenSS
0790: 4c 20 42 49 4f 20 52 6f 75 74 69 6e 65 73 0a 20 L BIO Routines.
07a0: 2a 2f 0a 23 64 65 66 69 6e 65 20 42 49 4f 5f 54 */.#define BIO_T
07b0: 59 50 45 5f 54 43 4c 09 28 31 39 7c 30 78 30 34 YPE_TCL.(19|0x04
07c0: 30 30 29 0a 0a 2f 2a 0a 20 2a 20 44 65 66 69 6e 00)../*. * Defin
07d0: 65 73 20 66 6f 72 20 53 74 61 74 65 2e 66 6c 61 es for State.fla
07e0: 67 73 0a 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 gs. */.#define T
07f0: 4c 53 5f 54 43 4c 5f 41 53 59 4e 43 09 28 31 3c LS_TCL_ASYNC.(1<
0800: 3c 30 29 09 2f 2a 20 6e 6f 6e 2d 62 6c 6f 63 6b <0)./* non-block
0810: 69 6e 67 20 6d 6f 64 65 20 2a 2f 0a 23 64 65 66 ing mode */.#def
0820: 69 6e 65 20 54 4c 53 5f 54 43 4c 5f 53 45 52 56 ine TLS_TCL_SERV
0830: 45 52 09 28 31 3c 3c 31 29 09 2f 2a 20 53 65 72 ER.(1<<1)./* Ser
0840: 76 65 72 2d 53 69 64 65 20 2a 2f 0a 23 64 65 66 ver-Side */.#def
0850: 69 6e 65 20 54 4c 53 5f 54 43 4c 5f 49 4e 49 54 ine TLS_TCL_INIT
0860: 09 28 31 3c 3c 32 29 09 2f 2a 20 49 6e 69 74 69 .(1<<2)./* Initi
0870: 61 6c 69 7a 69 6e 67 20 63 6f 6e 6e 65 63 74 69 alizing connecti
0880: 6f 6e 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 4c on */.#define TL
0890: 53 5f 54 43 4c 5f 44 45 42 55 47 09 28 31 3c 3c S_TCL_DEBUG.(1<<
08a0: 33 29 09 2f 2a 20 53 68 6f 77 20 64 65 62 75 67 3)./* Show debug
08b0: 20 74 72 61 63 69 6e 67 20 2a 2f 0a 23 64 65 66 tracing */.#def
08c0: 69 6e 65 20 54 4c 53 5f 54 43 4c 5f 43 41 4c 4c ine TLS_TCL_CALL
08d0: 42 41 43 4b 09 28 31 3c 3c 34 29 09 2f 2a 20 49 BACK.(1<<4)./* I
08e0: 6e 20 61 20 63 61 6c 6c 62 61 63 6b 2c 20 70 72 n a callback, pr
08f0: 65 76 65 6e 74 20 75 70 64 61 74 65 0a 09 09 09 event update....
0900: 09 09 20 2a 20 6c 6f 6f 70 69 6e 67 20 70 72 6f .. * looping pro
0910: 62 6c 65 6d 2e 20 5b 42 75 67 20 31 36 35 32 33 blem. [Bug 16523
0920: 38 30 5d 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 80] */.#define T
0930: 4c 53 5f 54 43 4c 5f 48 41 4e 44 53 48 41 4b 45 LS_TCL_HANDSHAKE
0940: 5f 46 41 49 4c 45 44 20 28 31 3c 3c 35 29 20 2f _FAILED (1<<5) /
0950: 2a 20 53 65 74 20 6f 6e 20 68 61 6e 64 73 68 61 * Set on handsha
0960: 6b 65 20 66 61 69 6c 75 72 65 73 20 61 6e 64 20 ke failures and
0970: 6f 6e 63 65 0a 20 20 20 20 20 20 20 20 20 20 20 once.
0980: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0990: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 20 *
09a0: 73 65 74 2c 20 61 6c 6c 20 66 75 72 74 68 65 72 set, all further
09b0: 20 49 2f 4f 20 77 69 6c 6c 20 72 65 73 75 6c 74 I/O will result
09c0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
09d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
09e0: 20 20 20 20 20 20 20 20 20 20 2a 20 69 6e 20 45 * in E
09f0: 43 4f 4e 4e 41 42 4f 52 54 45 44 20 65 72 72 6f CONNABORTED erro
0a00: 72 73 2e 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 rs. */..#define
0a10: 54 4c 53 5f 54 43 4c 5f 44 45 4c 41 59 20 28 35 TLS_TCL_DELAY (5
0a20: 29 0a 0a 2f 2a 0a 20 2a 20 54 68 69 73 20 73 74 )../*. * This st
0a30: 72 75 63 74 75 72 65 20 64 65 73 63 72 69 62 65 ructure describe
0a40: 73 20 74 68 65 20 70 65 72 2d 69 6e 73 74 61 6e s the per-instan
0a50: 63 65 20 73 74 61 74 65 0a 20 2a 20 6f 66 20 61 ce state. * of a
0a60: 6e 20 73 73 6c 20 63 68 61 6e 6e 65 6c 2e 0a 20 n ssl channel..
0a70: 2a 0a 20 2a 20 54 68 65 20 53 53 4c 20 70 72 6f *. * The SSL pro
0a80: 63 65 73 73 69 6e 67 20 63 6f 6e 74 65 78 74 20 cessing context
0a90: 69 73 20 6d 61 69 6e 74 61 69 6e 65 64 20 68 65 is maintained he
0aa0: 72 65 2c 20 69 6e 20 74 68 65 20 43 6c 69 65 6e re, in the Clien
0ab0: 74 44 61 74 61 0a 20 2a 2f 0a 74 79 70 65 64 65 tData. */.typede
0ac0: 66 20 73 74 72 75 63 74 20 53 74 61 74 65 20 7b f struct State {
0ad0: 0a 09 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 73 65 ..Tcl_Channel se
0ae0: 6c 66 3b 20 20 20 20 20 20 20 2f 2a 20 74 68 69 lf; /* thi
0af0: 73 20 73 6f 63 6b 65 74 20 63 68 61 6e 6e 65 6c s socket channel
0b00: 20 2a 2f 0a 09 54 63 6c 5f 54 69 6d 65 72 54 6f */..Tcl_TimerTo
0b10: 6b 65 6e 20 74 69 6d 65 72 3b 0a 0a 09 69 6e 74 ken timer;...int
0b20: 20 66 6c 61 67 73 3b 20 20 20 20 20 20 20 20 20 flags;
0b30: 20 20 20 20 20 2f 2a 20 73 65 65 20 53 74 61 74 /* see Stat
0b40: 65 2e 66 6c 61 67 73 20 61 62 6f 76 65 20 20 2a e.flags above *
0b50: 2f 0a 09 69 6e 74 20 77 61 74 63 68 4d 61 73 6b /..int watchMask
0b60: 3b 20 20 20 20 20 20 20 20 20 20 2f 2a 20 63 75 ; /* cu
0b70: 72 72 65 6e 74 20 57 61 74 63 68 50 72 6f 63 20 rrent WatchProc
0b80: 6d 61 73 6b 20 2a 2f 0a 09 69 6e 74 20 6d 6f 64 mask */..int mod
0b90: 65 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e;
0ba0: 20 2f 2a 20 63 75 72 72 65 6e 74 20 6d 6f 64 65 /* current mode
0bb0: 20 6f 66 20 70 61 72 65 6e 74 20 63 68 61 6e 6e of parent chann
0bc0: 65 6c 20 2a 2f 0a 0a 09 54 63 6c 5f 49 6e 74 65 el */...Tcl_Inte
0bd0: 72 70 20 2a 69 6e 74 65 72 70 3b 20 20 20 20 20 rp *interp;
0be0: 2f 2a 20 69 6e 74 65 72 70 72 65 74 65 72 20 69 /* interpreter i
0bf0: 6e 20 77 68 69 63 68 20 74 68 69 73 20 72 65 73 n which this res
0c00: 69 64 65 73 20 2a 2f 0a 09 54 63 6c 5f 4f 62 6a ides */..Tcl_Obj
0c10: 20 2a 63 61 6c 6c 62 61 63 6b 3b 20 20 20 20 20 *callback;
0c20: 20 2f 2a 20 73 63 72 69 70 74 20 63 61 6c 6c 65 /* script calle
0c30: 64 20 66 6f 72 20 74 72 61 63 69 6e 67 2c 20 76 d for tracing, v
0c40: 65 72 69 66 79 69 6e 67 20 61 6e 64 20 65 72 72 erifying and err
0c50: 6f 72 73 20 2a 2f 0a 09 54 63 6c 5f 4f 62 6a 20 ors */..Tcl_Obj
0c60: 2a 70 61 73 73 77 6f 72 64 3b 20 20 20 20 20 20 *password;
0c70: 2f 2a 20 73 63 72 69 70 74 20 63 61 6c 6c 65 64 /* script called
0c80: 20 66 6f 72 20 63 65 72 74 69 66 69 63 61 74 65 for certificate
0c90: 20 70 61 73 73 77 6f 72 64 20 2a 2f 20 0a 0a 09 password */ ...
0ca0: 69 6e 74 20 76 66 6c 61 67 73 3b 20 20 20 20 20 int vflags;
0cb0: 20 20 20 20 20 20 20 20 2f 2a 20 76 65 72 69 66 /* verif
0cc0: 79 20 66 6c 61 67 73 20 2a 2f 0a 09 53 53 4c 20 y flags */..SSL
0cd0: 2a 73 73 6c 3b 20 20 20 20 20 20 20 20 20 20 20 *ssl;
0ce0: 20 20 20 20 2f 2a 20 53 74 72 75 63 74 20 66 6f /* Struct fo
0cf0: 72 20 53 53 4c 20 70 72 6f 63 65 73 73 69 6e 67 r SSL processing
0d00: 20 2a 2f 0a 09 53 53 4c 5f 43 54 58 20 2a 63 74 */..SSL_CTX *ct
0d10: 78 3b 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 x; /*
0d20: 53 53 4c 20 43 6f 6e 74 65 78 74 20 2a 2f 0a 09 SSL Context */..
0d30: 42 49 4f 20 2a 62 69 6f 3b 20 20 20 20 20 20 20 BIO *bio;
0d40: 20 20 20 20 20 20 20 20 2f 2a 20 53 74 72 75 63 /* Struc
0d50: 74 20 66 6f 72 20 53 53 4c 20 70 72 6f 63 65 73 t for SSL proces
0d60: 73 69 6e 67 20 2a 2f 0a 09 42 49 4f 20 2a 70 5f sing */..BIO *p_
0d70: 62 69 6f 3b 20 20 20 20 20 20 20 20 20 20 20 20 bio;
0d80: 20 2f 2a 20 50 61 72 65 6e 74 20 42 49 4f 20 28 /* Parent BIO (
0d90: 74 68 61 74 20 69 73 20 6c 61 79 65 72 65 64 20 that is layered
0da0: 6f 6e 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 29 20 on Tcl_Channel)
0db0: 2a 2f 0a 0a 09 63 68 61 72 20 2a 65 72 72 3b 0a */...char *err;.
0dc0: 7d 20 53 74 61 74 65 3b 0a 0a 23 69 66 64 65 66 } State;..#ifdef
0dd0: 20 55 53 45 5f 54 43 4c 5f 53 54 55 42 53 0a 23 USE_TCL_STUBS.#
0de0: 69 66 6e 64 65 66 20 54 63 6c 5f 53 74 61 63 6b ifndef Tcl_Stack
0df0: 43 68 61 6e 6e 65 6c 0a 23 65 72 72 6f 72 20 22 Channel.#error "
0e00: 55 6e 61 62 6c 65 20 74 6f 20 63 6f 6d 70 69 6c Unable to compil
0e10: 65 20 6f 6e 20 74 68 69 73 20 76 65 72 73 69 6f e on this versio
0e20: 6e 20 6f 66 20 54 63 6c 22 0a 23 65 6e 64 69 66 n of Tcl".#endif
0e30: 20 2f 2a 20 54 63 6c 5f 47 65 74 53 74 61 63 6b /* Tcl_GetStack
0e40: 65 64 43 68 61 6e 6e 65 6c 20 2a 2f 0a 23 65 6e edChannel */.#en
0e50: 64 69 66 20 2f 2a 20 55 53 45 5f 54 43 4c 5f 53 dif /* USE_TCL_S
0e60: 54 55 42 53 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 46 TUBS */../*. * F
0e70: 6f 72 77 61 72 64 20 64 65 63 6c 61 72 61 74 69 orward declarati
0e80: 6f 6e 73 0a 20 2a 2f 0a 54 63 6c 5f 43 68 61 6e ons. */.Tcl_Chan
0e90: 6e 65 6c 54 79 70 65 20 2a 54 6c 73 5f 43 68 61 nelType *Tls_Cha
0ea0: 6e 6e 65 6c 54 79 70 65 28 76 6f 69 64 29 3b 0a nnelType(void);.
0eb0: 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 20 20 20 20 Tcl_Channel
0ec0: 54 6c 73 5f 47 65 74 50 61 72 65 6e 74 28 53 74 Tls_GetParent(St
0ed0: 61 74 65 20 2a 73 74 61 74 65 50 74 72 29 3b 0a ate *statePtr);.
0ee0: 0a 54 63 6c 5f 4f 62 6a 20 20 20 20 20 20 20 20 .Tcl_Obj
0ef0: 20 2a 54 6c 73 5f 4e 65 77 58 35 30 39 4f 62 6a *Tls_NewX509Obj
0f00: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 (Tcl_Interp *int
0f10: 65 72 70 2c 20 58 35 30 39 20 2a 63 65 72 74 29 erp, X509 *cert)
0f20: 3b 0a 76 6f 69 64 20 20 20 20 20 20 20 20 20 20 ;.void
0f30: 20 20 54 6c 73 5f 45 72 72 6f 72 28 53 74 61 74 Tls_Error(Stat
0f40: 65 20 2a 73 74 61 74 65 50 74 72 2c 20 63 68 61 e *statePtr, cha
0f50: 72 20 2a 6d 73 67 29 3b 0a 76 6f 69 64 20 20 20 r *msg);.void
0f60: 20 20 20 20 20 20 20 20 20 54 6c 73 5f 46 72 65 Tls_Fre
0f70: 65 28 63 68 61 72 20 2a 62 6c 6f 63 6b 50 74 72 e(char *blockPtr
0f80: 29 3b 0a 76 6f 69 64 20 20 20 20 20 20 20 20 20 );.void
0f90: 20 20 20 54 6c 73 5f 43 6c 65 61 6e 28 53 74 61 Tls_Clean(Sta
0fa0: 74 65 20 2a 73 74 61 74 65 50 74 72 29 3b 0a 69 te *statePtr);.i
0fb0: 6e 74 20 20 20 20 20 20 20 20 20 20 20 20 20 54 nt T
0fc0: 6c 73 5f 57 61 69 74 46 6f 72 43 6f 6e 6e 65 63 ls_WaitForConnec
0fd0: 74 28 53 74 61 74 65 20 2a 73 74 61 74 65 50 74 t(State *statePt
0fe0: 72 2c 20 69 6e 74 20 2a 65 72 72 6f 72 43 6f 64 r, int *errorCod
0ff0: 65 50 74 72 29 3b 0a 0a 42 49 4f 20 20 20 20 20 ePtr);..BIO
1000: 20 20 20 20 20 20 20 20 2a 42 49 4f 5f 6e 65 77 *BIO_new
1010: 5f 74 63 6c 28 53 74 61 74 65 2a 20 73 74 61 74 _tcl(State* stat
1020: 65 50 74 72 2c 20 69 6e 74 20 66 6c 61 67 73 29 ePtr, int flags)
1030: 3b 0a 0a 23 65 6e 64 69 66 20 2f 2a 20 5f 54 4c ;..#endif /* _TL
1040: 53 49 4e 54 5f 48 20 2a 2f 0a SINT_H */.