Check-in [5bc402b4bf]
Bounty program for improvements to Tcl and certain Tcl packages.
Overview
Comment: * tlsBIO.c: * tlsIO.c: corrected pedantic cast errors.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5bc402b4bf6d02a7a982121a00bef6a4078cae6c
User & Date: hobbs on 2000-08-18 19:17:36
Other Links: manifest | tags
Context
2000-08-18
19:17
* configure.in (OPENSSL): added NO_IDEA and NO_RC5 defines by default when compiling with OpenSSL. check-in: a0a17d252a user: hobbs tags: trunk
19:17
* tlsBIO.c: * tlsIO.c: corrected pedantic cast errors. check-in: 5bc402b4bf user: hobbs tags: trunk
19:17
* tlsInt.h: added err.h include check-in: 32a23903b7 user: hobbs tags: trunk
Changes

Modified tlsBIO.c from [c6f920b02f] to [61828ed639].

     1      1   /*
     2      2    * Copyright (C) 1997-2000 Matt Newman <[email protected]>
     3      3    *
     4         - * $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tlsBIO.c,v 1.4 2000/08/15 00:02:08 hobbs Exp $
            4  + * $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tlsBIO.c,v 1.5 2000/08/18 19:17:36 hobbs Exp $
     5      5    *
     6      6    * Provides BIO layer to interface openssl to Tcl.
     7      7    */
     8      8   
     9      9   #include "tlsInt.h"
    10     10   
    11     11   /*
................................................................................
    57     57       BIO *bio;
    58     58       char *buf;
    59     59       int bufLen;
    60     60   {
    61     61       Tcl_Channel chan = Tls_GetParent((State*)(bio->ptr));
    62     62       int ret;
    63     63   
    64         -    dprintf(stderr,"\nBioWrite(0x%x, <buf>, %d) [0x%x]", bio, bufLen, chan);
           64  +    dprintf(stderr,"\nBioWrite(0x%x, <buf>, %d) [0x%x]",
           65  +	    (unsigned int) bio, bufLen, (unsigned int) chan);
    65     66   
    66     67       if (channelTypeVersion == TLS_CHANNEL_VERSION_2) {
    67     68   	ret = Tcl_WriteRaw(chan, buf, bufLen);
    68     69       } else {
    69     70   	ret = Tcl_Write(chan, buf, bufLen);
    70     71       }
    71     72   
    72         -    dprintf(stderr,"\n[0x%x] BioWrite(%d) -> %d [%d.%d]", chan, bufLen, ret,
    73         -	    Tcl_Eof(chan), Tcl_GetErrno());
           73  +    dprintf(stderr,"\n[0x%x] BioWrite(%d) -> %d [%d.%d]",
           74  +	    (unsigned int) chan, bufLen, ret, Tcl_Eof(chan), Tcl_GetErrno());
    74     75   
    75     76       BIO_clear_flags(bio, BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY);
    76     77   
    77     78       if (ret == 0) {
    78     79   	if (!Tcl_Eof(chan)) {
    79     80   	    BIO_set_retry_write(bio);
    80     81   	    ret = -1;
................................................................................
    91     92       BIO *bio;
    92     93       char *buf;
    93     94       int bufLen;
    94     95   {
    95     96       Tcl_Channel chan = Tls_GetParent((State*)bio->ptr);
    96     97       int ret = 0;
    97     98   
    98         -    dprintf(stderr,"\nBioRead(0x%x, <buf>, %d) [0x%x]", bio, bufLen, chan);
           99  +    dprintf(stderr,"\nBioRead(0x%x, <buf>, %d) [0x%x]",
          100  +	    (unsigned int) bio, bufLen, (unsigned int) chan);
    99    101   
   100    102       if (buf == NULL) return 0;
   101    103   
   102    104       if (channelTypeVersion == TLS_CHANNEL_VERSION_2) {
   103    105   	ret = Tcl_ReadRaw(chan, buf, bufLen);
   104    106       } else {
   105    107   	ret = Tcl_Read(chan, buf, bufLen);
   106    108       }
   107    109   
   108         -    dprintf(stderr,"\n[0x%x] BioRead(%d) -> %d [%d.%d]", chan, bufLen, ret,
   109         -	    Tcl_Eof(chan), Tcl_GetErrno());
          110  +    dprintf(stderr,"\n[0x%x] BioRead(%d) -> %d [%d.%d]",
          111  +	    (unsigned int) chan, bufLen, ret, Tcl_Eof(chan), Tcl_GetErrno());
   110    112   
   111    113       BIO_clear_flags(bio, BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY);
   112    114   
   113    115       if (ret == 0) {
   114    116   	if (!Tcl_Eof(chan)) {
   115    117   	    BIO_set_retry_read(bio);
   116    118   	    ret = -1;
................................................................................
   137    139       long num;
   138    140       char *ptr;
   139    141   {
   140    142       Tcl_Channel chan = Tls_GetParent((State*)bio->ptr);
   141    143       long ret = 1;
   142    144       int *ip;
   143    145   
   144         -    dprintf(stderr,"\nBioCtrl(0x%x, 0x%x, 0x%x, 0x%x)", bio, cmd, num, ptr);
          146  +    dprintf(stderr,"\nBioCtrl(0x%x, 0x%x, 0x%x, 0x%x)",
          147  +	    (unsigned int) bio, (unsigned int) cmd, (unsigned int) num,
          148  +	    (unsigned int) ptr);
   145    149   
   146    150       switch (cmd) {
   147    151       case BIO_CTRL_RESET:
   148    152   	num = 0;
   149    153       case BIO_C_FILE_SEEK:
   150    154       case BIO_C_FILE_TELL:
   151    155   	ret = 0;
................................................................................
   179    183   	break;
   180    184       case BIO_CTRL_EOF:
   181    185   	dprintf(stderr, "BIO_CTRL_EOF\n");
   182    186   	ret = Tcl_Eof(chan);
   183    187   	break;
   184    188       case BIO_CTRL_PENDING:
   185    189   	ret = (Tcl_InputBuffered(chan) ? 1 : 0);
   186         -	dprintf(stderr, "BIO_CTRL_PENDING(%d)\n", ret);
          190  +	dprintf(stderr, "BIO_CTRL_PENDING(%d)\n", (int) ret);
   187    191   	break;
   188    192       case BIO_CTRL_WPENDING:
   189    193   	ret = 0;
   190    194   	break;
   191    195       case BIO_CTRL_DUP:
   192    196   	break;
   193    197       case BIO_CTRL_FLUSH:

Modified tlsIO.c from [76eadcab80] to [dc69f109fa].

     1      1   /*
     2      2    * Copyright (C) 1997-2000 Matt Newman <[email protected]>
     3      3    * Copyright (C) 2000 Ajuba Solutions
     4      4    *
     5         - * $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tlsIO.c,v 1.10 2000/08/15 18:49:30 hobbs Exp $
            5  + * $Header: /home/rkeene/tmp/cvs2fossil/../tcltls/tls/tls/tlsIO.c,v 1.11 2000/08/18 19:17:36 hobbs Exp $
     6      6    *
     7      7    * TLS (aka SSL) Channel - can be layered on any bi-directional
     8      8    * Tcl_Channel (Note: Requires Trf Core Patch)
     9      9    *
    10     10    * This was built from scratch based upon observation of OpenSSL 0.9.2B
    11     11    *
    12     12    * Addition credit is due for Andreas Kupries ([email protected]), for
................................................................................
   281    281    */
   282    282   static int
   283    283   TlsCloseProc(ClientData instanceData,	/* The socket to close. */
   284    284                Tcl_Interp *interp)	/* For error reporting - unused. */
   285    285   {
   286    286       State *statePtr = (State *) instanceData;
   287    287   
   288         -    dprintf(stderr,"\nTlsCloseProc(0x%x)", statePtr);
          288  +    dprintf(stderr,"\nTlsCloseProc(0x%x)", (unsigned int) statePtr);
   289    289   
   290    290       if (channelTypeVersion == TLS_CHANNEL_VERSION_1) {
   291    291   	/*
   292    292   	 * Remove event handler to underlying channel, this could
   293    293   	 * be because we are closing for real, or being "unstacked".
   294    294   	 */
   295    295   
................................................................................
   407    407                 int *errorCodePtr)	/* Where to store error code. */
   408    408   {
   409    409       State *statePtr = (State *) instanceData;
   410    410       int written, err;
   411    411   
   412    412       *errorCodePtr = 0;
   413    413   
   414         -    dprintf(stderr,"\nBIO_write(0x%x, %d)", statePtr, toWrite);
          414  +    dprintf(stderr,"\nBIO_write(0x%x, %d)", (unsigned int) statePtr, toWrite);
   415    415   
   416    416       if (!SSL_is_init_finished(statePtr->ssl)) {
   417    417   	written = Tls_WaitForConnect(statePtr, errorCodePtr);
   418    418   	if (written <= 0) {
   419    419   	    goto output;
   420    420   	}
   421    421       }
................................................................................
   438    438   	 * BIO_write specially (as advised in the RSA docs).  TLS's lower level
   439    439   	 * BIO functions play with the retry flags though, and this seems to
   440    440   	 * work correctly.  Similar fix in TlsInputProc. - hobbs
   441    441   	 */
   442    442   	ERR_clear_error();
   443    443   	written = BIO_write(statePtr->bio, buf, toWrite);
   444    444   	dprintf(stderr,"\nBIO_write(0x%x, %d) -> [%d]",
   445         -		statePtr, toWrite, written);
          445  +		(unsigned int) statePtr, toWrite, written);
   446    446       }
   447    447       if (written <= 0) {
   448    448   	switch ((err = SSL_get_error(statePtr->ssl, written))) {
   449    449   	    case SSL_ERROR_NONE:
   450    450   		if (written < 0) {
   451    451   		    written = 0;
   452    452   		}
................................................................................
   845    845   int
   846    846   Tls_WaitForConnect( statePtr, errorCodePtr)
   847    847       State *statePtr;
   848    848       int *errorCodePtr;		/* Where to store error code. */
   849    849   {
   850    850       int err;
   851    851   
   852         -    dprintf(stderr,"\nWaitForConnect(0x%x)", statePtr);
          852  +    dprintf(stderr,"\nWaitForConnect(0x%x)", (unsigned int) statePtr);
   853    853   
   854    854       for (;;) {
   855    855   	/* Not initialized yet! */
   856    856   	if (statePtr->flags & TLS_TCL_SERVER) {
   857    857   	    err = SSL_accept(statePtr->ssl);
   858    858   	} else {
   859    859   	    err = SSL_connect(statePtr->ssl);