X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fasn1%2Fa_int.c;h=ad0d2506f63203679814cd36018f1dc9c4221b91;hb=c58de759c8700de4fbf26eff0053a87f48db6fb2;hp=7691193c514089b4b4078730c1f19c3ce9afd0e3;hpb=4d6e1e4f29de455b5e644ea9cae5d5f5a2dbef33;p=oweals%2Fopenssl.git diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c index 7691193c51..ad0d2506f6 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; + unsigned char *s; + long len; int inf,tag,xclass; int i; @@ -302,13 +302,12 @@ 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; goto err; } - to=s; ret->type=V_ASN1_INTEGER; if(len) { if ((*p == 0) && (len != 1)) @@ -316,7 +315,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; } @@ -387,8 +386,8 @@ long ASN1_INTEGER_get(const ASN1_INTEGER *a) if (a->length > (int)sizeof(long)) { - /* hmm... a bit ugly */ - return(0xffffffffL); + /* hmm... a bit ugly, return all ones */ + return -1; } if (a->data == NULL) return 0; @@ -405,7 +404,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 +422,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);