Various Win32 fixes.
authorDr. Stephen Henson <steve@openssl.org>
Sun, 6 Oct 2002 12:14:55 +0000 (12:14 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 6 Oct 2002 12:14:55 +0000 (12:14 +0000)
Resolve signed/unsigned conflicts

Make dso_win32.c compile.

crypto/asn1/t_pkey.c
crypto/dso/dso_win32.c
crypto/engine/hw_cswift.c

index 0112f7cced53ef10d3ee63db3854652d87119e45..46fb86a3b95cb2d8c20382e27c83e29dd03b9604 100644 (file)
@@ -627,7 +627,7 @@ static int print(BIO *bp, const char *number, BIGNUM *num, unsigned char *buf,
 static int print_bin(BIO *fp, const char *name, const unsigned char *buf,
                size_t len, int off)
        {
-       int i;
+       size_t i;
        char str[128];
 
        if (buf == NULL)
index 4ce9a5d45c8cfb9ce3e1829be9f5c34b89a5d3b2..58c5281de60805ec3eefd7e073d85a36b10c8386 100644 (file)
@@ -86,6 +86,8 @@ static char *win32_name_converter(DSO *dso, const char *filename);
 static char *win32_merger(DSO *dso, const char *filespec1,
        const char *filespec2);
 
+static const char *openssl_strnchr(const char *string, int c, size_t len);
+
 static DSO_METHOD dso_meth_win32 = {
        "OpenSSL 'win32' shared library method",
        win32_load,
@@ -258,7 +260,7 @@ struct file_st
        const char *predir; int predirlen;
        const char *dir; int dirlen;
        const char *file; int filelen;
-       }
+       };
 
 static struct file_st *win32_splitter(DSO *dso, const char *filename,
        int assume_last_is_dir)
@@ -270,7 +272,8 @@ static struct file_st *win32_splitter(DSO *dso, const char *filename,
        if (!filename)
                {
                DSOerr(DSO_F_WIN32_MERGER,DSO_R_NO_FILENAME);
-               goto err;
+               /*goto err;*/
+               return(NULL);
                }
 
        result = OPENSSL_malloc(sizeof(struct file_st));
@@ -302,7 +305,8 @@ static struct file_st *win32_splitter(DSO *dso, const char *filename,
                                {
                                DSOerr(DSO_F_WIN32_MERGER,
                                        DSO_R_INCORRECT_FILE_SYNTAX);
-                               goto err;
+                               /*goto err;*/
+                               return(NULL);
                                }
                        result->device = start;
                        result->devicelen = filename - start;
@@ -354,14 +358,14 @@ static struct file_st *win32_splitter(DSO *dso, const char *filename,
        while(*filename);
 
        if(!result->nodelen) result->node = NULL;
-       if(!result->devicelen) result->devicce = NULL;
+       if(!result->devicelen) result->device = NULL;
        if(!result->dirlen) result->dir = NULL;
        if(!result->filelen) result->file = NULL;
 
        return(result);
        }
 
-static char *win32_joiner(DSO *dso, const file_st *file_split)
+static char *win32_joiner(DSO *dso, const struct file_st *file_split)
        {
        int len = 0, offset = 0;
        char *result = NULL;
@@ -428,7 +432,7 @@ static char *win32_joiner(DSO *dso, const file_st *file_split)
        start = file_split->predir;
        while(file_split->predirlen > (start - file_split->predir))
                {
-               const char *end = strnchr(start, '/',
+               const char *end = openssl_strnchr(start, '/',
                        file_split->predirlen - (start - file_split->predir));
                if(!end)
                        end = start
@@ -446,7 +450,7 @@ static char *win32_joiner(DSO *dso, const file_st *file_split)
        start = file_split->dir;
        while(file_split->dirlen > (start - file_split->dir))
                {
-               const char *end = strnchr(start, '/',
+               const char *end = openssl_strnchr(start, '/',
                        file_split->dirlen - (start - file_split->dir));
                if(!end)
                        end = start
@@ -577,4 +581,17 @@ static char *win32_name_converter(DSO *dso, const char *filename)
        return(translated);
        }
 
+static const char *openssl_strnchr(const char *string, int c, size_t len)
+       {
+       size_t i;
+       const char *p;
+       for (i = 0, p = string; i < len && *p; i++, p++)
+               {
+               if (*p == c)
+                       return p;
+               }
+       return NULL;
+       }
+
+
 #endif /* OPENSSL_SYS_WIN32 */
index f925707a2456cba1ffda5b3459a276d72d606d9c..1b4e4e876ecac0253d85a74b3a839efe8a8bd1f1 100644 (file)
@@ -939,7 +939,7 @@ static int cswift_rand_bytes(unsigned char *buf, int num)
        }
        acquired = 1;
 
-       while (nbytes < num)
+       while (nbytes < (size_t)num)
        {
                /* tell CryptoSwift how many bytes we want and where we want it.
                 * Note: - CryptoSwift cannot do more than 4096 bytes at a time.