Fix up so it builds on all our platforms -- certain compilers weren't happy

before causing build-failures.

Tested with clang (base on 10.x), gcc-4.9 and gcc-4.2.1.

The bundled self-tests continue to NOT work -- upstream maintainer confirms
a problem and promises to try to test them...
This commit is contained in:
Mikhail Teterin 2015-09-24 15:59:19 +00:00
parent b59738ff84
commit 56bf956b38
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=397695
2 changed files with 149 additions and 34 deletions

View file

@ -69,21 +69,6 @@
+ ;
int proto = 0;
int verify = 0, require = 0, request = 1;
@@ -1029,9 +1029,9 @@
State *statePtr;
int proto;
- char *key;
- char *cert;
- char *CAdir;
- char *CAfile;
- char *ciphers;
+ const char *key;
+ const char *cert;
+ const char *CAdir;
+ const char *CAfile;
+ const char *ciphers;
{
Tcl_Interp *interp = statePtr->interp;
@@ -1050,5 +1050,5 @@
#if defined(NO_SSL2)
if (ENABLED(proto, TLS_PROTO_SSL2)) {

View file

@ -52,8 +52,8 @@
+ (void *)bio, cmd, num, ptr);
switch (cmd) {
--- tlsIO.c Mon Feb 4 17:46:31 2002
+++ tlsIO.c Mon Jun 20 10:18:45 2005
--- 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;
@ -61,14 +61,21 @@
+ dprintf(stderr,"\nTlsCloseProc(%p)", instanceData);
if (channelTypeVersion == TLS_CHANNEL_VERSION_1) {
@@ -413,5 +413,5 @@
@@ -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 (!SSL_is_init_finished(statePtr->ssl)) {
@@ -443,6 +443,6 @@
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]",
@ -77,38 +84,138 @@
+ instanceData, toWrite, written);
}
if (written <= 0) {
@@ -851,5 +851,5 @@
@@ -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);
for (;;) {
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 2014-12-08 14:10:28.000000000 -0500
+++ tls.c 2015-03-25 18:22:52.000000000 -0400
@@ -514,5 +514,5 @@
--- 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;
@@ -1040,5 +1040,5 @@
Tcl_DString ds1;
int off = 0;
- const SSL_METHOD *method;
+ SSL_METHOD *method;
if (!proto) {
@@ -1361,5 +1361,5 @@
@@ -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;
@@ -1465,11 +1465,11 @@
@@ -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);
@ -136,3 +243,26 @@
+#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);