From 1bc5c3cc9dd5e553c448d82c256d4af5f37ef1c7 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Sat, 11 Nov 2017 16:35:46 +0100 Subject: Resolve warnings in VC-WIN32 build, which allows to add /WX. It's argued that /WX allows to keep better focus on new code, which motivates its comeback... Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/4718) --- apps/apps.c | 8 ++++++-- apps/s_client.c | 9 +++++---- apps/speed.c | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'apps') diff --git a/apps/apps.c b/apps/apps.c index c487bd92db..29de1b75dd 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -148,6 +148,10 @@ #ifdef _WIN32 static int WIN32_rename(const char *from, const char *to); # define rename(from,to) WIN32_rename((from),(to)) +# ifdef fileno +# undef fileno +# endif +# define fileno(a) (int)_fileno(a) #endif typedef struct { @@ -2788,13 +2792,13 @@ unsigned char *next_protos_parse(unsigned short *outlen, const char *in) OPENSSL_free(out); return NULL; } - out[start] = i - start; + out[start] = (unsigned char)(i - start); start = i + 1; } else out[i + 1] = in[i]; } - *outlen = len + 1; + *outlen = (unsigned char)(len + 1); return out; } #endif /* ndef OPENSSL_NO_TLSEXT */ diff --git a/apps/s_client.c b/apps/s_client.c index dc467994f8..2a0ead7bef 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -630,10 +630,11 @@ static int serverinfo_cli_parse_cb(SSL *s, unsigned int ext_type, unsigned char ext_buf[4 + 65536]; /* Reconstruct the type/len fields prior to extension data */ - ext_buf[0] = ext_type >> 8; - ext_buf[1] = ext_type & 0xFF; - ext_buf[2] = inlen >> 8; - ext_buf[3] = inlen & 0xFF; + inlen &= 0xffff; /* for formal memcpy correctness */ + ext_buf[0] = (unsigned char)(ext_type >> 8); + ext_buf[1] = (unsigned char)(ext_type); + ext_buf[2] = (unsigned char)(inlen >> 8); + ext_buf[3] = (unsigned char)(inlen); memcpy(ext_buf + 4, in, inlen); BIO_snprintf(pem_name, sizeof(pem_name), "SERVERINFO FOR EXTENSION %d", diff --git a/apps/speed.c b/apps/speed.c index 5259c16f12..5383678b98 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -2829,8 +2829,8 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher) RAND_bytes(out, 16); len += 16; - aad[11] = len >> 8; - aad[12] = len; + aad[11] = (unsigned char)(len >> 8); + aad[12] = (unsigned char)(len); pad = EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_AEAD_TLS1_AAD, EVP_AEAD_TLS1_AAD_LEN, aad); -- cgit v1.2.3