diff options
author | Ben Laurie <ben@openssl.org> | 2008-11-01 14:37:00 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2008-11-01 14:37:00 +0000 |
commit | 4d6e1e4f29de455b5e644ea9cae5d5f5a2dbef33 (patch) | |
tree | 9b43a103ede688bfb7b006837387dacb02ec3dc5 /crypto/asn1/asn1_lib.c | |
parent | 122396f2dbeda0f25e9af1bb069a324ec793da57 (diff) |
size_tification.
Diffstat (limited to 'crypto/asn1/asn1_lib.c')
-rw-r--r-- | crypto/asn1/asn1_lib.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c index 1bcb44aee2..61abef2ffc 100644 --- a/crypto/asn1/asn1_lib.c +++ b/crypto/asn1/asn1_lib.c @@ -62,7 +62,8 @@ #include <openssl/asn1.h> #include <openssl/asn1_mac.h> -static int asn1_get_length(const unsigned char **pp,int *inf,long *rl,int max); +static int asn1_get_length(const unsigned char **pp, int *inf, size_t *rl, + size_t max); static void asn1_put_length(unsigned char **pp, int length); const char ASN1_version[]="ASN.1" OPENSSL_VERSION_PTEXT; @@ -80,27 +81,29 @@ static int _asn1_check_infinite_end(const unsigned char **p, long len) return(0); } -int ASN1_check_infinite_end(unsigned char **p, long len) +int ASN1_check_infinite_end(unsigned char **p, size_t len) { return _asn1_check_infinite_end((const unsigned char **)p, len); } -int ASN1_const_check_infinite_end(const unsigned char **p, long len) +int ASN1_const_check_infinite_end(const unsigned char **p, size_t len) { return _asn1_check_infinite_end(p, len); } -int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, - int *pclass, long omax) +int ASN1_get_object(const unsigned char **pp, size_t *plength, int *ptag, + int *pclass, size_t omax) { int i,ret; long l; const unsigned char *p= *pp; int tag,xclass,inf; - long max=omax; + size_t max=omax; + + if (!max) + goto err; - if (!max) goto err; ret=(*p&V_ASN1_CONSTRUCTED); xclass=(*p&V_ASN1_PRIVATE); i= *p&V_ASN1_PRIMITIVE_TAG; @@ -151,7 +154,8 @@ err: return(0x80); } -static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max) +static int asn1_get_length(const unsigned char **pp, int *inf, size_t *rl, + size_t max) { const unsigned char *p= *pp; unsigned long ret=0; @@ -192,8 +196,8 @@ static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max /* class 0 is constructed * constructed == 2 for indefinite length constructed */ -void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag, - int xclass) +void ASN1_put_object(unsigned char **pp, int constructed, size_t length, + int tag, int xclass) { unsigned char *p= *pp; int i, ttag; @@ -254,7 +258,7 @@ static void asn1_put_length(unsigned char **pp, int length) *pp=p; } -int ASN1_object_size(int constructed, int length, int tag) +size_t ASN1_object_size(int constructed, size_t length, int tag) { int ret; @@ -367,7 +371,7 @@ ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str) return ret; } -int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) +int ASN1_STRING_set(ASN1_STRING *str, const void *_data, size_t len) { unsigned char *c; const char *data=_data; @@ -404,7 +408,7 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) return(1); } -void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) +void ASN1_STRING_set0(ASN1_STRING *str, void *data, size_t len) { if (str->data) OPENSSL_free(str->data); @@ -469,14 +473,14 @@ void asn1_add_error(const unsigned char *address, int offset) ERR_add_error_data(4,"address=",buf1," offset=",buf2); } -int ASN1_STRING_length(const ASN1_STRING *x) -{ return M_ASN1_STRING_length(x); } +size_t ASN1_STRING_length(const ASN1_STRING *x) + { return M_ASN1_STRING_length(x); } -void ASN1_STRING_length_set(ASN1_STRING *x, int len) -{ M_ASN1_STRING_length_set(x, len); return; } +void ASN1_STRING_length_set(ASN1_STRING *x, size_t 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); } |