Diff

Differences From Artifact [63f1a729cf]:

To Artifact [31dba4da9e]:


1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747






1748
1749
1750
1751
1752
1753
1754
1730
1731
1732
1733
1734
1735
1736


1737
1738
1739
1740





1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753







-
-




-
-
-
-
-
+
+
+
+
+
+







 *------------------------------------------------------*
 */
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) {
        return status;
    }
	Tcl_MutexLock(&init_mx);
	if (!initialized) {
	    initialized = 1;
#else
       {
    initialized = 1;

#if defined(OPENSSL_THREADS) && defined(TCL_THREADS)
    size_t num_locks;

    Tcl_MutexLock(&init_mx);
#endif

	    if (CRYPTO_set_mem_functions((void *(*)(size_t))Tcl_Alloc,
					 (void *(*)(void *, size_t))Tcl_Realloc,
					 (void(*)(void *))Tcl_Free) == 0) {
	       /* Not using Tcl's mem functions ... not critical */
	    }
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1784
1785
1786
1787
1788
1789
1790


1791
1792
1793
1794
1795
1796
1797







-
-







	    srand((unsigned int) time((time_t *) NULL));
	    do {
		for (i = 0; i < 16; i++) {
		    rnd_seed[i] = 1 + (char) (255.0 * rand()/(RAND_MAX+1.0));
		}
		RAND_seed(rnd_seed, sizeof(rnd_seed));
	    } while (RAND_status() != 1);
	}

done:

#if defined(OPENSSL_THREADS) && defined(TCL_THREADS)
	Tcl_MutexUnlock(&init_mx);
#endif
    return status;
}