--- tlsBIO.c Tue Feb 3 23:02:19 2004 +++ tlsBIO.c Mon Jun 20 10:18:45 2005 @@ -30,4 +30,5 @@ BioNew, BioFree, + NULL }; @@ -62,6 +63,6 @@ int ret; - dprintf(stderr,"\nBioWrite(0x%x, , %d) [0x%x]", - (unsigned int) bio, bufLen, (unsigned int) chan); + dprintf(stderr,"\nBioWrite(%p, , %d) [%p]", + (void *)bio, bufLen, (void *)chan); if (channelTypeVersion == TLS_CHANNEL_VERSION_2) { @@ -71,6 +72,6 @@ } - dprintf(stderr,"\n[0x%x] BioWrite(%d) -> %d [%d.%d]", - (unsigned int) chan, bufLen, ret, Tcl_Eof(chan), Tcl_GetErrno()); + dprintf(stderr,"\n[%p] BioWrite(%d) -> %d [%d.%d]", + (void *) chan, bufLen, ret, Tcl_Eof(chan), Tcl_GetErrno()); BIO_clear_flags(bio, BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY); @@ -97,6 +98,6 @@ int ret = 0; - dprintf(stderr,"\nBioRead(0x%x, , %d) [0x%x]", - (unsigned int) bio, bufLen, (unsigned int) chan); + dprintf(stderr,"\nBioRead(%p, , %d) [%p]", + (void *)bio, bufLen, (void *)chan); if (buf == NULL) return 0; @@ -108,6 +109,6 @@ } - dprintf(stderr,"\n[0x%x] BioRead(%d) -> %d [%d.%d]", - (unsigned int) chan, bufLen, ret, Tcl_Eof(chan), Tcl_GetErrno()); + dprintf(stderr,"\n[%p] BioRead(%d) -> %d [%d.%d]", + (void *) chan, bufLen, ret, Tcl_Eof(chan), Tcl_GetErrno()); BIO_clear_flags(bio, BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY); @@ -144,7 +145,6 @@ int *ip; - dprintf(stderr,"\nBioCtrl(0x%x, 0x%x, 0x%x, 0x%x)", - (unsigned int) bio, (unsigned int) cmd, (unsigned int) num, - (unsigned int) ptr); + dprintf(stderr,"\nBioCtrl(%p, 0x%x, 0x%lx, %p)", + (void *)bio, cmd, num, ptr); switch (cmd) { --- tlsIO.c 2015-06-06 09:07:08 UTC +++ tlsIO.c 2015-09-22 20:41:37 UTC @@ -287,5 +287,5 @@ State *statePtr = (State *) instanceData; - dprintf(stderr,"\nTlsCloseProc(0x%x)", (unsigned int) statePtr); + dprintf(stderr,"\nTlsCloseProc(%p)", instanceData); if (channelTypeVersion == TLS_CHANNEL_VERSION_1) { @@ -424,5 +424,5 @@ *errorCodePtr = 0; - dprintf(stderr,"\nBIO_write(0x%x, %d)", (unsigned int) statePtr, toWrite); + dprintf(stderr,"\nBIO_write(%p, %d)", instanceData, toWrite); if (statePtr->flags & TLS_TCL_CALLBACK) { @@ -444,5 +444,5 @@ if (toWrite == 0) { dprintf(stderr, "zero-write\n"); - BIO_flush(statePtr->bio); + (void)BIO_flush(statePtr->bio); written = 0; goto output; @@ -461,6 +461,6 @@ ERR_clear_error(); written = BIO_write(statePtr->bio, buf, toWrite); - dprintf(stderr,"\nBIO_write(0x%x, %d) -> [%d]", - (unsigned int) statePtr, toWrite, written); + dprintf(stderr,"\nBIO_write(%p, %d) -> [%d]", + instanceData, toWrite, written); } if (written <= 0) { @@ -543,5 +543,5 @@ return (*getOptionProc)(Tcl_GetChannelInstanceData(downChan), interp, optionName, dsPtr); - } else if (optionName == (char*) NULL) { + } else if (optionName == NULL) { /* * Request is query for all options, this is ok. @@ -554,10 +554,10 @@ return TCL_ERROR; } else { +#if 0 size_t len = 0; - if (optionName != (char *) NULL) { + if (optionName != NULL) { len = strlen(optionName); } -#if 0 if ((len == 0) || ((len > 1) && (optionName[1] == 'c') && (strncmp(optionName, "-cipher", len) == 0))) { @@ -888,5 +888,5 @@ int err; - dprintf(stderr,"\nWaitForConnect(0x%x)", (unsigned int) statePtr); + dprintf(stderr,"\nWaitForConnect(%p)", (void *)statePtr); if (statePtr->flags & TLS_TCL_HANDSHAKE_FAILED) { @@ -913,5 +913,5 @@ /*SSL_write(statePtr->ssl, (char*)&err, 0); HACK!!! */ if (err > 0) { - BIO_flush(statePtr->bio); + (void)BIO_flush(statePtr->bio); } --- tls.c 2015-07-07 17:16:02 UTC +++ tls.c 2015-09-22 20:18:04 UTC @@ -64,7 +64,7 @@ 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 SSL_CTX *CTX_Init _ANSI_ARGS_((State *statePtr, int proto, const char *key, + const char *cert, const char *CAdir, const char *CAfile, + const char *ciphers, const char *DHparams)); static int TlsLibInit _ANSI_ARGS_ (()) ; @@ -309,5 +309,5 @@ { Tcl_Obj *cmdPtr, *result; - char *errStr, *string; + const char *errStr; int length; SSL *ssl = (SSL*)X509_STORE_CTX_get_app_data(ctx); @@ -320,7 +320,7 @@ if (!ok) { - errStr = (char*)X509_verify_cert_error_string(err); + errStr = X509_verify_cert_error_string(err); } else { - errStr = (char *)0; + errStr = NULL; } @@ -350,5 +350,5 @@ Tcl_ListObjAppendElement( statePtr->interp, cmdPtr, - Tcl_NewStringObj( errStr ? errStr : "", -1) ); + Tcl_NewStringObj( errStr != NULL ? errStr : "", -1) ); Tcl_Preserve( (ClientData) statePtr->interp); @@ -364,5 +364,5 @@ } else { result = Tcl_GetObjResult(statePtr->interp); - string = Tcl_GetStringFromObj(result, &length); + Tcl_GetStringFromObj(result, &length); /* We only need the length */ /* An empty result leaves verification unchanged. */ if (length > 0) { @@ -532,5 +532,5 @@ }; enum protocol { - TLS_SSL2, TLS_SSL3, TLS_TLS1, TLS_TLS1_1, TLS_TLS1_2, TLS_NONE + TLS_SSL2, TLS_SSL3, TLS_TLS1, TLS_TLS1_1, TLS_TLS1_2 }; Tcl_Obj *objPtr; @@ -745,13 +745,13 @@ 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; - char *CAdir = NULL; - char *DHparams = NULL; - char *model = NULL; + const char *key = NULL; + const char *cert = NULL; + const char *ciphers = NULL; + const char *CAfile = NULL; + const char *CAdir = NULL; + const char *DHparams = NULL; + const char *model = NULL; #ifndef OPENSSL_NO_TLSEXT - char *servername = NULL; /* hostname for Server Name Indication */ + const char *servername = NULL; /* hostname for Server Name Indication */ #endif #if defined(NO_SSL2) @@ -1050,10 +1062,10 @@ State *statePtr; int proto; - char *key; - char *cert; - char *CAdir; - char *CAfile; - char *ciphers; - char *DHparams; + const char *key; + const char *cert; + const char *CAdir; + const char *CAfile; + const char *ciphers; + const char *DHparams; { Tcl_Interp *interp = statePtr->interp; @@ -1422,5 +1434,5 @@ { static CONST84 char *commands [] = { "req", NULL }; - enum command { C_REQ, C_DUMMY }; + enum command { C_REQ }; int cmd; @@ -1526,11 +1538,11 @@ name=X509_get_subject_name(cert); - X509_NAME_add_entry_by_txt(name,"C", MBSTRING_ASC, k_C, -1, -1, 0); - X509_NAME_add_entry_by_txt(name,"ST", MBSTRING_ASC, k_ST, -1, -1, 0); - X509_NAME_add_entry_by_txt(name,"L", MBSTRING_ASC, k_L, -1, -1, 0); - X509_NAME_add_entry_by_txt(name,"O", MBSTRING_ASC, k_O, -1, -1, 0); - X509_NAME_add_entry_by_txt(name,"OU", MBSTRING_ASC, k_OU, -1, -1, 0); - X509_NAME_add_entry_by_txt(name,"CN", MBSTRING_ASC, k_CN, -1, -1, 0); - X509_NAME_add_entry_by_txt(name,"Email", MBSTRING_ASC, k_Email, -1, -1, 0); + X509_NAME_add_entry_by_txt(name,"C", MBSTRING_ASC, (const unsigned char *)k_C, -1, -1, 0); + X509_NAME_add_entry_by_txt(name,"ST", MBSTRING_ASC, (const unsigned char *)k_ST, -1, -1, 0); + X509_NAME_add_entry_by_txt(name,"L", MBSTRING_ASC, (const unsigned char *)k_L, -1, -1, 0); + X509_NAME_add_entry_by_txt(name,"O", MBSTRING_ASC, (const unsigned char *)k_O, -1, -1, 0); + X509_NAME_add_entry_by_txt(name,"OU", MBSTRING_ASC, (const unsigned char *)k_OU, -1, -1, 0); + X509_NAME_add_entry_by_txt(name,"CN", MBSTRING_ASC, (const unsigned char *)k_CN, -1, -1, 0); + X509_NAME_add_entry_by_txt(name,"Email", MBSTRING_ASC, (const unsigned char *)k_Email, -1, -1, 0); X509_set_subject_name(cert,name); --- tlsInt.h 2014-12-08 14:10:28.000000000 -0500 +++ tlsInt.h 2015-03-25 18:29:34.000000000 -0400 @@ -18,5 +18,5 @@ * */ -#ifndef _TSLINT_H +#ifndef _TLSINT_H #define _TLSINT_H --- tlsX509.c 2004-06-29 10:58:08 UTC +++ tlsX509.c 2015-09-22 20:49:42 UTC @@ -119,5 +119,5 @@ n = max(n, 0); subject[n] = 0; - BIO_flush(bio); + (void)BIO_flush(bio); X509_NAME_print_ex(bio, X509_get_issuer_name(cert), 0, flags); @@ -125,5 +125,5 @@ n = max(n, 0); issuer[n] = 0; - BIO_flush(bio); + (void)BIO_flush(bio); i2a_ASN1_INTEGER(bio, X509_get_serialNumber(cert)); @@ -131,5 +131,5 @@ n = max(n, 0); serial[n] = 0; - BIO_flush(bio); + (void)BIO_flush(bio); BIO_free(bio);