Changes On Branch 60f37290f39260e3

Changes In Branch bug-f798e2ea12 Excluding Merge-Ins

This is equivalent to a diff from 12bf5e37e0 to 60f37290f3

2017-12-21
20:25
Merged in changes to address [f798e2ea12]. The code to manipulate the channel options may not be needed at all, we will review it to see if there are any issues with removing it altogether check-in: a811816bd3 user: rkeene tags: trunk
05:34
Added experiment patch for [f798e2ea12] to preserve channel state when importing a channel Closed-Leaf check-in: 60f37290f3 user: rkeene tags: bug-f798e2ea12
2017-11-08
15:00
TclTLS 1.7.14 check-in: 70cbcd6815 user: rkeene tags: tls-1-7, tls-1-7-14
14:59
Still looking into this Leaf check-in: 7793b78e70 user: rkeene tags: bug-eof-loop-6dd5588df6-2
2017-10-17
03:57
Updated to use a more commonly accepted regexp when replacing the OpenSSL function name (addresses [6c9bf49455]) check-in: 12bf5e37e0 user: rkeene tags: trunk
2017-09-01
00:16
Try harder to ensure the right SSL libraries are used check-in: 6704c33e48 user: rkeene tags: trunk

Modified tls.c from [0dc23990ac] to [73f6874245].

718
719
720
721
722
723
724


725
726
727
728
729
730
731
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733







+
+







    Tcl_Obj *CONST objv[];
{
    Tcl_Channel chan;		/* The channel to set a mode on. */
    State *statePtr;		/* client state for ssl socket */
    SSL_CTX *ctx	= NULL;
    Tcl_Obj *script	= NULL;
    Tcl_Obj *password	= NULL;
    Tcl_DString upperChannelTranslation;
    Tcl_DString upperChannelBlocking;
    int idx, len;
    int flags		= TLS_TCL_INIT;
    int server		= 0;	/* is connection incoming or outgoing? */
    char *key		= NULL;
    char *cert		= NULL;
    char *ciphers	= NULL;
    char *CAfile	= NULL;
882
883
884
885
886
887
888




889
890
891
892
893
894
895
896
897
898
899
900



901
902
903
904
905
906
907
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916







+
+
+
+












+
+
+








    /*
     * We need to make sure that the channel works in binary (for the
     * encryption not to get goofed up).
     * We only want to adjust the buffering in pre-v2 channels, where
     * each channel in the stack maintained its own buffers.
     */
    Tcl_DStringInit(&upperChannelTranslation);
    Tcl_DStringInit(&upperChannelBlocking);
    Tcl_GetChannelOption(interp, chan, "-translation", &upperChannelTranslation);
    Tcl_GetChannelOption(interp, chan, "-blocking", &upperChannelBlocking);
    Tcl_SetChannelOption(interp, chan, "-translation", "binary");
    Tcl_SetChannelOption(interp, chan, "-blocking", "true");
    dprintf("Consuming Tcl channel %s", Tcl_GetChannelName(chan));
    statePtr->self = Tcl_StackChannel(interp, Tls_ChannelType(), (ClientData) statePtr, (TCL_READABLE | TCL_WRITABLE), chan);
    dprintf("Created channel named %s", Tcl_GetChannelName(statePtr->self));
    if (statePtr->self == (Tcl_Channel) NULL) {
	/*
	 * No use of Tcl_EventuallyFree because no possible Tcl_Preserve.
	 */
	Tls_Free((char *) statePtr);
	return TCL_ERROR;
    }

    Tcl_SetChannelOption(interp, statePtr->self, "-translation", Tcl_DStringValue(&upperChannelTranslation));
    Tcl_SetChannelOption(interp, statePtr->self, "-blocking", Tcl_DStringValue(&upperChannelBlocking));

    /*
     * SSL Initialization
     */

    statePtr->ssl = SSL_new(statePtr->ctx);
    if (!statePtr->ssl) {