Check-in [ee18d6c91e]
Bounty program for improvements to Tcl and certain Tcl packages.
Overview
Comment:Minor cleanup of global variables and void function
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tls-1-7
Files: files | file ages | folders
SHA1: ee18d6c91ec930139df8516afa96f48035e92194
User & Date: rkeene on 2016-12-02 16:09:19
Other Links: branch diff | manifest | tags
Context
2016-12-02
16:13
Cleaned up compiler warnings with debugging statements casting pointers to ints check-in: ac2c67d21d user: rkeene tags: tls-1-7
16:09
Minor cleanup of global variables and void function check-in: ee18d6c91e user: rkeene tags: tls-1-7
2016-12-01
21:51
Updated to support a deterministic mode check-in: bf7f82b5e8 user: rkeene tags: tls-1-7
Changes

Modified tls.c from [05e974345e] to [898daed710].

61
62
63
64
65
66
67
68

69
70
71
72
73
74
75
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75






-
+







static int	UnimportObjCmd _ANSI_ARGS_ ((ClientData clientData,
			Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]));

static SSL_CTX *CTX_Init _ANSI_ARGS_((State *statePtr, int proto, char *key,
			char *cert, char *CAdir, char *CAfile, char *ciphers,
			char *DHparams));

static int	TlsLibInit _ANSI_ARGS_ (()) ;
static int	TlsLibInit _ANSI_ARGS_ ((void)) ;

#define TLS_PROTO_SSL2		0x01
#define TLS_PROTO_SSL3		0x02
#define TLS_PROTO_TLS1		0x04
#define TLS_PROTO_TLS1_1	0x08
#define TLS_PROTO_TLS1_2	0x10
#define ENABLED(flag, mask)	(((flag) & (mask)) == (mask))
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
121
122
123
124
125
126
127

128
129
130
131
132
133
134






-







/*
 * Threaded operation requires locking callbacks
 * Based from /crypto/cryptlib.c of OpenSSL and NSOpenSSL.
 */

static Tcl_Mutex locks[CRYPTO_NUM_LOCKS];
static Tcl_Mutex init_mx;
static int initialized;

static void          CryptoThreadLockCallback (int mode, int n, const char *file, int line);
static unsigned long CryptoThreadIdCallback   (void);

static void
CryptoThreadLockCallback(int mode, int n, const char *file, int line)
{
1726
1727
1728
1729
1730
1731
1732
1733
1734


1735
1736
1737
1738
1739
1740
1741
1742
1725
1726
1727
1728
1729
1730
1731


1732
1733

1734
1735
1736
1737
1738
1739
1740






-
-
+
+
-







 *		initilizes SSL library
 *
 *	Result:
 *		none
 *
 *------------------------------------------------------*
 */
static int
TlsLibInit ()
static int TlsLibInit (void) {
    static int initialized = 0;
{
    int i;
    char rnd_seed[16] = "GrzSlplKqUdnnzP!";	/* 16 bytes */
    int status=TCL_OK;
#if defined(OPENSSL_THREADS) && defined(TCL_THREADS)
    size_t num_locks;

    if (initialized) {