summaryrefslogtreecommitdiffstats
path: root/crypto/asn1
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2008-11-01 16:40:37 +0000
committerBen Laurie <ben@openssl.org>2008-11-01 16:40:37 +0000
commit5e4430e70df0020f5f1517249851696cb9ac4ad2 (patch)
tree95dcbc73bcd99b725664324db882b4a388d0d4cb /crypto/asn1
parent4d6e1e4f29de455b5e644ea9cae5d5f5a2dbef33 (diff)
More size_tification.
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/a_print.c5
-rw-r--r--crypto/asn1/a_set.c10
-rw-r--r--crypto/asn1/ameth_lib.c4
-rw-r--r--crypto/asn1/asn1.h14
-rw-r--r--crypto/asn1/asn1_lib.c2
-rw-r--r--crypto/asn1/asn1_locl.h10
-rw-r--r--crypto/asn1/asn1_mac.h4
-rw-r--r--crypto/asn1/asn1t.h4
-rw-r--r--crypto/asn1/d2i_pr.c2
-rw-r--r--crypto/asn1/d2i_pu.c2
-rw-r--r--crypto/asn1/evp_asn1.c2
-rw-r--r--crypto/asn1/x_pkey.c2
-rw-r--r--crypto/asn1/x_pubkey.c8
13 files changed, 35 insertions, 34 deletions
diff --git a/crypto/asn1/a_print.c b/crypto/asn1/a_print.c
index 4a20dca85c..b3700b43fb 100644
--- a/crypto/asn1/a_print.c
+++ b/crypto/asn1/a_print.c
@@ -65,11 +65,12 @@ int ASN1_PRINTABLE_type(const unsigned char *s, size_t len)
int c;
int ia5=0;
int t61=0;
+ int ignore_len = 0;
- if (len <= 0) len= -1;
+ if (len == 0) ignore_len = 1;
if (s == NULL) return(V_ASN1_PRINTABLESTRING);
- while ((*s) && (len-- != 0))
+ while (*s && !ignore_len && len-- != 0)
{
c= *(s++);
#ifndef CHARSET_EBCDIC
diff --git a/crypto/asn1/a_set.c b/crypto/asn1/a_set.c
index 02edaad9ae..09e5dc9818 100644
--- a/crypto/asn1/a_set.c
+++ b/crypto/asn1/a_set.c
@@ -65,7 +65,7 @@
typedef struct
{
unsigned char *pbData;
- int cbData;
+ size_t 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) */
-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 i2d_ASN1_SET(STACK_OF(BLOCK) *a, unsigned char **pp,
+ i2d_of_void *i2d, int ex_tag, int ex_class,
+ int is_set)
{
- int ret=0,r;
+ size_t ret=0,r;
int i;
unsigned char *p;
unsigned char *pStart, *pTempMem;
diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c
index 5063191515..3be02c8793 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, int derlen),
+ const unsigned char **pder, size_t 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 f3189cc507..b2dc58a0d7 100644
--- a/crypto/asn1/asn1.h
+++ b/crypto/asn1/asn1.h
@@ -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, long len); \
+ type *d2i_##name(type **a, const unsigned char **in, size_t 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, long len); \
+ type *d2i_##name(type **a, const unsigned char **in, size_t 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 **,long)
+#define D2I_OF(type) type *(*)(type **,const unsigned char **,size_t)
#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 **,long)
+#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,size_t)
#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)
@@ -887,9 +887,9 @@ 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);
-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 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,
void (*free_func)(BLOCK), int ex_tag,
diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c
index 61abef2ffc..0da09a9598 100644
--- a/crypto/asn1/asn1_lib.c
+++ b/crypto/asn1/asn1_lib.c
@@ -315,7 +315,7 @@ int asn1_const_Finish(ASN1_const_CTX *c)
return _asn1_Finish(c);
}
-int asn1_GetSequence(ASN1_const_CTX *c, long *length)
+int asn1_GetSequence(ASN1_const_CTX *c, size_t *length)
{
const unsigned char *q;
diff --git a/crypto/asn1/asn1_locl.h b/crypto/asn1/asn1_locl.h
index 7d10700fe1..c0b72ed003 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, int derlen);
+ const unsigned char **pder, size_t 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, int derlen);
+ const unsigned char **pder, size_t 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 1383924574..a6a8dfc6a1 100644
--- a/crypto/asn1/asn1_mac.h
+++ b/crypto/asn1/asn1_mac.h
@@ -569,8 +569,8 @@ err:\
#define M_ASN1_I2D_finish() *pp=p; \
return(r);
-int asn1_GetSequence(ASN1_const_CTX *c, long *length);
-void asn1_add_error(const unsigned char *address,int offset);
+int asn1_GetSequence(ASN1_const_CTX *c, size_t *length);
+void asn1_add_error(const unsigned char *address, int offset);
#ifdef __cplusplus
}
#endif
diff --git a/crypto/asn1/asn1t.h b/crypto/asn1/asn1t.h
index 835b75a0f2..21b6565f16 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, long len) \
+ stname *d2i_##fname(stname **a, const unsigned char **in, size_t 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, long len) \
+ stname *d2i_##fname(stname **a, const unsigned char **in, size_t len) \
{ \
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
} \
diff --git a/crypto/asn1/d2i_pr.c b/crypto/asn1/d2i_pr.c
index 2828944777..3ee6c38f88 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,
- long length)
+ size_t 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 3694f51a8c..d2567d1737 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,
- long length)
+ size_t length)
{
EVP_PKEY *ret;
diff --git a/crypto/asn1/evp_asn1.c b/crypto/asn1/evp_asn1.c
index b7bb7eb127..8878ec3ec6 100644
--- a/crypto/asn1/evp_asn1.c
+++ b/crypto/asn1/evp_asn1.c
@@ -142,7 +142,7 @@ int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
ASN1_INTEGER *ai=NULL;
ASN1_OCTET_STRING *os=NULL;
const unsigned char *p;
- long length;
+ size_t length;
ASN1_const_CTX c;
if ((a->type != V_ASN1_SEQUENCE) || (a->value.sequence == NULL))
diff --git a/crypto/asn1/x_pkey.c b/crypto/asn1/x_pkey.c
index 8453618426..62ecf0bc5e 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, long length)
+X509_PKEY *d2i_X509_PKEY(X509_PKEY **a, const unsigned char **pp, size_t 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 d42b6a2c54..b087ee0132 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,
- long length)
+ size_t 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,
- long length)
+ size_t 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,
- long length)
+ size_t 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, long length)
+EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, size_t length)
{
EVP_PKEY *pkey;
EC_KEY *key;