Backport ossl_ssize_t type from HEAD.

This commit is contained in:
Dr. Stephen Henson 2011-10-10 22:33:50 +00:00
parent b17442bb04
commit cb70355d87
9 changed files with 46 additions and 30 deletions

View File

@ -4,6 +4,11 @@
Changes between 1.0.0e and 1.0.1 [xx XXX xxxx] 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 *) New -sigopt option to the ca, req and x509 utilities. Additional
signature parameters can be passed using this option and in signature parameters can be passed using this option and in
particular PSS. particular PSS.

View 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 /* WARNING: The non-copying interface is largely untested as of yet
* and may contain bugs. */ * 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; struct bio_bio_st *b, *peer_b;
ssize_t num; ossl_ssize_t num;
BIO_clear_retry_flags(bio); BIO_clear_retry_flags(bio);
@ -315,15 +315,15 @@ static ssize_t bio_nread0(BIO *bio, char **buf)
return num; 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; struct bio_bio_st *b, *peer_b;
ssize_t num, available; ossl_ssize_t num, available;
if (num_ > SSIZE_MAX) if (num_ > SSIZE_MAX)
num = SSIZE_MAX; num = SSIZE_MAX;
else else
num = (ssize_t)num_; num = (ossl_ssize_t)num_;
available = bio_nread0(bio, buf); available = bio_nread0(bio, buf);
if (num > available) 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() * (example usage: bio_nwrite0(), write to buffer, bio_nwrite()
* or just bio_nwrite(), write to buffer) * 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; struct bio_bio_st *b;
size_t num; size_t num;
@ -476,15 +476,15 @@ static ssize_t bio_nwrite0(BIO *bio, char **buf)
return num; 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; struct bio_bio_st *b;
ssize_t num, space; ossl_ssize_t num, space;
if (num_ > SSIZE_MAX) if (num_ > SSIZE_MAX)
num = SSIZE_MAX; num = SSIZE_MAX;
else else
num = (ssize_t)num_; num = (ossl_ssize_t)num_;
space = bio_nwrite0(bio, buf); space = bio_nwrite0(bio, buf);
if (num > space) if (num > space)

View File

@ -185,7 +185,7 @@ int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
unsigned char *key, size_t keylen, unsigned char *key, size_t keylen,
unsigned char *id, size_t idlen); unsigned char *id, size_t idlen);
int CMS_decrypt_set1_password(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) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); 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); const unsigned char *id, size_t idlen);
int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, 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, CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
int iter, int wrap_nid, int pbe_nid, 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); const EVP_CIPHER *kekciph);
int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);

View File

@ -63,7 +63,7 @@
#include "asn1_locl.h" #include "asn1_locl.h"
int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,
unsigned char *pass, ssize_t passlen) unsigned char *pass, ossl_ssize_t passlen)
{ {
CMS_PasswordRecipientInfo *pwri; CMS_PasswordRecipientInfo *pwri;
if (ri->type != CMS_RECIPINFO_PASS) 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, CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
int iter, int wrap_nid, int pbe_nid, 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) const EVP_CIPHER *kekciph)
{ {
CMS_RecipientInfo *ri = NULL; CMS_RecipientInfo *ri = NULL;

View File

@ -682,7 +682,7 @@ int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
} }
int CMS_decrypt_set1_password(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; STACK_OF(CMS_RecipientInfo) *ris;
CMS_RecipientInfo *ri; CMS_RecipientInfo *ri;

View 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_flusher(UI_METHOD *method))(UI*);
int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*); int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*);
int (*UI_method_get_closer(UI_METHOD *method))(UI*); 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 /* The following functions are helpers for method writers to access relevant
data from a UI_STRING. */ data from a UI_STRING. */

12
e_os.h
View File

@ -99,7 +99,6 @@ extern "C" {
# ifndef MAC_OS_GUSI_SOURCE # ifndef MAC_OS_GUSI_SOURCE
# define MAC_OS_pre_X # define MAC_OS_pre_X
# define NO_SYS_TYPES_H # define NO_SYS_TYPES_H
typedef long ssize_t;
# endif # endif
# define NO_SYS_PARAM_H # define NO_SYS_PARAM_H
# define NO_CHMOD # define NO_CHMOD
@ -340,8 +339,6 @@ static unsigned int _strlen31(const char *str)
# define OPENSSL_NO_POSIX_IO # define OPENSSL_NO_POSIX_IO
# endif # endif
# define ssize_t long
# if defined (__BORLANDC__) # if defined (__BORLANDC__)
# define _setmode setmode # define _setmode setmode
# define _O_TEXT O_TEXT # define _O_TEXT O_TEXT
@ -456,9 +453,6 @@ static unsigned int _strlen31(const char *str)
* (unless when compiling with -D_POSIX_SOURCE, * (unless when compiling with -D_POSIX_SOURCE,
* which doesn't work for us) */ * which doesn't work for us) */
# endif # 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 */ # ifdef OPENSSL_SYS_NEWS4 /* setvbuf is missing on mips-sony-bsd */
# define setvbuf(a, b, c, d) setbuffer((a), (b), (d)) # define setvbuf(a, b, c, d) setbuffer((a), (b), (d))
typedef unsigned long clock_t; typedef unsigned long clock_t;
@ -637,12 +631,6 @@ static unsigned int _strlen31(const char *str)
#endif #endif
#if defined(__ultrix)
# ifndef ssize_t
# define ssize_t int
# endif
#endif
#if defined(sun) && !defined(__svr4__) && !defined(__SVR4) #if defined(sun) && !defined(__svr4__) && !defined(__SVR4)
/* include headers first, so our defines don't break it */ /* include headers first, so our defines don't break it */
#include <stdlib.h> #include <stdlib.h>

20
e_os2.h
View File

@ -283,6 +283,26 @@ extern "C" {
# define OPENSSL_GLOBAL_REF(name) _shadow_##name # define OPENSSL_GLOBAL_REF(name) _shadow_##name
#endif #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 #ifdef __cplusplus
} }
#endif #endif

View File

@ -23,7 +23,7 @@ extern void *OPENSSL_UplinkTable[];
#define UP_fileno (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FILENO]) #define UP_fileno (*(int (*)(void *))OPENSSL_UplinkTable[APPLINK_FILENO])
#define UP_open (*(int (*)(const char *,int,...))OPENSSL_UplinkTable[APPLINK_OPEN]) #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_read (*(ossl_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_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_lseek (*(long (*)(int,long,int))OPENSSL_UplinkTable[APPLINK_LSEEK])
#define UP_close (*(int (*)(int))OPENSSL_UplinkTable[APPLINK_CLOSE]) #define UP_close (*(int (*)(int))OPENSSL_UplinkTable[APPLINK_CLOSE])