From 6343829a391df59e46e513c84b6264ee71ad9518 Mon Sep 17 00:00:00 2001 From: Geoff Thorpe Date: Wed, 12 Nov 2008 03:58:08 +0000 Subject: Revert the size_t modifications from HEAD that had led to more knock-on work than expected - they've been extracted into a patch series that can be completed elsewhere, or in a different branch, before merging back to HEAD. --- apps/s_apps.h | 9 +-- apps/s_cb.c | 2 +- apps/s_socket.c | 4 +- crypto/asn1/a_bitstr.c | 28 +++++----- crypto/asn1/a_bool.c | 4 +- crypto/asn1/a_bytes.c | 8 +-- crypto/asn1/a_int.c | 18 +++--- crypto/asn1/a_mbstr.c | 14 ++--- crypto/asn1/a_object.c | 33 +++++------ crypto/asn1/a_octet.c | 12 ++-- crypto/asn1/a_print.c | 7 +-- crypto/asn1/a_set.c | 12 ++-- crypto/asn1/a_strnid.c | 2 +- crypto/asn1/a_time.c | 5 +- crypto/asn1/a_utf8.c | 4 +- crypto/asn1/ameth_lib.c | 4 +- crypto/asn1/asn1.h | 133 +++++++++++++++++++++----------------------- crypto/asn1/asn1_gen.c | 2 +- crypto/asn1/asn1_lib.c | 44 +++++++-------- crypto/asn1/asn1_locl.h | 10 ++-- crypto/asn1/asn1_mac.h | 6 +- crypto/asn1/asn1_par.c | 26 ++++----- crypto/asn1/asn1t.h | 4 +- crypto/asn1/asn_pack.c | 4 +- crypto/asn1/d2i_pr.c | 2 +- crypto/asn1/d2i_pu.c | 2 +- crypto/asn1/evp_asn1.c | 10 ++-- crypto/asn1/tasn_dec.c | 5 +- crypto/asn1/x_pkey.c | 2 +- crypto/asn1/x_pubkey.c | 8 +-- crypto/bf/bf_skey.c | 2 +- crypto/bf/blowfish.h | 3 +- crypto/bio/bio.h | 16 +++--- crypto/bio/bio_cb.c | 2 +- crypto/bio/bio_lib.c | 22 ++++---- crypto/bn/asm/x86_64-gcc.c | 3 +- crypto/bn/bn.h | 35 +++++------- crypto/bn/bn_add.c | 6 +- crypto/bn/bn_asm.c | 10 ++-- crypto/bn/bn_div.c | 13 ++--- crypto/bn/bn_exp.c | 13 ++--- crypto/bn/bn_lcl.h | 31 +++++------ crypto/bn/bn_lib.c | 12 ++-- crypto/bn/bn_mpi.c | 2 +- crypto/bn/bn_mul.c | 24 ++++---- crypto/bn/bn_nist.c | 5 +- crypto/bn/bn_print.c | 4 +- crypto/bn/bn_rand.c | 9 ++- crypto/bn/bn_recp.c | 2 +- crypto/bn/bn_word.c | 7 --- crypto/camellia/cmll_locl.h | 2 +- crypto/crypto.h | 32 +++++------ crypto/dh/dh.h | 2 +- crypto/dh/dh_ameth.c | 2 +- crypto/dsa/dsa.h | 8 +-- crypto/dsa/dsa_ameth.c | 4 +- crypto/ec/ec.h | 4 +- crypto/ec/ec_ameth.c | 4 +- crypto/ec/ec_asn1.c | 4 +- crypto/ecdsa/ecdsa.h | 2 +- crypto/ecdsa/ecdsatest.c | 4 +- crypto/evp/e_des3.c | 6 +- crypto/evp/encode.c | 15 +++-- crypto/evp/evp.h | 109 ++++++++++++++++++------------------ crypto/evp/evp_enc.c | 17 +++--- crypto/evp/evp_key.c | 2 +- crypto/evp/evp_lib.c | 19 +++---- crypto/evp/p_open.c | 4 +- crypto/evp/p_verify.c | 4 +- crypto/hmac/hm_ameth.c | 2 +- crypto/hmac/hmac.c | 6 +- crypto/hmac/hmac.h | 6 +- crypto/mem.c | 30 +++++----- crypto/mem_dbg.c | 10 ++-- crypto/objects/o_names.c | 4 +- crypto/objects/obj_dat.c | 20 +++---- crypto/objects/obj_lib.c | 2 +- crypto/objects/objects.h | 3 +- crypto/pem/pem_info.c | 6 +- crypto/pkcs12/p12_decr.c | 19 +++---- crypto/pkcs12/pkcs12.h | 3 +- crypto/rand/md_rand.c | 28 ++++------ crypto/rand/rand.h | 20 +++---- crypto/rand/rand_egd.c | 6 +- crypto/rand/rand_lib.c | 8 +-- crypto/rand/rand_unix.c | 4 +- crypto/rand/randfile.c | 10 ++-- crypto/rsa/rsa_ameth.c | 2 +- crypto/ts/ts.h | 19 +++---- crypto/x509/x509.h | 13 ++--- engines/e_4758cca.c | 4 +- engines/e_chil.c | 4 +- engines/e_cswift.c | 4 +- engines/e_sureware.c | 12 ++-- ssl/d1_enc.c | 18 +++--- ssl/s3_clnt.c | 2 +- ssl/ssl.h | 4 +- ssl/ssl_asn1.c | 2 +- ssl/ssl_lib.c | 2 +- ssl/t1_enc.c | 43 +++++++------- 100 files changed, 559 insertions(+), 646 deletions(-) diff --git a/apps/s_apps.h b/apps/s_apps.h index a46d77b6d8..08fbbc2229 100644 --- a/apps/s_apps.h +++ b/apps/s_apps.h @@ -148,9 +148,7 @@ typedef fd_mask fd_set; #define PORT_STR "4433" #define PROTOCOL "tcp" -int do_server(int port, int type, int *ret, - int (*cb) (char *hostname, int s, unsigned char *context), - unsigned char *context); +int do_server(int port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context); #ifdef HEADER_X509_H int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx); #endif @@ -164,12 +162,11 @@ int extract_port(char *str, short *port_ptr); int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p); long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp, - size_t argi, long argl, long ret); + int argi, long argl, long ret); #ifdef HEADER_SSL_H void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret); -void MS_CALLBACK msg_cb(int write_p, int version, int content_type, - const void *buf, size_t len, SSL *ssl, void *arg); +void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg); void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type, unsigned char *data, int len, void *arg); diff --git a/apps/s_cb.c b/apps/s_cb.c index d750ca9ddd..103893090a 100644 --- a/apps/s_cb.c +++ b/apps/s_cb.c @@ -260,7 +260,7 @@ int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key) } long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp, - size_t argi, long argl, long ret) + int argi, long argl, long ret) { BIO *out; diff --git a/apps/s_socket.c b/apps/s_socket.c index f884f6d33e..b5f9db3062 100644 --- a/apps/s_socket.c +++ b/apps/s_socket.c @@ -279,9 +279,7 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port, int type) return(1); } -int do_server(int port, int type, int *ret, - int (*cb)(char *hostname, int s, unsigned char *context), - unsigned char *context) +int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context) { int sock; char *name = NULL; diff --git a/crypto/asn1/a_bitstr.c b/crypto/asn1/a_bitstr.c index 63331b2e1e..34179960b8 100644 --- a/crypto/asn1/a_bitstr.c +++ b/crypto/asn1/a_bitstr.c @@ -60,13 +60,12 @@ #include "cryptlib.h" #include -int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, size_t len) - { return M_ASN1_BIT_STRING_set(x, d, len); } +int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len) +{ return M_ASN1_BIT_STRING_set(x, d, len); } int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) { - int ret,j,bits; - size_t len; + int ret,j,bits,len; unsigned char *p,*d; if (a == NULL) return(0); @@ -115,7 +114,7 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) } ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, - const unsigned char **pp, size_t len) + const unsigned char **pp, long len) { ASN1_BIT_STRING *ret=NULL; const unsigned char *p; @@ -145,13 +144,13 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, if (len-- > 1) /* using one because of the bits left byte */ { - s=OPENSSL_malloc(len); + s=(unsigned char *)OPENSSL_malloc((int)len); if (s == NULL) { i=ERR_R_MALLOC_FAILURE; goto err; } - memcpy(s,p,len); + memcpy(s,p,(int)len); s[len-1]&=(0xff< */ -int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n, int value) +int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value) { - int v,iv; - size_t w; + int w,v,iv; unsigned char *c; w=n/8; @@ -194,9 +192,11 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n, int value) { if (!value) return(1); /* Don't need to set */ if (a->data == NULL) - c=OPENSSL_malloc(w+1); + c=(unsigned char *)OPENSSL_malloc(w+1); else - c=OPENSSL_realloc_clean(a->data, a->length, w+1); + c=(unsigned char *)OPENSSL_realloc_clean(a->data, + a->length, + w+1); if (c == NULL) { ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT,ERR_R_MALLOC_FAILURE); @@ -212,7 +212,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n, int value) return(1); } -int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, size_t n) +int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n) { int w,v; @@ -230,7 +230,7 @@ int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, size_t n) * 'len' is the length of 'flags'. */ int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, - unsigned char *flags, size_t flags_len) + unsigned char *flags, int flags_len) { int i, ok; /* Check if there is one bit set at all. */ diff --git a/crypto/asn1/a_bool.c b/crypto/asn1/a_bool.c index bf5c079e92..331acdf053 100644 --- a/crypto/asn1/a_bool.c +++ b/crypto/asn1/a_bool.c @@ -75,11 +75,11 @@ int i2d_ASN1_BOOLEAN(int a, unsigned char **pp) return(r); } -int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, size_t length) +int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length) { int ret= -1; const unsigned char *p; - size_t len; + long len; int inf,tag,xclass; int i=0; diff --git a/crypto/asn1/a_bytes.c b/crypto/asn1/a_bytes.c index 1bf9247d8e..8d13f9c931 100644 --- a/crypto/asn1/a_bytes.c +++ b/crypto/asn1/a_bytes.c @@ -64,12 +64,12 @@ static int asn1_collate_primitive(ASN1_STRING *a, ASN1_const_CTX *c); /* type is a 'bitmap' of acceptable string types. */ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp, - size_t length, int type) + long length, int type) { ASN1_STRING *ret=NULL; const unsigned char *p; unsigned char *s; - size_t len; + long len; int inf,tag,xclass; int i=0; @@ -155,12 +155,12 @@ int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass) } ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, - size_t length, int Ptag, int Pclass) + long length, int Ptag, int Pclass) { ASN1_STRING *ret=NULL; const unsigned char *p; unsigned char *s; - size_t len; + long len; int inf,tag,xclass; int i=0; diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c index 7691193c51..c6fd204ae3 100644 --- a/crypto/asn1/a_int.c +++ b/crypto/asn1/a_int.c @@ -176,7 +176,7 @@ int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp) /* Convert just ASN1 INTEGER content octets to ASN1_INTEGER structure */ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, - size_t len) + long len) { ASN1_INTEGER *ret=NULL; const unsigned char *p, *pend; @@ -196,7 +196,7 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it * signifies a missing NULL parameter. */ - s=OPENSSL_malloc(len+1); + s=(unsigned char *)OPENSSL_malloc((int)len+1); if (s == NULL) { i=ERR_R_MALLOC_FAILURE; @@ -246,7 +246,7 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, p++; len--; } - memcpy(s,p,len); + memcpy(s,p,(int)len); } if (ret->data != NULL) OPENSSL_free(ret->data); @@ -269,12 +269,12 @@ err: */ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, - size_t length) + long length) { ASN1_INTEGER *ret=NULL; const unsigned char *p; unsigned char *to,*s; - size_t len; + long len; int inf,tag,xclass; int i; @@ -302,7 +302,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it * signifies a missing NULL parameter. */ - s=OPENSSL_malloc(len+1); + s=(unsigned char *)OPENSSL_malloc((int)len+1); if (s == NULL) { i=ERR_R_MALLOC_FAILURE; @@ -316,7 +316,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, p++; len--; } - memcpy(s,p,len); + memcpy(s,p,(int)len); p+=len; } @@ -405,7 +405,7 @@ long ASN1_INTEGER_get(const ASN1_INTEGER *a) ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) { ASN1_INTEGER *ret; - size_t len,j; + int len,j; if (ai == NULL) ret=M_ASN1_INTEGER_new(); @@ -423,7 +423,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) len=((j == 0)?0:((j/8)+1)); if (ret->length < len+4) { - unsigned char *new_data=OPENSSL_realloc(ret->data, len+4U); + unsigned char *new_data=OPENSSL_realloc(ret->data, len+4); if (!new_data) { ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE); diff --git a/crypto/asn1/a_mbstr.c b/crypto/asn1/a_mbstr.c index 805d9c69bd..1bcd046893 100644 --- a/crypto/asn1/a_mbstr.c +++ b/crypto/asn1/a_mbstr.c @@ -80,15 +80,15 @@ static int is_printable(unsigned long value); * The 'ncopy' form checks minimum and maximum size limits too. */ -int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, size_t len, - int inform, unsigned long mask) +int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask) { return ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0); } -int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, size_t len, - int inform, unsigned long mask, size_t minsize, - size_t maxsize) +int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, + int inform, unsigned long mask, + long minsize, long maxsize) { int str_type; int ret; @@ -145,14 +145,14 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, size_t len, if((minsize > 0) && (nchar < minsize)) { ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT); - BIO_snprintf(strbuf, sizeof strbuf, "%ld", (long)minsize); + BIO_snprintf(strbuf, sizeof strbuf, "%ld", minsize); ERR_add_error_data(2, "minsize=", strbuf); return -1; } if((maxsize > 0) && (nchar > maxsize)) { ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_LONG); - BIO_snprintf(strbuf, sizeof strbuf, "%ld", (long)maxsize); + BIO_snprintf(strbuf, sizeof strbuf, "%ld", maxsize); ERR_add_error_data(2, "maxsize=", strbuf); return -1; } diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c index 570aac71a7..f1a5a1e31e 100644 --- a/crypto/asn1/a_object.c +++ b/crypto/asn1/a_object.c @@ -83,13 +83,11 @@ int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp) return(objsize); } -size_t a2d_ASN1_OBJECT(unsigned char *out, size_t olen, const char *buf, - int num) +int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) { - int i,len=0,c, use_bn; - unsigned first; + int i,first,len=0,c, use_bn; char ftmp[24], *tmp = ftmp; - size_t tmpsize = sizeof ftmp; + int tmpsize = sizeof ftmp; const char *p; unsigned long l; BIGNUM *bl = NULL; @@ -152,11 +150,11 @@ size_t a2d_ASN1_OBJECT(unsigned char *out, size_t olen, const char *buf, if (use_bn) { if (!BN_mul_word(bl, 10L) - || !BN_add_signed_word(bl, c-'0')) + || !BN_add_word(bl, c-'0')) goto err; } else - l=l*10L+(c-'0'); + l=l*10L+(long)(c-'0'); } if (len == 0) { @@ -229,7 +227,7 @@ err: return(0); } -int i2t_ASN1_OBJECT(char *buf, size_t buf_len, ASN1_OBJECT *a) +int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a) { return OBJ_obj2txt(buf, buf_len, a, 0); } @@ -237,7 +235,7 @@ int i2t_ASN1_OBJECT(char *buf, size_t buf_len, ASN1_OBJECT *a) int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a) { char buf[80], *p = buf; - size_t i; + int i; if ((a == NULL) || (a->data == NULL)) return(BIO_write(bp,"NULL",4)); @@ -258,14 +256,13 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a) } ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, - size_t length) + long length) { const unsigned char *p; - size_t len; + long len; int tag,xclass; int inf,i; ASN1_OBJECT *ret = NULL; - p= *pp; inf=ASN1_get_object(&p,&len,&tag,&xclass,length); if (inf & 0x80) @@ -287,7 +284,7 @@ err: return(NULL); } ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, - size_t len) + long len) { ASN1_OBJECT *ret=NULL; const unsigned char *p; @@ -312,15 +309,15 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, { ret->length=0; if (data != NULL) OPENSSL_free(data); - data=OPENSSL_malloc(len ? len : 1); + data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1); if (data == NULL) { i=ERR_R_MALLOC_FAILURE; goto err; } ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA; } - memcpy(data,p,len); + memcpy(data,p,(int)len); /* reattach data to object, after which it remains const */ - ret->data=data; - ret->length=len; + ret->data =data; + ret->length=(int)len; ret->sn=NULL; ret->ln=NULL; /* ret->flags=ASN1_OBJECT_FLAG_DYNAMIC; we know it is dynamic */ @@ -376,7 +373,7 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a) OPENSSL_free(a); } -ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, size_t len, +ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, const char *sn, const char *ln) { ASN1_OBJECT o; diff --git a/crypto/asn1/a_octet.c b/crypto/asn1/a_octet.c index edeccddf57..e8725e44f1 100644 --- a/crypto/asn1/a_octet.c +++ b/crypto/asn1/a_octet.c @@ -61,13 +61,11 @@ #include ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x) - { return M_ASN1_OCTET_STRING_dup(x); } +{ return M_ASN1_OCTET_STRING_dup(x); } -int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, - const ASN1_OCTET_STRING *b) - { return M_ASN1_OCTET_STRING_cmp(a, b); } +int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b) +{ return M_ASN1_OCTET_STRING_cmp(a, b); } -int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, - size_t len) - { return M_ASN1_OCTET_STRING_set(x, d, len); } +int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int len) +{ return M_ASN1_OCTET_STRING_set(x, d, len); } diff --git a/crypto/asn1/a_print.c b/crypto/asn1/a_print.c index b3700b43fb..d18e772320 100644 --- a/crypto/asn1/a_print.c +++ b/crypto/asn1/a_print.c @@ -60,17 +60,16 @@ #include "cryptlib.h" #include -int ASN1_PRINTABLE_type(const unsigned char *s, size_t len) +int ASN1_PRINTABLE_type(const unsigned char *s, int len) { int c; int ia5=0; int t61=0; - int ignore_len = 0; - if (len == 0) ignore_len = 1; + if (len <= 0) len= -1; if (s == NULL) return(V_ASN1_PRINTABLESTRING); - while (*s && !ignore_len && len-- != 0) + while ((*s) && (len-- != 0)) { c= *(s++); #ifndef CHARSET_EBCDIC diff --git a/crypto/asn1/a_set.c b/crypto/asn1/a_set.c index 09e5dc9818..2405ce1ec2 100644 --- a/crypto/asn1/a_set.c +++ b/crypto/asn1/a_set.c @@ -65,7 +65,7 @@ typedef struct { unsigned char *pbData; - size_t cbData; + int cbData; } MYBLOB; /* SetBlobCmp @@ -85,11 +85,11 @@ static int SetBlobCmp(const void *elem1, const void *elem2 ) } /* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */ -size_t i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp, - i2d_of_void *i2d, int ex_tag, int ex_class, - int is_set) +int i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp, + i2d_of_void *i2d, int ex_tag, int ex_class, + int is_set) { - size_t ret=0,r; + int ret=0,r; int i; unsigned char *p; unsigned char *pStart, *pTempMem; @@ -164,7 +164,7 @@ SetBlob } STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp, - size_t length, d2i_of_void *d2i, + long length, d2i_of_void *d2i, void (*free_func)(BLOCK), int ex_tag, int ex_class) { diff --git a/crypto/asn1/a_strnid.c b/crypto/asn1/a_strnid.c index 6aea3146eb..753021a7a2 100644 --- a/crypto/asn1/a_strnid.c +++ b/crypto/asn1/a_strnid.c @@ -121,7 +121,7 @@ int ASN1_STRING_set_default_mask_asc(char *p) */ ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in, - size_t inlen, int inform, int nid) + int inlen, int inform, int nid) { ASN1_STRING_TABLE *tbl; ASN1_STRING *str = NULL; diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c index 0d618873c7..577e263402 100644 --- a/crypto/asn1/a_time.c +++ b/crypto/asn1/a_time.c @@ -135,12 +135,11 @@ int ASN1_TIME_check(ASN1_TIME *t) } /* Convert an ASN1_TIME structure to GeneralizedTime */ -ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, - ASN1_GENERALIZEDTIME **out) +ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out) { ASN1_GENERALIZEDTIME *ret; char *str; - size_t newlen; + int newlen; if (!ASN1_TIME_check(t)) return NULL; diff --git a/crypto/asn1/a_utf8.c b/crypto/asn1/a_utf8.c index c677c99a52..508e11e527 100644 --- a/crypto/asn1/a_utf8.c +++ b/crypto/asn1/a_utf8.c @@ -73,7 +73,7 @@ * -4 = character encoded incorrectly (not minimal length). */ -int UTF8_getc(const unsigned char *str, size_t len, unsigned long *val) +int UTF8_getc(const unsigned char *str, int len, unsigned long *val) { const unsigned char *p; unsigned long value; @@ -152,7 +152,7 @@ int UTF8_getc(const unsigned char *str, size_t len, unsigned long *val) * It will need at most 6 characters. */ -int UTF8_putc(unsigned char *str, size_t len, unsigned long value) +int UTF8_putc(unsigned char *str, int len, unsigned long value) { if(!str) len = 6; /* Maximum we will need */ else if(len <= 0) return -1; diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c index 9f1df662db..18957c669e 100644 --- a/crypto/asn1/ameth_lib.c +++ b/crypto/asn1/ameth_lib.c @@ -416,13 +416,13 @@ void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, int (*param_decode)(EVP_PKEY *pkey, - const unsigned char **pder, size_t derlen), + const unsigned char **pder, int derlen), int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder), int (*param_missing)(const EVP_PKEY *pk), int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from), int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, - ASN1_PCTX *pctx)) + ASN1_PCTX *pctx)) { ameth->param_decode = param_decode; ameth->param_encode = param_encode; diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h index b2dc58a0d7..a08ca334a0 100644 --- a/crypto/asn1/asn1.h +++ b/crypto/asn1/asn1.h @@ -180,7 +180,7 @@ typedef struct asn1_ctx_st int inf; /* constructed if 0x20, indefinite is 0x21 */ int tag; /* tag from last 'get object' */ int xclass; /* class from last 'get object' */ - size_t slen; /* length of last 'get object' */ + long slen; /* length of last 'get object' */ unsigned char *max; /* largest value of p allowed */ unsigned char *q;/* temporary variable */ unsigned char **pp;/* variable */ @@ -195,7 +195,7 @@ typedef struct asn1_const_ctx_st int inf; /* constructed if 0x20, indefinite is 0x21 */ int tag; /* tag from last 'get object' */ int xclass; /* class from last 'get object' */ - size_t slen; /* length of last 'get object' */ + long slen; /* length of last 'get object' */ const unsigned char *max; /* largest value of p allowed */ const unsigned char *q;/* temporary variable */ const unsigned char **pp;/* variable */ @@ -212,7 +212,7 @@ typedef struct asn1_object_st { const char *sn,*ln; int nid; - size_t length; + int length; const unsigned char *data; /* data remains const after init */ int flags; /* Should we free this one */ } ASN1_OBJECT; @@ -233,7 +233,7 @@ typedef struct asn1_object_st /* This is the base type that holds just about everything :-) */ typedef struct asn1_string_st { - size_t length; + int length; int type; unsigned char *data; /* The value of the following field depends on the type being @@ -251,7 +251,7 @@ typedef struct asn1_string_st typedef struct ASN1_ENCODING_st { unsigned char *enc; /* DER encoding */ - size_t len; /* Length of encoding */ + long len; /* Length of encoding */ int modified; /* set to 1 if 'enc' is invalid */ } ASN1_ENCODING; @@ -310,12 +310,12 @@ typedef struct ASN1_VALUE_st ASN1_VALUE; DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) #define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ - type *d2i_##name(type **a, const unsigned char **in, size_t len); \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ int i2d_##name(type *a, unsigned char **out); \ DECLARE_ASN1_ITEM(itname) #define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ - type *d2i_##name(type **a, const unsigned char **in, size_t len); \ + type *d2i_##name(type **a, const unsigned char **in, long len); \ int i2d_##name(const type *a, unsigned char **out); \ DECLARE_ASN1_ITEM(name) @@ -337,7 +337,7 @@ typedef struct ASN1_VALUE_st ASN1_VALUE; int fname##_print_ctx(BIO *out, stname *x, int indent, \ const ASN1_PCTX *pctx); -#define D2I_OF(type) type *(*)(type **,const unsigned char **,size_t) +#define D2I_OF(type) type *(*)(type **,const unsigned char **,long) #define I2D_OF(type) int (*)(type *,unsigned char **) #define I2D_OF_const(type) int (*)(const type *,unsigned char **) @@ -352,7 +352,7 @@ typedef struct ASN1_VALUE_st ASN1_VALUE; #define CHECKED_PPTR_OF(type, p) \ ((void**) (1 ? p : (type**)0)) -#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,size_t) +#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long) #define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) #define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type) @@ -778,9 +778,9 @@ ASN1_OBJECT * ASN1_OBJECT_new(void ); void ASN1_OBJECT_free(ASN1_OBJECT *a); int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, - size_t length); + long length); ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, - size_t length); + long length); DECLARE_ASN1_ITEM(ASN1_OBJECT) @@ -795,24 +795,23 @@ ASN1_STRING * ASN1_STRING_type_new(int type ); int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); /* Since this is used to store all sorts of things, via macros, for now, make its data void * */ -int ASN1_STRING_set(ASN1_STRING *str, const void *data, size_t len); -void ASN1_STRING_set0(ASN1_STRING *str, void *data, size_t len); -size_t ASN1_STRING_length(const ASN1_STRING *x); -void ASN1_STRING_length_set(ASN1_STRING *x, size_t n); +int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); +void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); +int ASN1_STRING_length(const ASN1_STRING *x); +void ASN1_STRING_length_set(ASN1_STRING *x, int n); int ASN1_STRING_type(ASN1_STRING *x); unsigned char * ASN1_STRING_data(ASN1_STRING *x); DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); -ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, - const unsigned char **pp, size_t length); +ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp, + long length); int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, - size_t length); -int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n, - int value); -int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, size_t n); -int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, - unsigned char *flags, size_t flags_len); + int length ); +int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); +int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); +int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, + unsigned char *flags, int flags_len); #ifndef OPENSSL_NO_BIO int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, @@ -822,15 +821,15 @@ int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl); int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, BIT_STRING_BITNAME *tbl); -int i2d_ASN1_BOOLEAN(int a, unsigned char **pp); -int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, size_t length); +int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); +int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length); DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp, - size_t length); + long length); ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, - size_t length); + long length); ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x); int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); @@ -855,8 +854,7 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b); -int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, - size_t len); +int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) @@ -864,8 +862,8 @@ DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING) DECLARE_ASN1_FUNCTIONS(ASN1_NULL) DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING) -int UTF8_getc(const unsigned char *str, size_t len, unsigned long *val); -int UTF8_putc(unsigned char *str, size_t len, unsigned long value); +int UTF8_getc(const unsigned char *str, int len, unsigned long *val); +int UTF8_putc(unsigned char *str, int len, unsigned long value); DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE) @@ -887,11 +885,11 @@ ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t, int ASN1_TIME_check(ASN1_TIME *t); ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); -size_t i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp, - i2d_of_void *i2d, int ex_tag, int ex_class, - int is_set); +int i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp, + i2d_of_void *i2d, int ex_tag, int ex_class, + int is_set); STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp, - size_t length, d2i_of_void *d2i, + long length, d2i_of_void *d2i, void (*free_func)(BLOCK), int ex_tag, int ex_class); @@ -904,12 +902,11 @@ int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a); int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); #endif -int i2t_ASN1_OBJECT(char *buf,size_t buf_len,ASN1_OBJECT *a); +int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); -size_t a2d_ASN1_OBJECT(unsigned char *out, size_t olen, const char *buf, - int num); -ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, size_t len, - const char *sn, const char *ln); +int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num); +ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, + const char *sn, const char *ln); int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); long ASN1_INTEGER_get(const ASN1_INTEGER *a); @@ -923,29 +920,29 @@ BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn); /* General */ /* given a string, return the correct type, max is the maximum length */ -int ASN1_PRINTABLE_type(const unsigned char *s, size_t max); +int ASN1_PRINTABLE_type(const unsigned char *s, int max); int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, - size_t length, int Ptag, int Pclass); + long length, int Ptag, int Pclass); unsigned long ASN1_tag2bit(int tag); /* type is one or more of the B_ASN1_ values. */ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp, - size_t length,int type); + long length,int type); /* PARSING */ int asn1_Finish(ASN1_CTX *c); int asn1_const_Finish(ASN1_const_CTX *c); /* SPECIALS */ -int ASN1_get_object(const unsigned char **pp, size_t *plength, int *ptag, - int *pclass, size_t omax); -int ASN1_check_infinite_end(unsigned char **p, size_t len); -int ASN1_const_check_infinite_end(const unsigned char **p, size_t len); -void ASN1_put_object(unsigned char **pp, int constructed, size_t length, - int tag, int xclass); +int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, + int *pclass, long omax); +int ASN1_check_infinite_end(unsigned char **p,long len); +int ASN1_const_check_infinite_end(const unsigned char **p,long len); +void ASN1_put_object(unsigned char **pp, int constructed, int length, + int tag, int xclass); int ASN1_put_eoc(unsigned char **pp); -size_t ASN1_object_size(int constructed, size_t length, int tag); +int ASN1_object_size(int constructed, int length, int tag); /* Used to implement other functions */ void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x); @@ -1026,9 +1023,8 @@ int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, unsigned char *buf, int off); -int ASN1_parse(BIO *bp, const unsigned char *pp, size_t len, int indent); -int ASN1_parse_dump(BIO *bp, const unsigned char *pp, size_t len, int indent, - int dump); +int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent); +int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump); #endif const char *ASN1_tag2str(int tag); @@ -1039,24 +1035,24 @@ DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509) int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, - unsigned char *data, size_t len); + unsigned char *data, int len); int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, - unsigned char *data, size_t max_len); + unsigned char *data, int max_len); int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, - unsigned char *data, size_t len); -int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, - unsigned char *data, size_t max_len); + unsigned char *data, int len); +int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num, + unsigned char *data, int max_len); -STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, size_t len, +STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len, d2i_of_void *d2i, void (*free_func)(BLOCK)); unsigned char *ASN1_seq_pack(STACK_OF(BLOCK) *safes, i2d_of_void *i2d, - unsigned char **buf, size_t *len); + unsigned char **buf, int *len ); void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, ASN1_OCTET_STRING **oct); -#define ASN1_pack_string_of(type,obj,i2d,oct) \ +#define ASN1_pack_string_of(type,obj,i2d,oct) \ (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \ CHECKED_I2D_OF(type, i2d), \ oct)) @@ -1066,15 +1062,14 @@ ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING ** void ASN1_STRING_set_default_mask(unsigned long mask); int ASN1_STRING_set_default_mask_asc(char *p); unsigned long ASN1_STRING_get_default_mask(void); -int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, size_t len, +int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, int inform, unsigned long mask); -int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, size_t len, +int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, int inform, unsigned long mask, - size_t minsize, size_t maxsize); + long minsize, long maxsize); ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, - const unsigned char *in, size_t inlen, - int inform, int nid); + const unsigned char *in, int inlen, int inform, int nid); ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); void ASN1_STRING_TABLE_cleanup(void); @@ -1084,11 +1079,9 @@ void ASN1_STRING_TABLE_cleanup(void); /* Old API compatible functions */ ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); -ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, - size_t len, const ASN1_ITEM *it); +ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it); int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); -int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, - const ASN1_ITEM *it); +int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); void ASN1_add_oid_module(void); diff --git a/crypto/asn1/asn1_gen.c b/crypto/asn1/asn1_gen.c index a0f7e452f6..04395d2281 100644 --- a/crypto/asn1/asn1_gen.c +++ b/crypto/asn1/asn1_gen.c @@ -145,7 +145,7 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) unsigned char *p; const unsigned char *cp; int cpy_len; - size_t hdr_len; + long hdr_len; int hdr_constructed = 0, hdr_tag, hdr_class; int r; diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c index 0da09a9598..1bcb44aee2 100644 --- a/crypto/asn1/asn1_lib.c +++ b/crypto/asn1/asn1_lib.c @@ -62,8 +62,7 @@ #include #include -static int asn1_get_length(const unsigned char **pp, int *inf, size_t *rl, - size_t max); +static int asn1_get_length(const unsigned char **pp,int *inf,long *rl,int max); static void asn1_put_length(unsigned char **pp, int length); const char ASN1_version[]="ASN.1" OPENSSL_VERSION_PTEXT; @@ -81,29 +80,27 @@ static int _asn1_check_infinite_end(const unsigned char **p, long len) return(0); } -int ASN1_check_infinite_end(unsigned char **p, size_t len) +int ASN1_check_infinite_end(unsigned char **p, long len) { return _asn1_check_infinite_end((const unsigned char **)p, len); } -int ASN1_const_check_infinite_end(const unsigned char **p, size_t len) +int ASN1_const_check_infinite_end(const unsigned char **p, long len) { return _asn1_check_infinite_end(p, len); } -int ASN1_get_object(const unsigned char **pp, size_t *plength, int *ptag, - int *pclass, size_t omax) +int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, + int *pclass, long omax) { int i,ret; long l; const unsigned char *p= *pp; int tag,xclass,inf; - size_t max=omax; - - if (!max) - goto err; + long max=omax; + if (!max) goto err; ret=(*p&V_ASN1_CONSTRUCTED); xclass=(*p&V_ASN1_PRIVATE); i= *p&V_ASN1_PRIMITIVE_TAG; @@ -154,8 +151,7 @@ err: return(0x80); } -static int asn1_get_length(const unsigned char **pp, int *inf, size_t *rl, - size_t max) +static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max) { const unsigned char *p= *pp; unsigned long ret=0; @@ -196,8 +192,8 @@ static int asn1_get_length(const unsigned char **pp, int *inf, size_t *rl, /* class 0 is constructed * constructed == 2 for indefinite length constructed */ -void ASN1_put_object(unsigned char **pp, int constructed, size_t length, - int tag, int xclass) +void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag, + int xclass) { unsigned char *p= *pp; int i, ttag; @@ -258,7 +254,7 @@ static void asn1_put_length(unsigned char **pp, int length) *pp=p; } -size_t ASN1_object_size(int constructed, size_t length, int tag) +int ASN1_object_size(int constructed, int length, int tag) { int ret; @@ -315,7 +311,7 @@ int asn1_const_Finish(ASN1_const_CTX *c) return _asn1_Finish(c); } -int asn1_GetSequence(ASN1_const_CTX *c, size_t *length) +int asn1_GetSequence(ASN1_const_CTX *c, long *length) { const unsigned char *q; @@ -371,7 +367,7 @@ ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str) return ret; } -int ASN1_STRING_set(ASN1_STRING *str, const void *_data, size_t len) +int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) { unsigned char *c; const char *data=_data; @@ -408,7 +404,7 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, size_t len) return(1); } -void ASN1_STRING_set0(ASN1_STRING *str, void *data, size_t len) +void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) { if (str->data) OPENSSL_free(str->data); @@ -473,14 +469,14 @@ void asn1_add_error(const unsigned char *address, int offset) ERR_add_error_data(4,"address=",buf1," offset=",buf2); } -size_t ASN1_STRING_length(const ASN1_STRING *x) - { return M_ASN1_STRING_length(x); } +int ASN1_STRING_length(const ASN1_STRING *x) +{ return M_ASN1_STRING_length(x); } -void ASN1_STRING_length_set(ASN1_STRING *x, size_t len) - { M_ASN1_STRING_length_set(x, len); return; } +void ASN1_STRING_length_set(ASN1_STRING *x, int len) +{ M_ASN1_STRING_length_set(x, len); return; } int ASN1_STRING_type(ASN1_STRING *x) - { return M_ASN1_STRING_type(x); } +{ return M_ASN1_STRING_type(x); } unsigned char * ASN1_STRING_data(ASN1_STRING *x) - { return M_ASN1_STRING_data(x); } +{ return M_ASN1_STRING_data(x); } diff --git a/crypto/asn1/asn1_locl.h b/crypto/asn1/asn1_locl.h index 9744cf66d7..5aa65e28f5 100644 --- a/crypto/asn1/asn1_locl.h +++ b/crypto/asn1/asn1_locl.h @@ -84,24 +84,24 @@ struct evp_pkey_asn1_method_st int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk); int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b); int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent, - ASN1_PCTX *pctx); + ASN1_PCTX *pctx); int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf); int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk); int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, - ASN1_PCTX *pctx); + ASN1_PCTX *pctx); int (*pkey_size)(const EVP_PKEY *pk); int (*pkey_bits)(const EVP_PKEY *pk); int (*param_decode)(EVP_PKEY *pkey, - const unsigned char **pder, size_t derlen); + const unsigned char **pder, int derlen); int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder); int (*param_missing)(const EVP_PKEY *pk); int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from); int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b); int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, - ASN1_PCTX *pctx); + ASN1_PCTX *pctx); void (*pkey_free)(EVP_PKEY *pkey); int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2); @@ -109,7 +109,7 @@ struct evp_pkey_asn1_method_st /* Legacy functions for old PEM */ int (*old_priv_decode)(EVP_PKEY *pkey, - const unsigned char **pder, size_t derlen); + const unsigned char **pder, int derlen); int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder); } /* EVP_PKEY_ASN1_METHOD */; diff --git a/crypto/asn1/asn1_mac.h b/crypto/asn1/asn1_mac.h index a6a8dfc6a1..87bd0e9e1d 100644 --- a/crypto/asn1/asn1_mac.h +++ b/crypto/asn1/asn1_mac.h @@ -279,7 +279,7 @@ err:\ (V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \ { \ int Tinf,Ttag,Tclass; \ - size_t Tlen; \ + long Tlen; \ \ c.q=c.p; \ Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ @@ -569,8 +569,8 @@ err:\ #define M_ASN1_I2D_finish() *pp=p; \ return(r); -int asn1_GetSequence(ASN1_const_CTX *c, size_t *length); -void asn1_add_error(const unsigned char *address, int offset); +int asn1_GetSequence(ASN1_const_CTX *c, long *length); +void asn1_add_error(const unsigned char *address,int offset); #ifdef __cplusplus } #endif diff --git a/crypto/asn1/asn1_par.c b/crypto/asn1/asn1_par.c index def7bcf2f1..c322dec2b2 100644 --- a/crypto/asn1/asn1_par.c +++ b/crypto/asn1/asn1_par.c @@ -63,11 +63,11 @@ #include static int asn1_print_info(BIO *bp, int tag, int xclass,int constructed, - int indent); -static int asn1_parse2(BIO *bp, const unsigned char **pp, size_t length, - int offset, int depth, int indent, int dump); + int indent); +static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, + int offset, int depth, int indent, int dump); static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, - int indent) + int indent) { static const char fmt[]="%-18s"; char str[128]; @@ -99,22 +99,21 @@ err: return(0); } -int ASN1_parse(BIO *bp, const unsigned char *pp, size_t len, int indent) +int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent) { return(asn1_parse2(bp,&pp,len,0,0,indent,0)); } -int ASN1_parse_dump(BIO *bp, const unsigned char *pp, size_t len, int indent, - int dump) +int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, int dump) { return(asn1_parse2(bp,&pp,len,0,0,indent,dump)); } -static int asn1_parse2(BIO *bp, const unsigned char **pp, size_t length, - int offset, int depth, int indent, int dump) +static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offset, + int depth, int indent, int dump) { const unsigned char *p,*ep,*tot,*op,*opp; - size_t len; + long len; int tag,xclass,ret=0; int nl,hl,j,r; ASN1_OBJECT *o=NULL; @@ -153,13 +152,13 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, size_t length, if (j != (V_ASN1_CONSTRUCTED | 1)) { if (BIO_printf(bp,"d=%-2d hl=%ld l=%4ld ", - depth,(long)hl,(long)len) <= 0) + depth,(long)hl,len) <= 0) goto end; } else { if (BIO_printf(bp,"d=%-2d hl=%ld l=inf ", - depth,(long)hl) <= 0) + depth,(long)hl) <= 0) goto end; } if (!asn1_print_info(bp,tag,xclass,j,(indent)?depth:0)) @@ -171,8 +170,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, size_t length, if (len > length) { BIO_printf(bp, - "length is greater than %ld\n", - (long)length); + "length is greater than %ld\n",length); ret=0; goto end; } diff --git a/crypto/asn1/asn1t.h b/crypto/asn1/asn1t.h index 213a86375f..d230e4bf70 100644 --- a/crypto/asn1/asn1t.h +++ b/crypto/asn1/asn1t.h @@ -856,7 +856,7 @@ typedef struct ASN1_STREAM_ARG_st { IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \ - stname *d2i_##fname(stname **a, const unsigned char **in, size_t len) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ { \ return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ } \ @@ -875,7 +875,7 @@ typedef struct ASN1_STREAM_ARG_st { * ASN1 constification is done. */ #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ - stname *d2i_##fname(stname **a, const unsigned char **in, size_t len) \ + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ { \ return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ } \ diff --git a/crypto/asn1/asn_pack.c b/crypto/asn1/asn_pack.c index e39edba142..a57511e207 100644 --- a/crypto/asn1/asn_pack.c +++ b/crypto/asn1/asn_pack.c @@ -66,7 +66,7 @@ /* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */ -STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, size_t len, +STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len, d2i_of_void *d2i, void (*free_func)(BLOCK)) { STACK_OF(BLOCK) *sk; @@ -83,7 +83,7 @@ STACK_OF(BLOCK) *ASN1_seq_unpack(const unsigned char *buf, size_t len, */ unsigned char *ASN1_seq_pack(STACK_OF(BLOCK) *safes, i2d_of_void *i2d, - unsigned char **buf, size_t *len) + unsigned char **buf, int *len) { int safelen; unsigned char *safe, *p; diff --git a/crypto/asn1/d2i_pr.c b/crypto/asn1/d2i_pr.c index 3ee6c38f88..2828944777 100644 --- a/crypto/asn1/d2i_pr.c +++ b/crypto/asn1/d2i_pr.c @@ -128,7 +128,7 @@ err: /* This works like d2i_PrivateKey() except it automatically works out the type */ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, - size_t length) + long length) { STACK_OF(ASN1_TYPE) *inkey; const unsigned char *p; diff --git a/crypto/asn1/d2i_pu.c b/crypto/asn1/d2i_pu.c index d2567d1737..3694f51a8c 100644 --- a/crypto/asn1/d2i_pu.c +++ b/crypto/asn1/d2i_pu.c @@ -73,7 +73,7 @@ #endif EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, - size_t length) + long length) { EVP_PKEY *ret; diff --git a/crypto/asn1/evp_asn1.c b/crypto/asn1/evp_asn1.c index 8878ec3ec6..f3d9804860 100644 --- a/crypto/asn1/evp_asn1.c +++ b/crypto/asn1/evp_asn1.c @@ -61,7 +61,7 @@ #include #include -int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, size_t len) +int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len) { ASN1_STRING *os; @@ -73,7 +73,7 @@ int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, size_t len) /* int max_len: for returned value */ int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, - size_t max_len) + int max_len) { int ret,num; unsigned char *p; @@ -94,7 +94,7 @@ int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, } int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, - size_t len) + int len) { int n,size; ASN1_OCTET_STRING os,*osp; @@ -136,13 +136,13 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, * case, set it to zero */ /* int max_len: for returned value */ int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data, - size_t max_len) + int max_len) { int ret= -1,n; ASN1_INTEGER *ai=NULL; ASN1_OCTET_STRING *os=NULL; const unsigned char *p; - size_t length; + long length; ASN1_const_CTX c; if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL)) diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c index 302004bcab..6bab6d4a6f 100644 --- a/crypto/asn1/tasn_dec.c +++ b/crypto/asn1/tasn_dec.c @@ -126,8 +126,7 @@ unsigned long ASN1_tag2bit(int tag) */ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, - const unsigned char **in, size_t len, - const ASN1_ITEM *it) + const unsigned char **in, long len, const ASN1_ITEM *it) { ASN1_TLC c; ASN1_VALUE *ptmpval = NULL; @@ -1244,7 +1243,7 @@ static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, { int i; int ptag, pclass; - size_t plen; + long plen; const unsigned char *p, *q; p = *in; q = p; diff --git a/crypto/asn1/x_pkey.c b/crypto/asn1/x_pkey.c index 62ecf0bc5e..8453618426 100644 --- a/crypto/asn1/x_pkey.c +++ b/crypto/asn1/x_pkey.c @@ -69,7 +69,7 @@ int i2d_X509_PKEY(X509_PKEY *a, unsigned char **pp) return(0); } -X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, size_t length) +X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, long length) { int i; M_ASN1_D2I_vars(a,X509_PKEY *,X509_PKEY_new); diff --git a/crypto/asn1/x_pubkey.c b/crypto/asn1/x_pubkey.c index b087ee0132..d42b6a2c54 100644 --- a/crypto/asn1/x_pubkey.c +++ b/crypto/asn1/x_pubkey.c @@ -187,7 +187,7 @@ EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) */ EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, - size_t length) + long length) { X509_PUBKEY *xpk; EVP_PKEY *pktmp; @@ -220,7 +220,7 @@ int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp) */ #ifndef OPENSSL_NO_RSA RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, - size_t length) + long length) { EVP_PKEY *pkey; RSA *key; @@ -260,7 +260,7 @@ int i2d_RSA_PUBKEY(RSA *a, unsigned char **pp) #ifndef OPENSSL_NO_DSA DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, - size_t length) + long length) { EVP_PKEY *pkey; DSA *key; @@ -299,7 +299,7 @@ int i2d_DSA_PUBKEY(DSA *a, unsigned char **pp) #endif #ifndef OPENSSL_NO_EC -EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, size_t length) +EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length) { EVP_PKEY *pkey; EC_KEY *key; diff --git a/crypto/bf/bf_skey.c b/crypto/bf/bf_skey.c index d091a1ac8d..3673cdee6e 100644 --- a/crypto/bf/bf_skey.c +++ b/crypto/bf/bf_skey.c @@ -62,7 +62,7 @@ #include "bf_locl.h" #include "bf_pi.h" -void BF_set_key(BF_KEY *key, size_t len, const unsigned char *data) +void BF_set_key(BF_KEY *key, int len, const unsigned char *data) { int i; BF_LONG *p,ri,in[2]; diff --git a/crypto/bf/blowfish.h b/crypto/bf/blowfish.h index 02db3244b2..b97e76f9a3 100644 --- a/crypto/bf/blowfish.h +++ b/crypto/bf/blowfish.h @@ -60,7 +60,6 @@ #define HEADER_BLOWFISH_H #include -#include #ifdef __cplusplus extern "C" { @@ -106,7 +105,7 @@ typedef struct bf_key_st } BF_KEY; -void BF_set_key(BF_KEY *key, size_t len, const unsigned char *data); +void BF_set_key(BF_KEY *key, int len, const unsigned char *data); void BF_encrypt(BF_LONG *data,const BF_KEY *key); void BF_decrypt(BF_LONG *data,const BF_KEY *key); diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h index 299dadfb3f..ea5323d20f 100644 --- a/crypto/bio/bio.h +++ b/crypto/bio/bio.h @@ -252,11 +252,9 @@ void BIO_clear_flags(BIO *b, int flags); #define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) #define BIO_cb_post(a) ((a)&BIO_CB_RETURN) -long (*BIO_get_callback(const BIO *b)) (struct bio_st *, int, const char *, - size_t, long, long); -void BIO_set_callback(BIO *b, long (*callback)(struct bio_st *, int, - const char *, size_t, long, - long)); +long (*BIO_get_callback(const BIO *b)) (struct bio_st *,int,const char *,int, long,long); +void BIO_set_callback(BIO *b, + long (*callback)(struct bio_st *,int,const char *,int, long,long)); char *BIO_get_callback_arg(const BIO *b); void BIO_set_callback_arg(BIO *b, char *arg); @@ -283,7 +281,7 @@ struct bio_st { BIO_METHOD *method; /* bio, mode, argp, argi, argl, ret */ - long (*callback)(struct bio_st *,int,const char *,size_t, long,long); + long (*callback)(struct bio_st *,int,const char *,int, long,long); char *cb_arg; /* first argument for the callback */ int init; @@ -573,7 +571,7 @@ int BIO_free(BIO *a); void BIO_vfree(BIO *a); int BIO_read(BIO *b, void *data, int len); int BIO_gets(BIO *bp,char *buf, int size); -int BIO_write(BIO *b, const void *data, size_t len); +int BIO_write(BIO *b, const void *data, int len); int BIO_puts(BIO *bp,const char *buf); int BIO_indent(BIO *b,int indent,int max); long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); @@ -594,8 +592,8 @@ int BIO_nread(BIO *bio, char **buf, int num); int BIO_nwrite0(BIO *bio, char **buf); int BIO_nwrite(BIO *bio, char **buf, int num); -long BIO_debug_callback(BIO *bio, int cmd, const char *argp, size_t argi, - long argl, long ret); +long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, + long argl,long ret); BIO_METHOD *BIO_s_mem(void); BIO *BIO_new_mem_buf(void *buf, int len); diff --git a/crypto/bio/bio_cb.c b/crypto/bio/bio_cb.c index 5d310dd1c7..9bcbc321d9 100644 --- a/crypto/bio/bio_cb.c +++ b/crypto/bio/bio_cb.c @@ -64,7 +64,7 @@ #include long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp, - size_t argi, long argl, long ret) + int argi, long argl, long ret) { BIO *b; MS_STATIC char buf[256]; diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index ea7f22a8ce..3f52ae953c 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -156,14 +156,12 @@ void BIO_set_flags(BIO *b, int flags) b->flags |= flags; } -long (*BIO_get_callback(const BIO *b))(struct bio_st *, int, const char *, - size_t, long, long) +long (*BIO_get_callback(const BIO *b))(struct bio_st *,int,const char *,int, long,long) { return b->callback; } -void BIO_set_callback(BIO *b, long (*cb)(struct bio_st *, int, const char *, - size_t, long, long)) +void BIO_set_callback(BIO *b, long (*cb)(struct bio_st *,int,const char *,int, long,long)) { b->callback = cb; } @@ -192,7 +190,7 @@ int BIO_method_type(const BIO *b) int BIO_read(BIO *b, void *out, int outl) { int i; - long (*cb)(BIO *, int, const char *, size_t, long, long); + long (*cb)(BIO *,int,const char *,int,long,long); if ((b == NULL) || (b->method == NULL) || (b->method->bread == NULL)) { @@ -221,10 +219,10 @@ int BIO_read(BIO *b, void *out, int outl) return(i); } -int BIO_write(BIO *b, const void *in, size_t inl) +int BIO_write(BIO *b, const void *in, int inl) { int i; - long (*cb)(BIO *,int,const char *,size_t,long,long); + long (*cb)(BIO *,int,const char *,int,long,long); if (b == NULL) return(0); @@ -237,7 +235,7 @@ int BIO_write(BIO *b, const void *in, size_t inl) } if ((cb != NULL) && - ((i=cb(b,BIO_CB_WRITE,in,inl,0L,1L)) <= 0)) + ((i=(int)cb(b,BIO_CB_WRITE,in,inl,0L,1L)) <= 0)) return(i); if (!b->init) @@ -259,7 +257,7 @@ int BIO_write(BIO *b, const void *in, size_t inl) int BIO_puts(BIO *b, const char *in) { int i; - long (*cb)(BIO *, int, const char *, size_t, long, long); + long (*cb)(BIO *,int,const char *,int,long,long); if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { @@ -292,7 +290,7 @@ int BIO_puts(BIO *b, const char *in) int BIO_gets(BIO *b, char *in, int inl) { int i; - long (*cb)(BIO *, int, const char *, size_t, long, long); + long (*cb)(BIO *,int,const char *,int,long,long); if ((b == NULL) || (b->method == NULL) || (b->method->bgets == NULL)) { @@ -353,7 +351,7 @@ char *BIO_ptr_ctrl(BIO *b, int cmd, long larg) long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) { long ret; - long (*cb)(BIO *, int, const char *, size_t, long, long); + long (*cb)(BIO *,int,const char *,int,long,long); if (b == NULL) return(0); @@ -380,7 +378,7 @@ long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)) { long ret; - long (*cb)(BIO *, int, const char *, size_t, long, long); + long (*cb)(BIO *,int,const char *,int,long,long); if (b == NULL) return(0); diff --git a/crypto/bn/asm/x86_64-gcc.c b/crypto/bn/asm/x86_64-gcc.c index 9381ccf42a..f13f52dd85 100644 --- a/crypto/bn/asm/x86_64-gcc.c +++ b/crypto/bn/asm/x86_64-gcc.c @@ -1,7 +1,6 @@ #ifdef __SUNPRO_C # include "../bn_asm.c" /* kind of dirty hack for Sun Studio */ #else -#include /* * x86_64 BIGNUM accelerator version 0.1, December 2002. * @@ -176,7 +175,7 @@ BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d) return ret; } -BN_ULONG bn_add_words (BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp, size_t n) +BN_ULONG bn_add_words (BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int n) { BN_ULONG ret=0,i=0; if (n <= 0) return 0; diff --git a/crypto/bn/bn.h b/crypto/bn/bn.h index 971e55053b..e484b7fc11 100644 --- a/crypto/bn/bn.h +++ b/crypto/bn/bn.h @@ -300,9 +300,9 @@ typedef struct bn_gencb_st BN_GENCB; struct bignum_st { BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ - size_t top; /* Index of last used d +1. */ + int top; /* Index of last used d +1. */ /* The next are internal book keeping for bn_expand. */ - size_t dmax; /* Size of the d array. */ + int dmax; /* Size of the d array. */ int neg; /* one if the number is negative */ int flags; }; @@ -414,8 +414,8 @@ void BN_CTX_free(BN_CTX *c); void BN_CTX_start(BN_CTX *ctx); BIGNUM *BN_CTX_get(BN_CTX *ctx); void BN_CTX_end(BN_CTX *ctx); -int BN_rand(BIGNUM *rnd, size_t bits, int top,int bottom); -int BN_pseudo_rand(BIGNUM *rnd, size_t bits, int top,int bottom); +int BN_rand(BIGNUM *rnd, int bits, int top,int bottom); +int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom); int BN_rand_range(BIGNUM *rnd, const BIGNUM *range); int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range); int BN_num_bits(const BIGNUM *a); @@ -425,9 +425,9 @@ void BN_init(BIGNUM *); void BN_clear_free(BIGNUM *a); BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); void BN_swap(BIGNUM *a, BIGNUM *b); -BIGNUM *BN_bin2bn(const unsigned char *s, size_t len, BIGNUM *ret); +BIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret); int BN_bn2bin(const BIGNUM *a, unsigned char *to); -BIGNUM *BN_mpi2bn(const unsigned char *s, size_t len, BIGNUM *ret); +BIGNUM *BN_mpi2bn(const unsigned char *s,int len,BIGNUM *ret); int BN_bn2mpi(const BIGNUM *a, unsigned char *to); int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); @@ -466,8 +466,6 @@ BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); int BN_mul_word(BIGNUM *a, BN_ULONG w); int BN_add_word(BIGNUM *a, BN_ULONG w); -/* Note that this will give an error if w is negative */ -int BN_add_signed_word(BIGNUM *a, BN_LONG w); int BN_sub_word(BIGNUM *a, BN_ULONG w); int BN_set_word(BIGNUM *a, BN_ULONG w); BN_ULONG BN_get_word(const BIGNUM *a); @@ -502,7 +500,7 @@ int BN_print(BIO *fp, const BIGNUM *a); #else int BN_print(void *fp, const BIGNUM *a); #endif -int BN_reciprocal(BIGNUM *r, const BIGNUM *m, size_t len, BN_CTX *ctx); +int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx); int BN_rshift(BIGNUM *r, const BIGNUM *a, int n); int BN_rshift1(BIGNUM *r, const BIGNUM *a); void BN_clear(BIGNUM *a); @@ -666,9 +664,9 @@ const BIGNUM *BN_get0_nist_prime_521(void); #define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\ (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2)) #define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words))) -BIGNUM *bn_expand2(BIGNUM *a, size_t words); +BIGNUM *bn_expand2(BIGNUM *a, int words); #ifndef OPENSSL_NO_DEPRECATED -BIGNUM *bn_dup_expand(const BIGNUM *a, size_t words); /* unused */ +BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ #endif /* Bignum consistency macros @@ -764,15 +762,12 @@ int RAND_pseudo_bytes(unsigned char *buf,int num); bn_pollute(a); \ } -BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, - BN_ULONG w); -BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num, BN_ULONG w); -void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, size_t num); +BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); +BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); +void bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num); BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); -BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, - size_t num); -BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, - size_t num); +BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num); +BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num); /* Primes from RFC 2409 */ BIGNUM *get_rfc2409_prime_768(BIGNUM *bn); @@ -786,7 +781,7 @@ BIGNUM *get_rfc3526_prime_4096(BIGNUM *bn); BIGNUM *get_rfc3526_prime_6144(BIGNUM *bn); BIGNUM *get_rfc3526_prime_8192(BIGNUM *bn); -int BN_bntest_rand(BIGNUM *rnd, size_t bits, int top, int bottom); +int BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom); /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes diff --git a/crypto/bn/bn_add.c b/crypto/bn/bn_add.c index fa27ff77b7..9405163706 100644 --- a/crypto/bn/bn_add.c +++ b/crypto/bn/bn_add.c @@ -104,7 +104,7 @@ int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) /* unsigned add of b to a */ int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) { - size_t max,min,dif; + int max,min,dif; BN_ULONG *ap,*bp,*rp,carry