Backport ossl_ssize_t type from HEAD.
authorDr. Stephen Henson <steve@openssl.org>
Mon, 10 Oct 2011 22:33:50 +0000 (22:33 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 10 Oct 2011 22:33:50 +0000 (22:33 +0000)
CHANGES
crypto/bio/bss_bio.c
crypto/cms/cms.h
crypto/cms/cms_pwri.c
crypto/cms/cms_smime.c
crypto/ui/ui.h
e_os.h
e_os2.h
ms/uplink.h

diff --git a/CHANGES b/CHANGES
index 488abc5f783de4edaf43effc73aa0baed4a98926..68dd4df7462b6ab9553c2b4c1e5f5951b0c2e908 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,11 @@
 
  Changes between 1.0.0e and 1.0.1  [xx XXX xxxx]
 
+  *) Use type ossl_ssize_t instad of ssize_t which isn't available on
+     all platforms. Move ssize_t definition from e_os.h to the public
+     header file e_os2.h as it now appears in public header file cms.h
+     [Steve Henson]
+
   *) New -sigopt option to the ca, req and x509 utilities. Additional
      signature parameters can be passed using this option and in
      particular PSS. 
index 76bd48e7679b22f6492265b84e4b61acacad75fa..52ef0ebcb3e59f57d317041f7f7bf44a245ad0a3 100644 (file)
@@ -277,10 +277,10 @@ static int bio_read(BIO *bio, char *buf, int size_)
  */
 /* WARNING: The non-copying interface is largely untested as of yet
  * and may contain bugs. */
-static ssize_t bio_nread0(BIO *bio, char **buf)
+static ossl_ssize_t bio_nread0(BIO *bio, char **buf)
        {
        struct bio_bio_st *b, *peer_b;
-       ssize_t num;
+       ossl_ssize_t num;
        
        BIO_clear_retry_flags(bio);
 
@@ -315,15 +315,15 @@ static ssize_t bio_nread0(BIO *bio, char **buf)
        return num;
        }
 
-static ssize_t bio_nread(BIO *bio, char **buf, size_t num_)
+static ossl_ssize_t bio_nread(BIO *bio, char **buf, size_t num_)
        {
        struct bio_bio_st *b, *peer_b;
-       ssize_t num, available;
+       ossl_ssize_t num, available;
 
        if (num_ > SSIZE_MAX)
                num = SSIZE_MAX;
        else
-               num = (ssize_t)num_;
+               num = (ossl_ssize_t)num_;
 
        available = bio_nread0(bio, buf);
        if (num > available)
@@ -428,7 +428,7 @@ static int bio_write(BIO *bio, const char *buf, int num_)
  * (example usage:  bio_nwrite0(), write to buffer, bio_nwrite()
  *  or just         bio_nwrite(), write to buffer)
  */
-static ssize_t bio_nwrite0(BIO *bio, char **buf)
+static ossl_ssize_t bio_nwrite0(BIO *bio, char **buf)
        {
        struct bio_bio_st *b;
        size_t num;
@@ -476,15 +476,15 @@ static ssize_t bio_nwrite0(BIO *bio, char **buf)
        return num;
        }
 
-static ssize_t bio_nwrite(BIO *bio, char **buf, size_t num_)
+static ossl_ssize_t bio_nwrite(BIO *bio, char **buf, size_t num_)
        {
        struct bio_bio_st *b;
-       ssize_t num, space;
+       ossl_ssize_t num, space;
 
        if (num_ > SSIZE_MAX)
                num = SSIZE_MAX;
        else
-               num = (ssize_t)num_;
+               num = (ossl_ssize_t)num_;
 
        space = bio_nwrite0(bio, buf);
        if (num > space)
index 8d230219f7617b026d572c8f977ce3cfc5bf5b0f..c48c82863e97ff87c8c2e3679c54ff4cd26c9c20 100644 (file)
@@ -185,7 +185,7 @@ int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
                                unsigned char *key, size_t keylen,
                                unsigned char *id, size_t idlen);
 int CMS_decrypt_set1_password(CMS_ContentInfo *cms, 
-                               unsigned char *pass, ssize_t passlen);
+                               unsigned char *pass, ossl_ssize_t passlen);
 
 STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
 int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
@@ -222,11 +222,13 @@ int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
                                        const unsigned char *id, size_t idlen);
 
 int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, 
-                                       unsigned char *pass, ssize_t passlen);
+                                       unsigned char *pass,
+                                       ossl_ssize_t passlen);
 
 CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
                                        int iter, int wrap_nid, int pbe_nid,
-                                       unsigned char *pass, ssize_t passlen,
+                                       unsigned char *pass,
+                                       ossl_ssize_t passlen,
                                        const EVP_CIPHER *kekciph);
 
 int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
index 5fe7f494bdbb288f090eab2d6a50f67eadd252e7..b79612a12df495c6169701833cca935f65713d2e 100644 (file)
@@ -63,7 +63,7 @@
 #include "asn1_locl.h"
 
 int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, 
-                               unsigned char *pass, ssize_t passlen)
+                               unsigned char *pass, ossl_ssize_t passlen)
        {
        CMS_PasswordRecipientInfo *pwri;
        if (ri->type != CMS_RECIPINFO_PASS)
@@ -82,7 +82,8 @@ int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,
 
 CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
                                        int iter, int wrap_nid, int pbe_nid,
-                                       unsigned char *pass, ssize_t passlen,
+                                       unsigned char *pass,
+                                       ossl_ssize_t passlen,
                                        const EVP_CIPHER *kekciph)
        {
        CMS_RecipientInfo *ri = NULL;
index ab38a258e53ee07b312686e3c8ea254dd106b7ae..a40307605bde5467e46f7cea4ca59a055e46196e 100644 (file)
@@ -682,7 +682,7 @@ int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
        }
 
 int CMS_decrypt_set1_password(CMS_ContentInfo *cms, 
-                               unsigned char *pass, ssize_t passlen)
+                               unsigned char *pass, ossl_ssize_t passlen)
        {
        STACK_OF(CMS_RecipientInfo) *ris;
        CMS_RecipientInfo *ri;
index 2b1cfa22891429449992604fcba147a1bb11abd2..bd78aa413f8b05fb16f454e24922b206c8931ac9 100644 (file)
@@ -316,7 +316,7 @@ int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*);
 int (*UI_method_get_flusher(UI_METHOD *method))(UI*);
 int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*);
 int (*UI_method_get_closer(UI_METHOD *method))(UI*);
-char* (*UI_method_get_prompt_constructor(UI_METHOD *method))(UI*, const char*, const char*);
+char * (*UI_method_get_prompt_constructor(UI_METHOD *method))(UI*, const char*, const char*);
 
 /* The following functions are helpers for method writers to access relevant
    data from a UI_STRING. */
diff --git a/e_os.h b/e_os.h
index 5ceeeeb950d6f9132deac10407078d10a294394c..79c1392573405d07876caabd734a41b660a39bbc 100644 (file)
--- a/e_os.h
+++ b/e_os.h
@@ -99,7 +99,6 @@ extern "C" {
 #  ifndef MAC_OS_GUSI_SOURCE
 #    define MAC_OS_pre_X
 #    define NO_SYS_TYPES_H
-     typedef long ssize_t;
 #  endif
 #  define NO_SYS_PARAM_H
 #  define NO_CHMOD
@@ -340,8 +339,6 @@ static unsigned int _strlen31(const char *str)
 #    define OPENSSL_NO_POSIX_IO
 #  endif
 
-#  define ssize_t long
-
 #  if defined (__BORLANDC__)
 #    define _setmode setmode
 #    define _O_TEXT O_TEXT
@@ -456,9 +453,6 @@ static unsigned int _strlen31(const char *str)
                          * (unless when compiling with -D_POSIX_SOURCE,
                          * which doesn't work for us) */
 #    endif
-#    if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS)
-#      define ssize_t int /* ditto */
-#    endif
 #    ifdef OPENSSL_SYS_NEWS4 /* setvbuf is missing on mips-sony-bsd */
 #      define setvbuf(a, b, c, d) setbuffer((a), (b), (d))
        typedef unsigned long clock_t;
@@ -637,12 +631,6 @@ static unsigned int _strlen31(const char *str)
 
 #endif
 
-#if defined(__ultrix)
-#  ifndef ssize_t
-#    define ssize_t int 
-#  endif
-#endif
-
 #if defined(sun) && !defined(__svr4__) && !defined(__SVR4)
   /* include headers first, so our defines don't break it */
 #include <stdlib.h>
diff --git a/e_os2.h b/e_os2.h
index 4c785c62cf7a7c1aa7d41f0921b4f82ec85f9668..5106f44f513a4f1ef2e840b0be98ff5f1ba3b43a 100644 (file)
--- a/e_os2.h
+++ b/e_os2.h
@@ -283,6 +283,26 @@ extern "C" {
 # define OPENSSL_GLOBAL_REF(name) _shadow_##name
 #endif
 
+#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && macintosh==1 && !defined(MAC_OS_GUSI_SOURCE)
+#  define ossl_ssize_t long
+#endif
+
+#ifdef OPENSSL_SYS_MSDOS
+#  define ossl_ssize_t long
+#endif
+
+#if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS)
+#  define ssize_t int
+#endif
+
+#if defined(__ultrix) && !defined(ssize_t)
+#  define ossl_ssize_t int 
+#endif
+
+#ifndef ossl_ssize_t
+#  define ossl_ssize_t ssize_t
+#endif
+
 #ifdef  __cplusplus
 }
 #endif
index a4a67d3c146f4abce082fba3db6d678aa1a0263f..4881ba7d4298d339eb2a4c850fb610c5398749a8 100644 (file)
@@ -23,7 +23,7 @@ extern void *OPENSSL_UplinkTable[];
 #define UP_fileno (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FILENO])
 
 #define UP_open   (*(int (*)(const char *,int,...))OPENSSL_UplinkTable[APPLINK_OPEN])
-#define UP_read   (*(ssize_t (*)(int,void *,size_t))OPENSSL_UplinkTable[APPLINK_READ])
-#define UP_write  (*(ssize_t (*)(int,const void *,size_t))OPENSSL_UplinkTable[APPLINK_WRITE])
+#define UP_read   (*(ossl_ssize_t (*)(int,void *,size_t))OPENSSL_UplinkTable[APPLINK_READ])
+#define UP_write  (*(ossl_ssize_t (*)(int,const void *,size_t))OPENSSL_UplinkTable[APPLINK_WRITE])
 #define UP_lseek  (*(long (*)(int,long,int))OPENSSL_UplinkTable[APPLINK_LSEEK])
 #define UP_close  (*(int (*)(int))OPENSSL_UplinkTable[APPLINK_CLOSE])