[openssl-commits] [openssl] master update

Andy Polyakov appro at openssl.org
Tue Sep 29 16:06:28 UTC 2015


The branch master has been updated
       via  57ebe74831d9875dde98d5088bb78f5c89396d6b (commit)
       via  db40a14ecbb2f65bb3a86505f53db00633347f3b (commit)
       via  156561b0ade98b22df0e3ebc63682e54129c2cb4 (commit)
       via  16a9542a1723828c5b2dbe854a2864aa3ed2b11e (commit)
       via  03cbd3b8fa0ceadd69cd41dbb2353e640ace40ae (commit)
      from  8be7438f16cbd8c53206c5494a8fcbedab94bd6a (commit)


- Log -----------------------------------------------------------------
commit 57ebe74831d9875dde98d5088bb78f5c89396d6b
Author: Andy Polyakov <appro at openssl.org>
Date:   Mon Sep 28 16:07:53 2015 +0200

    engine/e_capi.c: fix various warnings.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit db40a14ecbb2f65bb3a86505f53db00633347f3b
Author: Andy Polyakov <appro at openssl.org>
Date:   Mon Sep 28 16:05:32 2015 +0200

    Fix -Wshadow warnings in mingw builds.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 156561b0ade98b22df0e3ebc63682e54129c2cb4
Author: Andy Polyakov <appro at openssl.org>
Date:   Mon Sep 28 16:00:08 2015 +0200

    Fix pedantic warnings in mingw builds.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 16a9542a1723828c5b2dbe854a2864aa3ed2b11e
Author: Andy Polyakov <appro at openssl.org>
Date:   Mon Sep 28 15:56:34 2015 +0200

    Fix prototypes in e_ossttest.c.
    
    Problem was exposed in mingw64 build, or in other words on P64 platform.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 03cbd3b8fa0ceadd69cd41dbb2353e640ace40ae
Author: Andy Polyakov <appro at openssl.org>
Date:   Mon Sep 28 15:51:20 2015 +0200

    asn1t.h: silence -Wmissing-prototype in Windows builds.
    
    On Windows OPENSSL_EXPORT_VAR_AS_FUNCTION is defined and in a sense
    this modification simply harmonizes it with "VAR_AS_VAR".
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 apps/speed.c            |  6 +++---
 crypto/cryptlib.c       | 12 ++++--------
 crypto/dso/dso_win32.c  | 31 ++++++++++++++++++++-----------
 crypto/rand/rand_win.c  |  6 +++---
 engines/e_capi.c        | 38 ++++++++++++++++++++++----------------
 engines/e_ossltest.c    | 16 ++++++++--------
 include/openssl/asn1t.h |  2 +-
 7 files changed, 61 insertions(+), 50 deletions(-)

diff --git a/apps/speed.c b/apps/speed.c
index 4b53f61..046c0b2 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -297,9 +297,9 @@ static double Time_F(int s)
         schlock = 0;
         thr = CreateThread(NULL, 4096, sleepy, NULL, 0, NULL);
         if (thr == NULL) {
-            DWORD ret = GetLastError();
-            BIO_printf(bio_err, "unable to CreateThread (%d)", ret);
-            ExitProcess(ret);
+            DWORD err = GetLastError();
+            BIO_printf(bio_err, "unable to CreateThread (%lu)", err);
+            ExitProcess(err);
         }
         while (!schlock)
             Sleep(0);           /* scheduler spinlock */
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c
index 39d1e1e..f0aaae6 100644
--- a/crypto/cryptlib.c
+++ b/crypto/cryptlib.c
@@ -117,10 +117,6 @@
 #include "internal/cryptlib.h"
 #include <openssl/safestack.h>
 
-#if defined(OPENSSL_SYS_WIN32)
-static double SSLeay_MSVC5_hack = 0.0; /* and for VC1.5 */
-#endif
-
 #if     defined(__i386)   || defined(__i386__)   || defined(_M_IX86) || \
         defined(__INTEL__) || \
         defined(__x86_64) || defined(__x86_64__) || \
@@ -268,15 +264,15 @@ int OPENSSL_isservice(void)
     WCHAR *name;
     static union {
         void *p;
-        int (*f) (void);
+        FARPROC f;
     } _OPENSSL_isservice = {
         NULL
     };
 
     if (_OPENSSL_isservice.p == NULL) {
-        HANDLE h = GetModuleHandle(NULL);
-        if (h != NULL)
-            _OPENSSL_isservice.p = GetProcAddress(h, "_OPENSSL_isservice");
+        HANDLE mod = GetModuleHandle(NULL);
+        if (mod != NULL)
+            _OPENSSL_isservice.f = GetProcAddress(mod, "_OPENSSL_isservice");
         if (_OPENSSL_isservice.p == NULL)
             _OPENSSL_isservice.p = (void *)-1;
     }
diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c
index c6fec66..8d2123e 100644
--- a/crypto/dso/dso_win32.c
+++ b/crypto/dso/dso_win32.c
@@ -224,7 +224,10 @@ static int win32_unload(DSO *dso)
 static void *win32_bind_var(DSO *dso, const char *symname)
 {
     HINSTANCE *ptr;
-    void *sym;
+    union {
+        void *p;
+        FARPROC f;
+    } sym;
 
     if ((dso == NULL) || (symname == NULL)) {
         DSOerr(DSO_F_WIN32_BIND_VAR, ERR_R_PASSED_NULL_PARAMETER);
@@ -239,19 +242,22 @@ static void *win32_bind_var(DSO *dso, const char *symname)
         DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_NULL_HANDLE);
         return (NULL);
     }
-    sym = GetProcAddress(*ptr, symname);
-    if (sym == NULL) {
+    sym.f = GetProcAddress(*ptr, symname);
+    if (sym.p == NULL) {
         DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_SYM_FAILURE);
         ERR_add_error_data(3, "symname(", symname, ")");
         return (NULL);
     }
-    return (sym);
+    return (sym.p);
 }
 
 static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname)
 {
     HINSTANCE *ptr;
-    void *sym;
+    union {
+        void *p;
+        FARPROC f;
+    } sym;
 
     if ((dso == NULL) || (symname == NULL)) {
         DSOerr(DSO_F_WIN32_BIND_FUNC, ERR_R_PASSED_NULL_PARAMETER);
@@ -266,13 +272,13 @@ static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname)
         DSOerr(DSO_F_WIN32_BIND_FUNC, DSO_R_NULL_HANDLE);
         return (NULL);
     }
-    sym = GetProcAddress(*ptr, symname);
-    if (sym == NULL) {
+    sym.f = GetProcAddress(*ptr, symname);
+    if (sym.p == NULL) {
         DSOerr(DSO_F_WIN32_BIND_FUNC, DSO_R_SYM_FAILURE);
         ERR_add_error_data(3, "symname(", symname, ")");
         return (NULL);
     }
-    return ((DSO_FUNC_TYPE)sym);
+    return ((DSO_FUNC_TYPE)sym.f);
 }
 
 struct file_st {
@@ -704,7 +710,10 @@ static void *win32_globallookup(const char *name)
     CREATETOOLHELP32SNAPSHOT create_snap;
     CLOSETOOLHELP32SNAPSHOT close_snap;
     MODULE32 module_first, module_next;
-    FARPROC ret = NULL;
+    union {
+        void *p;
+        FARPROC f;
+    } ret = { NULL };
 
     dll = LoadLibrary(TEXT(DLLNAME));
     if (dll == NULL) {
@@ -745,10 +754,10 @@ static void *win32_globallookup(const char *name)
     }
 
     do {
-        if ((ret = GetProcAddress(me32.hModule, name))) {
+        if ((ret.f = GetProcAddress(me32.hModule, name))) {
             (*close_snap) (hModuleSnap);
             FreeLibrary(dll);
-            return ret;
+            return ret.p;
         }
     } while ((*module_next) (hModuleSnap, &me32));
 
diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c
index e926429..a91014b 100644
--- a/crypto/rand/rand_win.c
+++ b/crypto/rand/rand_win.c
@@ -196,7 +196,7 @@ typedef NET_API_STATUS(NET_API_FUNCTION *NETFREE) (LPBYTE);
 
 int RAND_poll(void)
 {
-    MEMORYSTATUS m;
+    MEMORYSTATUS mst;
     HCRYPTPROV hProvider = 0;
     DWORD w;
     int good = 0;
@@ -558,8 +558,8 @@ int RAND_poll(void)
     readtimer();
 
     /* memory usage statistics */
-    GlobalMemoryStatus(&m);
-    RAND_add(&m, sizeof(m), 1);
+    GlobalMemoryStatus(&mst);
+    RAND_add(&mst, sizeof(mst), 1);
 
     /* process ID */
     w = GetCurrentProcessId();
diff --git a/engines/e_capi.c b/engines/e_capi.c
index 8b3cfee..5256768 100644
--- a/engines/e_capi.c
+++ b/engines/e_capi.c
@@ -239,7 +239,7 @@ struct CAPI_CTX_st {
     GETCONSWIN getconswindow;
 };
 
-static CAPI_CTX *capi_ctx_new();
+static CAPI_CTX *capi_ctx_new(void);
 static void capi_ctx_free(CAPI_CTX * ctx);
 static int capi_ctx_set_provname(CAPI_CTX * ctx, LPSTR pname, DWORD type,
                                  int check);
@@ -742,7 +742,7 @@ static EVP_PKEY *capi_get_pkey(ENGINE *eng, CAPI_KEY * key)
         dkey = NULL;
     } else {
         char algstr[10];
-        BIO_snprintf(algstr, 10, "%lx", bh->aiKeyAlg);
+        BIO_snprintf(algstr, 10, "%ux", bh->aiKeyAlg);
         CAPIerr(CAPI_F_CAPI_GET_PKEY,
                 CAPI_R_UNSUPPORTED_PUBLIC_KEY_ALGORITHM);
         ERR_add_error_data(2, "aiKeyAlg=0x", algstr);
@@ -847,7 +847,7 @@ int capi_rsa_sign(int dtype, const unsigned char *m, unsigned int m_len,
     default:
         {
             char algstr[10];
-            BIO_snprintf(algstr, 10, "%lx", dtype);
+            BIO_snprintf(algstr, 10, "%x", dtype);
             CAPIerr(CAPI_F_CAPI_RSA_SIGN, CAPI_R_UNSUPPORTED_ALGORITHM_NID);
             ERR_add_error_data(2, "NID=0x", algstr);
             return -1;
@@ -901,6 +901,11 @@ int capi_rsa_priv_dec(int flen, const unsigned char *from,
     unsigned char *tmpbuf;
     CAPI_KEY *capi_key;
     CAPI_CTX *ctx;
+    DWORD dlen;
+
+    if (flen <= 0)
+        return flen;
+
     ctx = ENGINE_get_ex_data(rsa->engine, capi_idx);
 
     CAPI_trace(ctx, "Called capi_rsa_priv_dec()\n");
@@ -928,13 +933,14 @@ int capi_rsa_priv_dec(int flen, const unsigned char *from,
         tmpbuf[flen - i - 1] = from[i];
 
     /* Finally decrypt it */
-    if (!CryptDecrypt(capi_key->key, 0, TRUE, 0, tmpbuf, &flen)) {
+    dlen = flen;
+    if (!CryptDecrypt(capi_key->key, 0, TRUE, 0, tmpbuf, &dlen)) {
         CAPIerr(CAPI_F_CAPI_RSA_PRIV_DEC, CAPI_R_DECRYPT_ERROR);
         capi_addlasterror();
         OPENSSL_free(tmpbuf);
         return -1;
     } else
-        memcpy(to, tmpbuf, flen);
+        memcpy(to, tmpbuf, (flen = (int)dlen));
 
     OPENSSL_free(tmpbuf);
 
@@ -1147,7 +1153,7 @@ static int capi_list_providers(CAPI_CTX * ctx, BIO *out)
             break;
         if (ret == 0)
             break;
-        BIO_printf(out, "%d. %s, type %d\n", idx, provname, ptype);
+        BIO_printf(out, "%lu. %s, type %lu\n", idx, provname, ptype);
         OPENSSL_free(provname);
     }
     return 1;
@@ -1223,7 +1229,7 @@ static int capi_list_containers(CAPI_CTX * ctx, BIO *out)
             CAPI_trace(ctx, "Enumerate bug: using workaround\n");
             goto done;
         }
-        BIO_printf(out, "%d. %s\n", idx, cname);
+        BIO_printf(out, "%lu. %s\n", idx, cname);
     }
  err:
 
@@ -1236,7 +1242,7 @@ static int capi_list_containers(CAPI_CTX * ctx, BIO *out)
     return ret;
 }
 
-CRYPT_KEY_PROV_INFO *capi_get_prov_info(CAPI_CTX * ctx, PCCERT_CONTEXT cert)
+static CRYPT_KEY_PROV_INFO *capi_get_prov_info(CAPI_CTX * ctx, PCCERT_CONTEXT cert)
 {
     DWORD len;
     CRYPT_KEY_PROV_INFO *pinfo;
@@ -1274,16 +1280,16 @@ static void capi_dump_prov_info(CAPI_CTX * ctx, BIO *out,
         goto err;
 
     BIO_printf(out, "  Private Key Info:\n");
-    BIO_printf(out, "    Provider Name:  %s, Provider Type %d\n", provname,
+    BIO_printf(out, "    Provider Name:  %s, Provider Type %lu\n", provname,
                pinfo->dwProvType);
-    BIO_printf(out, "    Container Name: %s, Key Type %d\n", contname,
+    BIO_printf(out, "    Container Name: %s, Key Type %lu\n", contname,
                pinfo->dwKeySpec);
  err:
     OPENSSL_free(provname);
     OPENSSL_free(contname);
 }
 
-char *capi_cert_get_fname(CAPI_CTX * ctx, PCCERT_CONTEXT cert)
+static char *capi_cert_get_fname(CAPI_CTX * ctx, PCCERT_CONTEXT cert)
 {
     LPWSTR wfname;
     DWORD dlen;
@@ -1308,10 +1314,10 @@ char *capi_cert_get_fname(CAPI_CTX * ctx, PCCERT_CONTEXT cert)
     return NULL;
 }
 
-void capi_dump_cert(CAPI_CTX * ctx, BIO *out, PCCERT_CONTEXT cert)
+static void capi_dump_cert(CAPI_CTX * ctx, BIO *out, PCCERT_CONTEXT cert)
 {
     X509 *x;
-    unsigned char *p;
+    const unsigned char *p;
     unsigned long flags = ctx->dump_flags;
     if (flags & CAPI_DMP_FNAME) {
         char *fname;
@@ -1349,7 +1355,7 @@ void capi_dump_cert(CAPI_CTX * ctx, BIO *out, PCCERT_CONTEXT cert)
     X509_free(x);
 }
 
-HCERTSTORE capi_open_store(CAPI_CTX * ctx, char *storename)
+static HCERTSTORE capi_open_store(CAPI_CTX * ctx, char *storename)
 {
     HCERTSTORE hstore;
 
@@ -1571,7 +1577,7 @@ void capi_free_key(CAPI_KEY * key)
 
 /* Initialize a CAPI_CTX structure */
 
-static CAPI_CTX *capi_ctx_new()
+static CAPI_CTX *capi_ctx_new(void)
 {
     CAPI_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
 
@@ -1669,7 +1675,7 @@ static int capi_load_ssl_client_cert(ENGINE *e, SSL *ssl,
     STACK_OF(X509) *certs = NULL;
     X509 *x;
     char *storename;
-    const char *p;
+    const unsigned char *p;
     int i, client_cert_idx;
     HCERTSTORE hstore;
     PCCERT_CONTEXT cert = NULL, excert = NULL;
diff --git a/engines/e_ossltest.c b/engines/e_ossltest.c
index c339026..e9a071c 100644
--- a/engines/e_ossltest.c
+++ b/engines/e_ossltest.c
@@ -94,7 +94,7 @@ static int ossltest_digest_nids[] = {
 /* MD5 */
 static int digest_md5_init(EVP_MD_CTX *ctx);
 static int digest_md5_update(EVP_MD_CTX *ctx, const void *data,
-                             unsigned long count);
+                             size_t count);
 static int digest_md5_final(EVP_MD_CTX *ctx, unsigned char *md);
 
 static const EVP_MD digest_md5 = {
@@ -115,7 +115,7 @@ static const EVP_MD digest_md5 = {
 /* SHA1 */
 static int digest_sha1_init(EVP_MD_CTX *ctx);
 static int digest_sha1_update(EVP_MD_CTX *ctx, const void *data,
-                             unsigned long count);
+                              size_t count);
 static int digest_sha1_final(EVP_MD_CTX *ctx, unsigned char *md);
 
 static const EVP_MD digest_sha1 = {
@@ -136,7 +136,7 @@ static const EVP_MD digest_sha1 = {
 /* SHA256 */
 static int digest_sha256_init(EVP_MD_CTX *ctx);
 static int digest_sha256_update(EVP_MD_CTX *ctx, const void *data,
-                             unsigned long count);
+                                size_t count);
 static int digest_sha256_final(EVP_MD_CTX *ctx, unsigned char *md);
 
 static const EVP_MD digest_sha256 = {
@@ -158,7 +158,7 @@ static const EVP_MD digest_sha256 = {
 static int digest_sha384_init(EVP_MD_CTX *ctx);
 static int digest_sha512_init(EVP_MD_CTX *ctx);
 static int digest_sha512_update(EVP_MD_CTX *ctx, const void *data,
-                             unsigned long count);
+                                size_t count);
 static int digest_sha384_final(EVP_MD_CTX *ctx, unsigned char *md);
 static int digest_sha512_final(EVP_MD_CTX *ctx, unsigned char *md);
 
@@ -377,7 +377,7 @@ static int digest_md5_init(EVP_MD_CTX *ctx)
 }
 
 static int digest_md5_update(EVP_MD_CTX *ctx, const void *data,
-          unsigned long count)
+                             size_t count)
 {
     return MD5_Update(data(ctx), data, (size_t)count);
 }
@@ -404,7 +404,7 @@ static int digest_sha1_init(EVP_MD_CTX *ctx)
 }
 
 static int digest_sha1_update(EVP_MD_CTX *ctx, const void *data,
-                             unsigned long count)
+                              size_t count)
 {
     return SHA1_Update(data(ctx), data, (size_t)count);
 }
@@ -431,7 +431,7 @@ static int digest_sha256_init(EVP_MD_CTX *ctx)
 }
 
 static int digest_sha256_update(EVP_MD_CTX *ctx, const void *data,
-                             unsigned long count)
+                                size_t count)
 {
     return SHA256_Update(data(ctx), data, (size_t)count);
 }
@@ -463,7 +463,7 @@ static int digest_sha512_init(EVP_MD_CTX *ctx)
 }
 
 static int digest_sha512_update(EVP_MD_CTX *ctx, const void *data,
-                             unsigned long count)
+                                size_t count)
 {
     return SHA512_Update(data(ctx), data, (size_t)count);
 }
diff --git a/include/openssl/asn1t.h b/include/openssl/asn1t.h
index 68f6264..f0244dc 100644
--- a/include/openssl/asn1t.h
+++ b/include/openssl/asn1t.h
@@ -103,7 +103,7 @@ extern "C" {
                 static const ASN1_ITEM local_it = {
 
 #  define static_ASN1_ITEM_start(itname) \
-        ASN1_ITEM_start(itname)
+        static ASN1_ITEM_start(itname)
 
 #  define ASN1_ITEM_end(itname) \
                 }; \


More information about the openssl-commits mailing list