Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -227,11 +227,11 @@ #======================================================================== $(PKG_LIB_FILE): $(PKG_OBJECTS) -rm -f $(PKG_LIB_FILE) ${MAKE_LIB} - $(RANLIB) $(PKG_LIB_FILE) + -$(RANLIB) $(PKG_LIB_FILE) #======================================================================== # We need to enumerate the list of .c to .o lines here. # # In the following lines, $(srcdir) refers to the toplevel directory Index: configure ================================================================== --- configure +++ configure @@ -1385,21 +1385,25 @@ echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi EXEEXT=".exe" - TEA_PLATFORM="windows" + if [ -z "${TEA_PLATFORM}" ]; then + TEA_PLATFORM="windows" + fi ;; *CYGWIN_*) CYGPATH=echo EXEEXT=".exe" # TEA_PLATFORM is determined later ;; *) CYGPATH=echo EXEEXT="" - TEA_PLATFORM="unix" + if [ -z "${TEA_PLATFORM}" ]; then + TEA_PLATFORM="unix" + fi ;; esac # Check if exec_prefix is set. If not use fall back to prefix. # Note when adjusted, so that TEA_PREFIX can correct for this. @@ -1680,17 +1684,21 @@ *CYGWIN_*) echo "$as_me:$LINENO: checking for cygwin variant" >&5 echo $ECHO_N "checking for cygwin variant... $ECHO_C" >&6 case ${TCL_EXTRA_CFLAGS} in *-mwin32*|*-mno-cygwin*) - TEA_PLATFORM="windows" + if [ -z "${TEA_PLATFORM}" ]; then + TEA_PLATFORM="windows" + fi CFLAGS="$CFLAGS -mwin32" echo "$as_me:$LINENO: result: win32" >&5 echo "${ECHO_T}win32" >&6 ;; *) - TEA_PLATFORM="unix" + if [ -z "${TEA_PLATFORM}" ]; then + TEA_PLATFORM="unix" + fi echo "$as_me:$LINENO: result: unix" >&5 echo "${ECHO_T}unix" >&6 ;; esac EXEEXT=".exe" @@ -10314,11 +10322,11 @@ fi if test -n "${OPENSSL}"; then - vars="ssleay32.lib libeay32.lib" + vars="ssl.lib crypto.lib" for i in $vars; do if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then # Convert foo.lib to -lfoo for GCC. No-op if not *.lib i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'` fi Index: tls.c ================================================================== --- tls.c +++ tls.c @@ -1770,19 +1770,19 @@ static int TlsLibInit () { int i; char rnd_seed[16] = "GrzSlplKqUdnnzP!"; /* 16 bytes */ + int status=TCL_OK; #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) size_t num_locks; -#endif - int status=TCL_OK; if (!initialized) { Tcl_MutexLock(&init_mx); if (!initialized) { initialized = 1; +#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 */ @@ -1825,9 +1825,11 @@ 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; } Index: tlsIO.c ================================================================== --- tlsIO.c +++ tlsIO.c @@ -931,10 +931,13 @@ return -1; } else { continue; } } else if (err == 0) { + if (Tcl_Eof(statePtr->self)) { + return 0; + } dprintf(stderr,"CR! "); *errorCodePtr = ECONNRESET; return -1; } if (statePtr->flags & TLS_TCL_SERVER) { Index: tlsX509.c ================================================================== --- tlsX509.c +++ tlsX509.c @@ -98,16 +98,18 @@ char subject[BUFSIZ]; char issuer[BUFSIZ]; char serial[BUFSIZ]; char notBefore[BUFSIZ]; char notAfter[BUFSIZ]; + char certStr[BUFSIZ]; #ifndef NO_SSL_SHA int shai; char sha_hash[SHA_DIGEST_LENGTH*2]; const char *shachars="0123456789ABCDEF"; #endif + certStr[0] = 0; if ((bio = BIO_new(BIO_s_mem())) == NULL) { subject[0] = 0; issuer[0] = 0; serial[0] = 0; } else { @@ -129,10 +131,17 @@ i2a_ASN1_INTEGER(bio, X509_get_serialNumber(cert)); n = BIO_read(bio, serial, min(BIO_pending(bio), BUFSIZ - 1)); n = max(n, 0); serial[n] = 0; BIO_flush(bio); + + if (PEM_write_bio_X509(bio, cert)) { + n = BIO_read(bio, certStr, min(BIO_pending(bio), BUFSIZ - 1)); + n = max(n, 0); + certStr[n] = 0; + BIO_flush(bio); + } BIO_free(bio); } strcpy( notBefore, ASN1_UTCTIME_tostr( X509_get_notBefore(cert) )); @@ -172,8 +181,13 @@ Tcl_ListObjAppendElement( interp, certPtr, Tcl_NewStringObj( "serial", -1) ); Tcl_ListObjAppendElement( interp, certPtr, Tcl_NewStringObj( serial, -1) ); + + Tcl_ListObjAppendElement( interp, certPtr, + Tcl_NewStringObj( "certificate", -1) ); + Tcl_ListObjAppendElement( interp, certPtr, + Tcl_NewStringObj( certStr, -1) ); return certPtr; }