summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/s_apps.h9
-rw-r--r--apps/s_cb.c2
-rw-r--r--apps/s_socket.c4
-rw-r--r--crypto/asn1/a_bitstr.c28
-rw-r--r--crypto/asn1/a_bool.c4
-rw-r--r--crypto/asn1/a_bytes.c8
-rw-r--r--crypto/asn1/a_int.c18
-rw-r--r--crypto/asn1/a_mbstr.c14
-rw-r--r--crypto/asn1/a_object.c33
-rw-r--r--crypto/asn1/a_octet.c12
-rw-r--r--crypto/asn1/a_print.c2
-rw-r--r--crypto/asn1/a_set.c2
-rw-r--r--crypto/asn1/a_strnid.c2
-rw-r--r--crypto/asn1/a_time.c5
-rw-r--r--crypto/asn1/a_utf8.c4
-rw-r--r--crypto/asn1/asn1.h119
-rw-r--r--crypto/asn1/asn1_gen.c2
-rw-r--r--crypto/asn1/asn1_lib.c42
-rw-r--r--crypto/asn1/asn1_mac.h2
-rw-r--r--crypto/asn1/asn1_par.c26
-rw-r--r--crypto/asn1/asn_pack.c4
-rw-r--r--crypto/asn1/evp_asn1.c8
-rw-r--r--crypto/asn1/tasn_dec.c5
-rw-r--r--crypto/bio/bio.h16
-rw-r--r--crypto/bio/bio_cb.c2
-rw-r--r--crypto/bio/bio_lib.c22
-rw-r--r--crypto/bn/asm/x86_64-gcc.c2
-rw-r--r--crypto/bn/bn.h35
-rw-r--r--crypto/bn/bn_add.c6
-rw-r--r--crypto/bn/bn_div.c13
-rw-r--r--crypto/bn/bn_exp.c13
-rw-r--r--crypto/bn/bn_lcl.h28
-rw-r--r--crypto/bn/bn_lib.c12
-rw-r--r--crypto/bn/bn_mpi.c2
-rw-r--r--crypto/bn/bn_mul.c24
-rw-r--r--crypto/bn/bn_nist.c5
-rw-r--r--crypto/bn/bn_print.c4
-rw-r--r--crypto/bn/bn_rand.c9
-rw-r--r--crypto/bn/bn_recp.c2
-rw-r--r--crypto/bn/bn_word.c7
-rw-r--r--crypto/crypto.h32
-rw-r--r--crypto/mem.c26
-rw-r--r--crypto/mem_dbg.c10
-rw-r--r--crypto/objects/o_names.c4
-rw-r--r--crypto/objects/obj_dat.c20
-rw-r--r--crypto/objects/objects.h3
46 files changed, 355 insertions, 297 deletions
diff --git a/apps/s_apps.h b/apps/s_apps.h
index 08fbbc2229..a46d77b6d8 100644
--- a/apps/s_apps.h
+++ b/apps/s_apps.h
@@ -148,7 +148,9 @@ 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
@@ -162,11 +164,12 @@ 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,
- int argi, long argl, long ret);
+ size_t 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 dc50ff5d3f..95860d208f 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,
- int argi, long argl, long ret)
+ size_t argi, long argl, long ret)
{
BIO *out;
diff --git a/apps/s_socket.c b/apps/s_socket.c
index b5f9db3062..f884f6d33e 100644
--- a/apps/s_socket.c
+++ b/apps/s_socket.c
@@ -279,7 +279,9 @@ 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 34179960b8..63331b2e1e 100644
--- a/crypto/asn1/a_bitstr.c
+++ b/crypto/asn1/a_bitstr.c
@@ -60,12 +60,13 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
-int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
-{ return M_ASN1_BIT_STRING_set(x, d, len); }
+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 i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
{
- int ret,j,bits,len;
+ int ret,j,bits;
+ size_t len;
unsigned char *p,*d;
if (a == NULL) return(0);
@@ -114,7 +115,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, long len)
+ const unsigned char **pp, size_t len)
{
ASN1_BIT_STRING *ret=NULL;
const unsigned char *p;
@@ -144,13 +145,13 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
if (len-- > 1) /* using one because of the bits left byte */
{
- s=(unsigned char *)OPENSSL_malloc((int)len);
+ s=OPENSSL_malloc(len);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
goto err;
}
- memcpy(s,p,(int)len);
+ memcpy(s,p,len);
s[len-1]&=(0xff<<i);
p+=len;
}
@@ -173,9 +174,10 @@ err:
/* These next 2 functions from Goetz Babin-Ebell <babinebell@trustcenter.de>
*/
-int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
+int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, size_t n, int value)
{
- int w,v,iv;
+ int v,iv;
+ size_t w;
unsigned char *c;
w=n/8;
@@ -192,11 +194,9 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
{
if (!value) return(1); /* Don't need to set */
if (a->data == NULL)
- c=(unsigned char *)OPENSSL_malloc(w+1);
+ c=OPENSSL_malloc(w+1);
else
- c=(unsigned char *)OPENSSL_realloc_clean(a->data,
- a->length,
- w+1);
+ c=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, int n, int value)
return(1);
}
-int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n)
+int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, size_t n)
{
int w,v;
@@ -230,7 +230,7 @@ int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n)
* 'len' is the length of 'flags'.
*/
int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
- unsigned char *flags, int flags_len)
+ unsigned char *flags, size_t 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 331acdf053..bf5c079e92 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, long length)
+int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, size_t length)
{
int ret= -1;
const unsigned char *p;
- long len;
+ size_t len;
int inf,tag,xclass;
int i=0;
diff --git a/crypto/asn1/a_bytes.c b/crypto/asn1/a_bytes.c
index 8d13f9c931..1bf9247d8e 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,
- long length, int type)
+ size_t length, int type)
{
ASN1_STRING *ret=NULL;
const unsigned char *p;
unsigned char *s;
- long len;
+ size_t 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,
- long length, int Ptag, int Pclass)
+ size_t length, int Ptag, int Pclass)
{
ASN1_STRING *ret=NULL;
const unsigned char *p;
unsigned char *s;
- long len;
+ size_t len;
int inf,tag,xclass;
int i=0;
diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c
index c6fd204ae3..7691193c51 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,
- long len)
+ size_t 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=(unsigned char *)OPENSSL_malloc((int)len+1);
+ s=OPENSSL_malloc(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,(int)len);
+ memcpy(s,p,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,
- long length)
+ size_t length)
{
ASN1_INTEGER *ret=NULL;
const unsigned char *p;
unsigned char *to,*s;
- long len;
+ size_t 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=(unsigned char *)OPENSSL_malloc((int)len+1);
+ s=OPENSSL_malloc(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,(int)len);
+ memcpy(s,p,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;
- int len,j;
+ size_t 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+4);
+ unsigned char *new_data=OPENSSL_realloc(ret->data, len+4U);
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 2d4800a22a..cc4b77478c 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, int len,
- int inform, unsigned long mask)
+int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, size_t 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, int len,
- int inform, unsigned long mask,
- long minsize, long maxsize)
+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 str_type;
int ret;
@@ -145,14 +145,14 @@ int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
if((minsize > 0) && (nchar < minsize)) {
ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY, ASN1_R_STRING_TOO_SHORT);
- BIO_snprintf(strbuf, sizeof strbuf, "%ld", minsize);
+ BIO_snprintf(strbuf, sizeof strbuf, "%ld", (long)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", maxsize);
+ BIO_snprintf(strbuf, sizeof strbuf, "%ld", (long)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 f1a5a1e31e..570aac71a7 100644
--- a/crypto/asn1/a_object.c
+++ b/crypto/asn1/a_object.c
@@ -83,11 +83,13 @@ int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp)
return(objsize);
}
-int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
+size_t a2d_ASN1_OBJECT(unsigned char *out, size_t olen, const char *buf,
+ int num)
{
- int i,first,len=0,c, use_bn;
+ int i,len=0,c, use_bn;
+ unsigned first;
char ftmp[24], *tmp = ftmp;
- int tmpsize = sizeof ftmp;
+ size_t tmpsize = sizeof ftmp;
const char *p;
unsigned long l;
BIGNUM *bl = NULL;
@@ -150,11 +152,11 @@ int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num)
if (use_bn)
{
if (!BN_mul_word(bl, 10L)
- || !BN_add_word(bl, c-'0'))
+ || !BN_add_signed_word(bl, c-'0'))
goto err;
}
else
- l=l*10L+(long)(c-'0');
+ l=l*10L+(c-'0');
}
if (len == 0)
{
@@ -227,7 +229,7 @@ err:
return(0);
}
-int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a)
+int i2t_ASN1_OBJECT(char *buf, size_t buf_len, ASN1_OBJECT *a)
{
return OBJ_obj2txt(buf, buf_len, a, 0);
}
@@ -235,7 +237,7 @@ int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a)
int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
{
char buf[80], *p = buf;
- int i;
+ size_t i;
if ((a == NULL) || (a->data == NULL))
return(BIO_write(bp,"NULL",4));
@@ -256,13 +258,14 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
}
ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
- long length)
+ size_t length)
{
const unsigned char *p;
- long len;
+ size_t 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)
@@ -284,7 +287,7 @@ err:
return(NULL);
}
ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
- long len)
+ size_t len)
{
ASN1_OBJECT *ret=NULL;
const unsigned char *p;
@@ -309,15 +312,15 @@ ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
{
ret->length=0;
if (data != NULL) OPENSSL_free(data);
- data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
+ data=OPENSSL_malloc(len ? len : 1);
if (data == NULL)
{ i=ERR_R_MALLOC_FAILURE; goto err; }
ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
}
- memcpy(data,p,(int)len);
+ memcpy(data,p,len);
/* reattach data to object, after which it remains const */
- ret->data =data;
- ret->length=(int)len;
+ ret->data=data;
+ ret->length=len;
ret->sn=NULL;
ret->ln=NULL;
/* ret->flags=ASN1_OBJECT_FLAG_DYNAMIC; we know it is dynamic */
@@ -373,7 +376,7 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a)
OPENSSL_free(a);
}
-ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
+ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, size_t 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 e8725e44f1..edeccddf57 100644
--- a/crypto/asn1/a_octet.c
+++ b/crypto/asn1/a_octet.c
@@ -61,11 +61,13 @@
#include <openssl/asn1.h>
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, int len)
-{ return M_ASN1_OCTET_STRING_set(x, d, len); }
+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); }
diff --git a/crypto/asn1/a_print.c b/crypto/asn1/a_print.c
index d18e772320..4a20dca85c 100644
--- a/crypto/asn1/a_print.c
+++ b/crypto/asn1/a_print.c
@@ -60,7 +60,7 @@
#include "cryptlib.h"
#include <openssl/asn1.h>
-int ASN1_PRINTABLE_type(const unsigned char *s, int len)
+int ASN1_PRINTABLE_type(const unsigned char *s, size_t len)
{
int c;
int ia5=0;
diff --git a/crypto/asn1/a_set.c b/crypto/asn1/a_set.c
index 2405ce1ec2..02edaad9ae 100644
--- a/crypto/asn1/a_set.c
+++ b/crypto/asn1/a_set.c
@@ -164,7 +164,7 @@ SetBlob
}
STACK_OF(BLOCK) *d2i_ASN1_SET(STACK_OF(BLOCK) **a, const unsigned char **pp,
- long length, d2i_of_void *d2i,
+ size_t 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 cdba943737..ac1a85fb43 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,
- int inlen, int inform, int nid)
+ size_t 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 577e263402..0d618873c7 100644
--- a/crypto/asn1/a_time.c
+++ b/crypto/asn1/a_time.c
@@ -135,11 +135,12 @@ 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;
- int newlen;
+ size_t newlen;
if (!ASN1_TIME_check(t)) return NULL;
diff --git a/crypto/asn1/a_utf8.c b/crypto/asn1/a_utf8.c
index 508e11e527..c677c99a52 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, int len, unsigned long *val)
+int UTF8_getc(const unsigned char *str, size_t len, unsigned long *val)
{
const unsigned char *p;
unsigned long value;
@@ -152,7 +152,7 @@ int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
* It will need at most 6 characters.
*/
-int UTF8_putc(unsigned char *str, int len, unsigned long value)
+int UTF8_putc(unsigned char *str, size_t len, unsigned long value)
{
if(!str) len = 6; /* Maximum we will need */
else if(len <= 0) return -1;
diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h
index a08ca334a0..f3189cc507 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' */
- long slen; /* length of last 'get object' */
+ size_t 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' */
- long slen; /* length of last 'get object' */
+ size_t 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;
- int length;
+ size_t 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
{
- int length;
+ size_t 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 */
- long len; /* Length of encoding */
+ size_t len; /* Length of encoding */
int modified; /* set to 1 if 'enc' is invalid */
} ASN1_ENCODING;
@@ -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,
- long length);
+ size_t length);
ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
- long length);
+ size_t length);
DECLARE_ASN1_ITEM(ASN1_OBJECT)
@@ -795,23 +795,24 @@ 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, 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_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_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,
- long length);
+ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
+ const unsigned char **pp, size_t length);
int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
- 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);
+ 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);
#ifndef OPENSSL_NO_BIO
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
@@ -821,15 +822,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,long length);
+int i2d_ASN1_BOOLEAN(int a, unsigned char **pp);
+int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, size_t 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,
- long length);
+ size_t length);
ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
- long length);
+ size_t length);
ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x);
int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
@@ -854,7 +855,8 @@ int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
ASN1_OCTET_STRING * ASN1_OCTET_STR