A general spring-cleaning (in autumn) to fix up signed/unsigned warnings.
I have tried to convert 'len' type variable declarations to unsigned as a means to address these warnings when appropriate, but when in doubt I have used casts in the comparisons instead. The better solution (that would get us all lynched by API users) would be to go through and convert all the function prototypes and structure definitions to use unsigned variables except when signed is necessary. The proliferation of (signed) "int" for strictly non-negative uses is unfortunate.
This commit is contained in:
parent
2ce90b9b74
commit
2754597013
37 changed files with 97 additions and 82 deletions
|
@ -3005,7 +3005,8 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_G
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
|
char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
|
||||||
int reason_code = -1;
|
int reason_code = -1;
|
||||||
int i, ret = 0;
|
int ret = 0;
|
||||||
|
unsigned int i;
|
||||||
ASN1_OBJECT *hold = NULL;
|
ASN1_OBJECT *hold = NULL;
|
||||||
ASN1_GENERALIZEDTIME *comp_time = NULL;
|
ASN1_GENERALIZEDTIME *comp_time = NULL;
|
||||||
tmp = BUF_strdup(str);
|
tmp = BUF_strdup(str);
|
||||||
|
|
|
@ -534,7 +534,7 @@ bad:
|
||||||
if (!nosalt)
|
if (!nosalt)
|
||||||
{
|
{
|
||||||
printf("salt=");
|
printf("salt=");
|
||||||
for (i=0; i<sizeof salt; i++)
|
for (i=0; i<(int)sizeof(salt); i++)
|
||||||
printf("%02X",salt[i]);
|
printf("%02X",salt[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,7 +312,8 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
|
||||||
static char out_buf[6 + 9 + 24 + 2]; /* "$apr1$..salt..$.......md5hash..........\0" */
|
static char out_buf[6 + 9 + 24 + 2]; /* "$apr1$..salt..$.......md5hash..........\0" */
|
||||||
unsigned char buf[MD5_DIGEST_LENGTH];
|
unsigned char buf[MD5_DIGEST_LENGTH];
|
||||||
char *salt_out;
|
char *salt_out;
|
||||||
int n, i;
|
int n;
|
||||||
|
unsigned int i;
|
||||||
EVP_MD_CTX md,md2;
|
EVP_MD_CTX md,md2;
|
||||||
size_t passwd_len, salt_len;
|
size_t passwd_len, salt_len;
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ int MAIN(int argc, char **argv)
|
||||||
int chunk;
|
int chunk;
|
||||||
|
|
||||||
chunk = num;
|
chunk = num;
|
||||||
if (chunk > sizeof buf)
|
if (chunk > (int)sizeof(buf))
|
||||||
chunk = sizeof buf;
|
chunk = sizeof buf;
|
||||||
r = RAND_bytes(buf, chunk);
|
r = RAND_bytes(buf, chunk);
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
|
|
|
@ -67,12 +67,13 @@
|
||||||
|
|
||||||
int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
|
int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
|
||||||
{
|
{
|
||||||
int i,j,k;
|
int j,k;
|
||||||
|
unsigned int i;
|
||||||
unsigned char buf[sizeof(long)+1];
|
unsigned char buf[sizeof(long)+1];
|
||||||
long d;
|
long d;
|
||||||
|
|
||||||
a->type=V_ASN1_ENUMERATED;
|
a->type=V_ASN1_ENUMERATED;
|
||||||
if (a->length < (sizeof(long)+1))
|
if (a->length < (int)(sizeof(long)+1))
|
||||||
{
|
{
|
||||||
if (a->data != NULL)
|
if (a->data != NULL)
|
||||||
OPENSSL_free(a->data);
|
OPENSSL_free(a->data);
|
||||||
|
@ -116,7 +117,7 @@ long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a)
|
||||||
else if (i != V_ASN1_ENUMERATED)
|
else if (i != V_ASN1_ENUMERATED)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (a->length > sizeof(long))
|
if (a->length > (int)sizeof(long))
|
||||||
{
|
{
|
||||||
/* hmm... a bit ugly */
|
/* hmm... a bit ugly */
|
||||||
return(0xffffffffL);
|
return(0xffffffffL);
|
||||||
|
|
|
@ -313,12 +313,13 @@ err:
|
||||||
|
|
||||||
int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
|
int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
|
||||||
{
|
{
|
||||||
int i,j,k;
|
int j,k;
|
||||||
|
unsigned int i;
|
||||||
unsigned char buf[sizeof(long)+1];
|
unsigned char buf[sizeof(long)+1];
|
||||||
long d;
|
long d;
|
||||||
|
|
||||||
a->type=V_ASN1_INTEGER;
|
a->type=V_ASN1_INTEGER;
|
||||||
if (a->length < (sizeof(long)+1))
|
if (a->length < (int)(sizeof(long)+1))
|
||||||
{
|
{
|
||||||
if (a->data != NULL)
|
if (a->data != NULL)
|
||||||
OPENSSL_free(a->data);
|
OPENSSL_free(a->data);
|
||||||
|
@ -362,7 +363,7 @@ long ASN1_INTEGER_get(ASN1_INTEGER *a)
|
||||||
else if (i != V_ASN1_INTEGER)
|
else if (i != V_ASN1_INTEGER)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (a->length > sizeof(long))
|
if (a->length > (int)sizeof(long))
|
||||||
{
|
{
|
||||||
/* hmm... a bit ugly */
|
/* hmm... a bit ugly */
|
||||||
return(0xffffffffL);
|
return(0xffffffffL);
|
||||||
|
|
|
@ -184,7 +184,7 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
|
||||||
if ((a == NULL) || (a->data == NULL))
|
if ((a == NULL) || (a->data == NULL))
|
||||||
return(BIO_write(bp,"NULL",4));
|
return(BIO_write(bp,"NULL",4));
|
||||||
i=i2t_ASN1_OBJECT(buf,sizeof buf,a);
|
i=i2t_ASN1_OBJECT(buf,sizeof buf,a);
|
||||||
if (i > sizeof buf) i=sizeof buf;
|
if (i > (int)sizeof(buf)) i=sizeof buf;
|
||||||
BIO_write(bp,buf,i);
|
BIO_write(bp,buf,i);
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,7 +544,7 @@ static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_cons
|
||||||
|
|
||||||
static int asn1_str2tag(const char *tagstr, int len)
|
static int asn1_str2tag(const char *tagstr, int len)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
static struct tag_name_st *tntmp, tnst [] = {
|
static struct tag_name_st *tntmp, tnst [] = {
|
||||||
ASN1_GEN_STR("BOOL", V_ASN1_BOOLEAN),
|
ASN1_GEN_STR("BOOL", V_ASN1_BOOLEAN),
|
||||||
ASN1_GEN_STR("BOOLEAN", V_ASN1_BOOLEAN),
|
ASN1_GEN_STR("BOOLEAN", V_ASN1_BOOLEAN),
|
||||||
|
|
|
@ -145,7 +145,7 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
|
||||||
{
|
{
|
||||||
unsigned char *p= *pp;
|
unsigned char *p= *pp;
|
||||||
unsigned long ret=0;
|
unsigned long ret=0;
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (max-- < 1) return(0);
|
if (max-- < 1) return(0);
|
||||||
if (*p == 0x80)
|
if (*p == 0x80)
|
||||||
|
|
|
@ -136,7 +136,7 @@ static int long_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype,
|
||||||
int neg, i;
|
int neg, i;
|
||||||
long ltmp;
|
long ltmp;
|
||||||
unsigned long utmp = 0;
|
unsigned long utmp = 0;
|
||||||
if(len > sizeof(long)) {
|
if(len > (int)sizeof(long)) {
|
||||||
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
|
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,28 +91,28 @@ void BN_set_params(int mult, int high, int low, int mont)
|
||||||
{
|
{
|
||||||
if (mult >= 0)
|
if (mult >= 0)
|
||||||
{
|
{
|
||||||
if (mult > (sizeof(int)*8)-1)
|
if (mult > (int)(sizeof(int)*8)-1)
|
||||||
mult=sizeof(int)*8-1;
|
mult=sizeof(int)*8-1;
|
||||||
bn_limit_bits=mult;
|
bn_limit_bits=mult;
|
||||||
bn_limit_num=1<<mult;
|
bn_limit_num=1<<mult;
|
||||||
}
|
}
|
||||||
if (high >= 0)
|
if (high >= 0)
|
||||||
{
|
{
|
||||||
if (high > (sizeof(int)*8)-1)
|
if (high > (int)(sizeof(int)*8)-1)
|
||||||
high=sizeof(int)*8-1;
|
high=sizeof(int)*8-1;
|
||||||
bn_limit_bits_high=high;
|
bn_limit_bits_high=high;
|
||||||
bn_limit_num_high=1<<high;
|
bn_limit_num_high=1<<high;
|
||||||
}
|
}
|
||||||
if (low >= 0)
|
if (low >= 0)
|
||||||
{
|
{
|
||||||
if (low > (sizeof(int)*8)-1)
|
if (low > (int)(sizeof(int)*8)-1)
|
||||||
low=sizeof(int)*8-1;
|
low=sizeof(int)*8-1;
|
||||||
bn_limit_bits_low=low;
|
bn_limit_bits_low=low;
|
||||||
bn_limit_num_low=1<<low;
|
bn_limit_num_low=1<<low;
|
||||||
}
|
}
|
||||||
if (mont >= 0)
|
if (mont >= 0)
|
||||||
{
|
{
|
||||||
if (mont > (sizeof(int)*8)-1)
|
if (mont > (int)(sizeof(int)*8)-1)
|
||||||
mont=sizeof(int)*8-1;
|
mont=sizeof(int)*8-1;
|
||||||
bn_limit_bits_mont=mont;
|
bn_limit_bits_mont=mont;
|
||||||
bn_limit_num_mont=1<<mont;
|
bn_limit_num_mont=1<<mont;
|
||||||
|
@ -610,7 +610,7 @@ BN_ULONG BN_get_word(const BIGNUM *a)
|
||||||
BN_ULONG ret=0;
|
BN_ULONG ret=0;
|
||||||
|
|
||||||
n=BN_num_bytes(a);
|
n=BN_num_bytes(a);
|
||||||
if (n > sizeof(BN_ULONG))
|
if (n > (int)sizeof(BN_ULONG))
|
||||||
return(BN_MASK2);
|
return(BN_MASK2);
|
||||||
for (i=a->top-1; i>=0; i--)
|
for (i=a->top-1; i>=0; i--)
|
||||||
{
|
{
|
||||||
|
@ -628,7 +628,7 @@ BN_ULONG BN_get_word(const BIGNUM *a)
|
||||||
int BN_set_word(BIGNUM *a, BN_ULONG w)
|
int BN_set_word(BIGNUM *a, BN_ULONG w)
|
||||||
{
|
{
|
||||||
int i,n;
|
int i,n;
|
||||||
if (bn_expand(a,sizeof(BN_ULONG)*8) == NULL) return(0);
|
if (bn_expand(a,(int)sizeof(BN_ULONG)*8) == NULL) return(0);
|
||||||
|
|
||||||
n=sizeof(BN_ULONG)/BN_BYTES;
|
n=sizeof(BN_ULONG)/BN_BYTES;
|
||||||
a->neg=0;
|
a->neg=0;
|
||||||
|
|
|
@ -333,7 +333,8 @@ static int cfb64_test(unsigned char *cfb_cipher);
|
||||||
static int ede_cfb64_test(unsigned char *cfb_cipher);
|
static int ede_cfb64_test(unsigned char *cfb_cipher);
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i,j,err=0;
|
int j,err=0;
|
||||||
|
unsigned int i;
|
||||||
des_cblock in,out,outin,iv3,iv2;
|
des_cblock in,out,outin,iv3,iv2;
|
||||||
des_key_schedule ks,ks2,ks3;
|
des_key_schedule ks,ks2,ks3;
|
||||||
unsigned char cbc_in[40];
|
unsigned char cbc_in[40];
|
||||||
|
@ -391,7 +392,7 @@ int main(int argc, char *argv[])
|
||||||
DES_ede3_cbcm_encrypt(cbc_out,cbc_in,i,&ks,&ks2,&ks3,&iv3,&iv2,DES_DECRYPT);
|
DES_ede3_cbcm_encrypt(cbc_out,cbc_in,i,&ks,&ks2,&ks3,&iv3,&iv2,DES_DECRYPT);
|
||||||
if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
|
if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
|
||||||
{
|
{
|
||||||
int n;
|
unsigned int n;
|
||||||
|
|
||||||
printf("des_ede3_cbcm_encrypt decrypt error\n");
|
printf("des_ede3_cbcm_encrypt decrypt error\n");
|
||||||
for(n=0 ; n < i ; ++n)
|
for(n=0 ; n < i ; ++n)
|
||||||
|
@ -540,7 +541,7 @@ int main(int argc, char *argv[])
|
||||||
if (memcmp(cbc_out,cbc3_ok,
|
if (memcmp(cbc_out,cbc3_ok,
|
||||||
(unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
|
(unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
|
||||||
{
|
{
|
||||||
int n;
|
unsigned int n;
|
||||||
|
|
||||||
printf("des_ede3_cbc_encrypt encrypt error\n");
|
printf("des_ede3_cbc_encrypt encrypt error\n");
|
||||||
for(n=0 ; n < i ; ++n)
|
for(n=0 ; n < i ; ++n)
|
||||||
|
@ -556,7 +557,7 @@ int main(int argc, char *argv[])
|
||||||
des_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,DES_DECRYPT);
|
des_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,DES_DECRYPT);
|
||||||
if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
|
if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
|
||||||
{
|
{
|
||||||
int n;
|
unsigned int n;
|
||||||
|
|
||||||
printf("des_ede3_cbc_encrypt decrypt error\n");
|
printf("des_ede3_cbc_encrypt decrypt error\n");
|
||||||
for(n=0 ; n < i ; ++n)
|
for(n=0 ; n < i ; ++n)
|
||||||
|
|
|
@ -87,7 +87,7 @@ static const unsigned char odd_parity[256]={
|
||||||
|
|
||||||
void DES_set_odd_parity(DES_cblock *key)
|
void DES_set_odd_parity(DES_cblock *key)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=0; i<DES_KEY_SZ; i++)
|
for (i=0; i<DES_KEY_SZ; i++)
|
||||||
(*key)[i]=odd_parity[(*key)[i]];
|
(*key)[i]=odd_parity[(*key)[i]];
|
||||||
|
@ -95,7 +95,7 @@ void DES_set_odd_parity(DES_cblock *key)
|
||||||
|
|
||||||
int DES_check_key_parity(const_DES_cblock *key)
|
int DES_check_key_parity(const_DES_cblock *key)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=0; i<DES_KEY_SZ; i++)
|
for (i=0; i<DES_KEY_SZ; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,7 +165,7 @@ static int b64_read(BIO *b, char *out, int outl)
|
||||||
{
|
{
|
||||||
i=ctx->buf_len-ctx->buf_off;
|
i=ctx->buf_len-ctx->buf_off;
|
||||||
if (i > outl) i=outl;
|
if (i > outl) i=outl;
|
||||||
OPENSSL_assert(ctx->buf_off+i < sizeof ctx->buf);
|
OPENSSL_assert(ctx->buf_off+i < (int)sizeof(ctx->buf));
|
||||||
memcpy(out,&(ctx->buf[ctx->buf_off]),i);
|
memcpy(out,&(ctx->buf[ctx->buf_off]),i);
|
||||||
ret=i;
|
ret=i;
|
||||||
out+=i;
|
out+=i;
|
||||||
|
|
|
@ -168,16 +168,17 @@ static int rc2_magic_to_meth(int i)
|
||||||
static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
|
static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
|
||||||
{
|
{
|
||||||
long num=0;
|
long num=0;
|
||||||
int i=0,l;
|
int i=0;
|
||||||
int key_bits;
|
int key_bits;
|
||||||
|
unsigned int l;
|
||||||
unsigned char iv[EVP_MAX_IV_LENGTH];
|
unsigned char iv[EVP_MAX_IV_LENGTH];
|
||||||
|
|
||||||
if (type != NULL)
|
if (type != NULL)
|
||||||
{
|
{
|
||||||
l=EVP_CIPHER_CTX_iv_length(c);
|
l=EVP_CIPHER_CTX_iv_length(c);
|
||||||
OPENSSL_assert(l <= sizeof iv);
|
OPENSSL_assert(l <= sizeof(iv));
|
||||||
i=ASN1_TYPE_get_int_octetstring(type,&num,iv,l);
|
i=ASN1_TYPE_get_int_octetstring(type,&num,iv,l);
|
||||||
if (i != l)
|
if (i != (int)l)
|
||||||
return(-1);
|
return(-1);
|
||||||
key_bits =rc2_magic_to_meth((int)num);
|
key_bits =rc2_magic_to_meth((int)num);
|
||||||
if (!key_bits)
|
if (!key_bits)
|
||||||
|
|
|
@ -136,7 +136,7 @@ void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
|
||||||
|
|
||||||
*outl=0;
|
*outl=0;
|
||||||
if (inl == 0) return;
|
if (inl == 0) return;
|
||||||
OPENSSL_assert(ctx->length <= sizeof ctx->enc_data);
|
OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data));
|
||||||
if ((ctx->num+inl) < ctx->length)
|
if ((ctx->num+inl) < ctx->length)
|
||||||
{
|
{
|
||||||
memcpy(&(ctx->enc_data[ctx->num]),in,inl);
|
memcpy(&(ctx->enc_data[ctx->num]),in,inl);
|
||||||
|
@ -259,7 +259,7 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
|
||||||
/* only save the good data :-) */
|
/* only save the good data :-) */
|
||||||
if (!B64_NOT_BASE64(v))
|
if (!B64_NOT_BASE64(v))
|
||||||
{
|
{
|
||||||
OPENSSL_assert(n < sizeof ctx->enc_data);
|
OPENSSL_assert(n < (int)sizeof(ctx->enc_data));
|
||||||
d[n++]=tmp;
|
d[n++]=tmp;
|
||||||
ln++;
|
ln++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,8 @@ skip_to_init:
|
||||||
|
|
||||||
case EVP_CIPH_CBC_MODE:
|
case EVP_CIPH_CBC_MODE:
|
||||||
|
|
||||||
OPENSSL_assert(EVP_CIPHER_CTX_iv_length(ctx) <= sizeof ctx->iv);
|
OPENSSL_assert(EVP_CIPHER_CTX_iv_length(ctx) <=
|
||||||
|
(int)sizeof(ctx->iv));
|
||||||
if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
|
if(iv) memcpy(ctx->oiv, iv, EVP_CIPHER_CTX_iv_length(ctx));
|
||||||
memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx));
|
memcpy(ctx->iv, ctx->oiv, EVP_CIPHER_CTX_iv_length(ctx));
|
||||||
break;
|
break;
|
||||||
|
@ -274,7 +275,7 @@ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
|
||||||
}
|
}
|
||||||
i=ctx->buf_len;
|
i=ctx->buf_len;
|
||||||
bl=ctx->cipher->block_size;
|
bl=ctx->cipher->block_size;
|
||||||
OPENSSL_assert(bl <= sizeof ctx->buf);
|
OPENSSL_assert(bl <= (int)sizeof(ctx->buf));
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
if (i+inl < bl)
|
if (i+inl < bl)
|
||||||
|
@ -320,7 +321,8 @@ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
|
||||||
|
|
||||||
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
|
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
|
||||||
{
|
{
|
||||||
int i,n,b,bl,ret;
|
int n,ret;
|
||||||
|
unsigned int i, b, bl;
|
||||||
|
|
||||||
b=ctx->cipher->block_size;
|
b=ctx->cipher->block_size;
|
||||||
OPENSSL_assert(b <= sizeof ctx->buf);
|
OPENSSL_assert(b <= sizeof ctx->buf);
|
||||||
|
@ -356,7 +358,8 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
|
||||||
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
|
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
|
||||||
const unsigned char *in, int inl)
|
const unsigned char *in, int inl)
|
||||||
{
|
{
|
||||||
int b, fix_len;
|
int fix_len;
|
||||||
|
unsigned int b;
|
||||||
|
|
||||||
if (inl == 0)
|
if (inl == 0)
|
||||||
{
|
{
|
||||||
|
@ -409,8 +412,8 @@ int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
|
||||||
|
|
||||||
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
|
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
|
||||||
{
|
{
|
||||||
int i,b;
|
int i,n;
|
||||||
int n;
|
unsigned int b;
|
||||||
|
|
||||||
*outl=0;
|
*outl=0;
|
||||||
b=ctx->cipher->block_size;
|
b=ctx->cipher->block_size;
|
||||||
|
@ -433,7 +436,7 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
|
||||||
}
|
}
|
||||||
OPENSSL_assert(b <= sizeof ctx->final);
|
OPENSSL_assert(b <= sizeof ctx->final);
|
||||||
n=ctx->final[b-1];
|
n=ctx->final[b-1];
|
||||||
if (n > b)
|
if (n > (int)b)
|
||||||
{
|
{
|
||||||
EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT);
|
EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT);
|
||||||
return(0);
|
return(0);
|
||||||
|
|
|
@ -85,14 +85,15 @@ int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
|
||||||
|
|
||||||
int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
|
int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
|
||||||
{
|
{
|
||||||
int i=0,l;
|
int i=0;
|
||||||
|
unsigned int l;
|
||||||
|
|
||||||
if (type != NULL)
|
if (type != NULL)
|
||||||
{
|
{
|
||||||
l=EVP_CIPHER_CTX_iv_length(c);
|
l=EVP_CIPHER_CTX_iv_length(c);
|
||||||
OPENSSL_assert(l <= sizeof c->iv);
|
OPENSSL_assert(l <= sizeof(c->iv));
|
||||||
i=ASN1_TYPE_get_octetstring(type,c->oiv,l);
|
i=ASN1_TYPE_get_octetstring(type,c->oiv,l);
|
||||||
if (i != l)
|
if (i != (int)l)
|
||||||
return(-1);
|
return(-1);
|
||||||
else if (i > 0)
|
else if (i > 0)
|
||||||
memcpy(c->iv,c->oiv,l);
|
memcpy(c->iv,c->oiv,l);
|
||||||
|
@ -102,12 +103,13 @@ int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
|
||||||
|
|
||||||
int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
|
int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
|
||||||
{
|
{
|
||||||
int i=0,j;
|
int i=0;
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
if (type != NULL)
|
if (type != NULL)
|
||||||
{
|
{
|
||||||
j=EVP_CIPHER_CTX_iv_length(c);
|
j=EVP_CIPHER_CTX_iv_length(c);
|
||||||
OPENSSL_assert(j <= sizeof c->iv);
|
OPENSSL_assert(j <= sizeof(c->iv));
|
||||||
i=ASN1_TYPE_set_octetstring(type,c->oiv,j);
|
i=ASN1_TYPE_set_octetstring(type,c->oiv,j);
|
||||||
}
|
}
|
||||||
return(i);
|
return(i);
|
||||||
|
|
|
@ -140,7 +140,7 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *cctx, const char *pass, int passlen,
|
||||||
EVP_DigestFinal_ex (&ctx, md_tmp, NULL);
|
EVP_DigestFinal_ex (&ctx, md_tmp, NULL);
|
||||||
}
|
}
|
||||||
EVP_MD_CTX_cleanup(&ctx);
|
EVP_MD_CTX_cleanup(&ctx);
|
||||||
OPENSSL_assert(EVP_CIPHER_key_length(cipher) <= sizeof md_tmp);
|
OPENSSL_assert(EVP_CIPHER_key_length(cipher) <= (int)sizeof(md_tmp));
|
||||||
memcpy(key, md_tmp, EVP_CIPHER_key_length(cipher));
|
memcpy(key, md_tmp, EVP_CIPHER_key_length(cipher));
|
||||||
OPENSSL_assert(EVP_CIPHER_iv_length(cipher) <= 16);
|
OPENSSL_assert(EVP_CIPHER_iv_length(cipher) <= 16);
|
||||||
memcpy(iv, md_tmp + (16 - EVP_CIPHER_iv_length(cipher)),
|
memcpy(iv, md_tmp + (16 - EVP_CIPHER_iv_length(cipher)),
|
||||||
|
|
|
@ -149,7 +149,8 @@ int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
|
||||||
int en_de)
|
int en_de)
|
||||||
{
|
{
|
||||||
unsigned char *pbuf, *salt, key[EVP_MAX_KEY_LENGTH];
|
unsigned char *pbuf, *salt, key[EVP_MAX_KEY_LENGTH];
|
||||||
int saltlen, keylen, iter, plen;
|
int saltlen, iter, plen;
|
||||||
|
unsigned int keylen;
|
||||||
PBE2PARAM *pbe2 = NULL;
|
PBE2PARAM *pbe2 = NULL;
|
||||||
const EVP_CIPHER *cipher;
|
const EVP_CIPHER *cipher;
|
||||||
PBKDF2PARAM *kdf = NULL;
|
PBKDF2PARAM *kdf = NULL;
|
||||||
|
@ -208,7 +209,7 @@ int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
|
||||||
|
|
||||||
/* Now check the parameters of the kdf */
|
/* Now check the parameters of the kdf */
|
||||||
|
|
||||||
if(kdf->keylength && (ASN1_INTEGER_get(kdf->keylength) != keylen)){
|
if(kdf->keylength && (ASN1_INTEGER_get(kdf->keylength) != (int)keylen)){
|
||||||
EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,
|
EVPerr(EVP_F_PKCS5_V2_PBE_KEYIVGEN,
|
||||||
EVP_R_UNSUPPORTED_KEYLENGTH);
|
EVP_R_UNSUPPORTED_KEYLENGTH);
|
||||||
goto err;
|
goto err;
|
||||||
|
|
|
@ -79,7 +79,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
|
||||||
{
|
{
|
||||||
reset=1;
|
reset=1;
|
||||||
j=EVP_MD_block_size(md);
|
j=EVP_MD_block_size(md);
|
||||||
OPENSSL_assert(j <= sizeof ctx->key);
|
OPENSSL_assert(j <= (int)sizeof(ctx->key));
|
||||||
if (j < len)
|
if (j < len)
|
||||||
{
|
{
|
||||||
EVP_DigestInit_ex(&ctx->md_ctx,md, impl);
|
EVP_DigestInit_ex(&ctx->md_ctx,md, impl);
|
||||||
|
@ -89,7 +89,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OPENSSL_assert(len <= sizeof ctx->key);
|
OPENSSL_assert(len <= (int)sizeof(ctx->key));
|
||||||
memcpy(ctx->key,key,len);
|
memcpy(ctx->key,key,len);
|
||||||
ctx->key_length=len;
|
ctx->key_length=len;
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,7 +336,7 @@ int PEM_ASN1_write_bio(int (*i2d)(), const char *name, BIO *bp, char *x,
|
||||||
kstr=(unsigned char *)buf;
|
kstr=(unsigned char *)buf;
|
||||||
}
|
}
|
||||||
RAND_add(data,i,0);/* put in the RSA key. */
|
RAND_add(data,i,0);/* put in the RSA key. */
|
||||||
OPENSSL_assert(enc->iv_len <= sizeof iv);
|
OPENSSL_assert(enc->iv_len <= (int)sizeof(iv));
|
||||||
if (RAND_pseudo_bytes(iv,enc->iv_len) < 0) /* Generate a salt */
|
if (RAND_pseudo_bytes(iv,enc->iv_len) < 0) /* Generate a salt */
|
||||||
goto err;
|
goto err;
|
||||||
/* The 'iv' is used as the iv and as a salt. It is
|
/* The 'iv' is used as the iv and as a salt. It is
|
||||||
|
|
|
@ -300,7 +300,7 @@ static void ssleay_rand_add(const void *buf, int num, double add)
|
||||||
* other thread's seeding remains without effect (except for
|
* other thread's seeding remains without effect (except for
|
||||||
* the incremented counter). By XORing it we keep at least as
|
* the incremented counter). By XORing it we keep at least as
|
||||||
* much entropy as fits into md. */
|
* much entropy as fits into md. */
|
||||||
for (k = 0; k < sizeof md; k++)
|
for (k = 0; k < (int)sizeof(md); k++)
|
||||||
{
|
{
|
||||||
md[k] ^= local_md[k];
|
md[k] ^= local_md[k];
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,8 @@ int RSA_generate_key_ex(RSA *rsa, int bits, unsigned long e_value, BN_GENCB *cb)
|
||||||
static int rsa_builtin_keygen(RSA *rsa, int bits, unsigned long e_value, BN_GENCB *cb)
|
static int rsa_builtin_keygen(RSA *rsa, int bits, unsigned long e_value, BN_GENCB *cb)
|
||||||
{
|
{
|
||||||
BIGNUM *r0=NULL,*r1=NULL,*r2=NULL,*r3=NULL,*tmp;
|
BIGNUM *r0=NULL,*r1=NULL,*r2=NULL,*r3=NULL,*tmp;
|
||||||
int bitsp,bitsq,ok= -1,n=0,i;
|
int bitsp,bitsq,ok= -1,n=0;
|
||||||
|
unsigned int i;
|
||||||
BN_CTX *ctx=NULL,*ctx2=NULL;
|
BN_CTX *ctx=NULL,*ctx2=NULL;
|
||||||
|
|
||||||
ctx=BN_CTX_new();
|
ctx=BN_CTX_new();
|
||||||
|
|
|
@ -128,7 +128,7 @@ int X509_TRUST_get_count(void)
|
||||||
X509_TRUST * X509_TRUST_get0(int idx)
|
X509_TRUST * X509_TRUST_get0(int idx)
|
||||||
{
|
{
|
||||||
if(idx < 0) return NULL;
|
if(idx < 0) return NULL;
|
||||||
if(idx < X509_TRUST_COUNT) return trstandard + idx;
|
if(idx < (int)X509_TRUST_COUNT) return trstandard + idx;
|
||||||
return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);
|
return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ static void trtable_free(X509_TRUST *p)
|
||||||
|
|
||||||
void X509_TRUST_cleanup(void)
|
void X509_TRUST_cleanup(void)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
for(i = 0; i < X509_TRUST_COUNT; i++) trtable_free(trstandard + i);
|
for(i = 0; i < X509_TRUST_COUNT; i++) trtable_free(trstandard + i);
|
||||||
sk_X509_TRUST_pop_free(trtable, trtable_free);
|
sk_X509_TRUST_pop_free(trtable, trtable_free);
|
||||||
trtable = NULL;
|
trtable = NULL;
|
||||||
|
|
|
@ -140,7 +140,7 @@ int X509_PURPOSE_get_count(void)
|
||||||
X509_PURPOSE * X509_PURPOSE_get0(int idx)
|
X509_PURPOSE * X509_PURPOSE_get0(int idx)
|
||||||
{
|
{
|
||||||
if(idx < 0) return NULL;
|
if(idx < 0) return NULL;
|
||||||
if(idx < X509_PURPOSE_COUNT) return xstandard + idx;
|
if(idx < (int)X509_PURPOSE_COUNT) return xstandard + idx;
|
||||||
return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
|
return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ static void xptable_free(X509_PURPOSE *p)
|
||||||
|
|
||||||
void X509_PURPOSE_cleanup(void)
|
void X509_PURPOSE_cleanup(void)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
sk_X509_PURPOSE_pop_free(xptable, xptable_free);
|
sk_X509_PURPOSE_pop_free(xptable, xptable_free);
|
||||||
for(i = 0; i < X509_PURPOSE_COUNT; i++) xptable_free(xstandard + i);
|
for(i = 0; i < X509_PURPOSE_COUNT; i++) xptable_free(xstandard + i);
|
||||||
xptable = NULL;
|
xptable = NULL;
|
||||||
|
|
|
@ -390,7 +390,7 @@ static EVP_PKEY *ibm_4758_load_privkey(ENGINE* e, const char* key_id,
|
||||||
unsigned char exitData[8];
|
unsigned char exitData[8];
|
||||||
unsigned char ruleArray[8];
|
unsigned char ruleArray[8];
|
||||||
unsigned char keyLabel[64];
|
unsigned char keyLabel[64];
|
||||||
long keyLabelLength = strlen(key_id);
|
unsigned long keyLabelLength = strlen(key_id);
|
||||||
unsigned char modulus[256];
|
unsigned char modulus[256];
|
||||||
long modulusFieldLength = sizeof(modulus);
|
long modulusFieldLength = sizeof(modulus);
|
||||||
long modulusLength = 0;
|
long modulusLength = 0;
|
||||||
|
@ -482,7 +482,7 @@ static EVP_PKEY *ibm_4758_load_pubkey(ENGINE* e, const char* key_id,
|
||||||
unsigned char exitData[8];
|
unsigned char exitData[8];
|
||||||
unsigned char ruleArray[8];
|
unsigned char ruleArray[8];
|
||||||
unsigned char keyLabel[64];
|
unsigned char keyLabel[64];
|
||||||
long keyLabelLength = strlen(key_id);
|
unsigned long keyLabelLength = strlen(key_id);
|
||||||
unsigned char modulus[512];
|
unsigned char modulus[512];
|
||||||
long modulusFieldLength = sizeof(modulus);
|
long modulusFieldLength = sizeof(modulus);
|
||||||
long modulusLength = 0;
|
long modulusLength = 0;
|
||||||
|
@ -922,7 +922,7 @@ static int cca_get_random_bytes(unsigned char* buf, int num)
|
||||||
unsigned char form[] = "RANDOM ";
|
unsigned char form[] = "RANDOM ";
|
||||||
unsigned char rand_buf[8];
|
unsigned char rand_buf[8];
|
||||||
|
|
||||||
while(num >= sizeof(rand_buf))
|
while(num >= (int)sizeof(rand_buf))
|
||||||
{
|
{
|
||||||
randomNumberGenerate(&ret_code, &reason_code, &exit_data_length,
|
randomNumberGenerate(&ret_code, &reason_code, &exit_data_length,
|
||||||
exit_data, form, rand_buf);
|
exit_data, form, rand_buf);
|
||||||
|
|
|
@ -668,7 +668,7 @@ static int client_master_key(SSL *s)
|
||||||
sess->master_key_length=i;
|
sess->master_key_length=i;
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
if (i > sizeof sess->master_key)
|
if (i > (int)sizeof(sess->master_key))
|
||||||
{
|
{
|
||||||
ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR);
|
ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR);
|
||||||
SSLerr(SSL_F_CLIENT_MASTER_KEY, ERR_R_INTERNAL_ERROR);
|
SSLerr(SSL_F_CLIENT_MASTER_KEY, ERR_R_INTERNAL_ERROR);
|
||||||
|
@ -688,7 +688,7 @@ static int client_master_key(SSL *s)
|
||||||
else
|
else
|
||||||
enc=i;
|
enc=i;
|
||||||
|
|
||||||
if (i < enc)
|
if ((int)i < enc)
|
||||||
{
|
{
|
||||||
ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR);
|
ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR);
|
||||||
SSLerr(SSL_F_CLIENT_MASTER_KEY,SSL_R_CIPHER_TABLE_SRC_ERROR);
|
SSLerr(SSL_F_CLIENT_MASTER_KEY,SSL_R_CIPHER_TABLE_SRC_ERROR);
|
||||||
|
@ -717,7 +717,7 @@ static int client_master_key(SSL *s)
|
||||||
d+=enc;
|
d+=enc;
|
||||||
karg=sess->key_arg_length;
|
karg=sess->key_arg_length;
|
||||||
s2n(karg,p); /* key arg size */
|
s2n(karg,p); /* key arg size */
|
||||||
if (karg > sizeof sess->key_arg)
|
if (karg > (int)sizeof(sess->key_arg))
|
||||||
{
|
{
|
||||||
ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR);
|
ssl2_return_error(s,SSL2_PE_UNDEFINED_ERROR);
|
||||||
SSLerr(SSL_F_CLIENT_MASTER_KEY, ERR_R_INTERNAL_ERROR);
|
SSLerr(SSL_F_CLIENT_MASTER_KEY, ERR_R_INTERNAL_ERROR);
|
||||||
|
|
|
@ -101,7 +101,7 @@ int ssl2_enc_init(SSL *s, int client)
|
||||||
if (ssl2_generate_key_material(s) <= 0)
|
if (ssl2_generate_key_material(s) <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
OPENSSL_assert(c->iv_len <= sizeof s->session->key_arg);
|
OPENSSL_assert(c->iv_len <= (int)sizeof(s->session->key_arg));
|
||||||
EVP_EncryptInit_ex(ws,c,NULL,&(s->s2->key_material[(client)?num:0]),
|
EVP_EncryptInit_ex(ws,c,NULL,&(s->s2->key_material[(client)?num:0]),
|
||||||
s->session->key_arg);
|
s->session->key_arg);
|
||||||
EVP_DecryptInit_ex(rs,c,NULL,&(s->s2->key_material[(client)?0:num]),
|
EVP_DecryptInit_ex(rs,c,NULL,&(s->s2->key_material[(client)?0:num]),
|
||||||
|
|
12
ssl/s2_lib.c
12
ssl/s2_lib.c
|
@ -371,7 +371,7 @@ SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p)
|
||||||
static SSL_CIPHER *sorted[SSL2_NUM_CIPHERS];
|
static SSL_CIPHER *sorted[SSL2_NUM_CIPHERS];
|
||||||
SSL_CIPHER c,*cp= &c,**cpp;
|
SSL_CIPHER c,*cp= &c,**cpp;
|
||||||
unsigned long id;
|
unsigned long id;
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (init)
|
if (init)
|
||||||
{
|
{
|
||||||
|
@ -437,7 +437,8 @@ int ssl2_generate_key_material(SSL *s)
|
||||||
EVP_MD_CTX_init(&ctx);
|
EVP_MD_CTX_init(&ctx);
|
||||||
km=s->s2->key_material;
|
km=s->s2->key_material;
|
||||||
|
|
||||||
if (s->session->master_key_length < 0 || s->session->master_key_length > sizeof s->session->master_key)
|
if (s->session->master_key_length < 0 ||
|
||||||
|
s->session->master_key_length > (int)sizeof(s->session->master_key))
|
||||||
{
|
{
|
||||||
SSLerr(SSL_F_SSL2_GENERATE_KEY_MATERIAL, ERR_R_INTERNAL_ERROR);
|
SSLerr(SSL_F_SSL2_GENERATE_KEY_MATERIAL, ERR_R_INTERNAL_ERROR);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -445,7 +446,8 @@ int ssl2_generate_key_material(SSL *s)
|
||||||
|
|
||||||
for (i=0; i<s->s2->key_material_length; i += EVP_MD_size(md5))
|
for (i=0; i<s->s2->key_material_length; i += EVP_MD_size(md5))
|
||||||
{
|
{
|
||||||
if (((km - s->s2->key_material) + EVP_MD_size(md5)) > sizeof s->s2->key_material)
|
if (((km - s->s2->key_material) + EVP_MD_size(md5)) >
|
||||||
|
(int)sizeof(s->s2->key_material))
|
||||||
{
|
{
|
||||||
/* EVP_DigestFinal_ex() below would write beyond buffer */
|
/* EVP_DigestFinal_ex() below would write beyond buffer */
|
||||||
SSLerr(SSL_F_SSL2_GENERATE_KEY_MATERIAL, ERR_R_INTERNAL_ERROR);
|
SSLerr(SSL_F_SSL2_GENERATE_KEY_MATERIAL, ERR_R_INTERNAL_ERROR);
|
||||||
|
@ -456,7 +458,7 @@ int ssl2_generate_key_material(SSL *s)
|
||||||
|
|
||||||
OPENSSL_assert(s->session->master_key_length >= 0
|
OPENSSL_assert(s->session->master_key_length >= 0
|
||||||
&& s->session->master_key_length
|
&& s->session->master_key_length
|
||||||
< sizeof s->session->master_key);
|
< (int)sizeof(s->session->master_key));
|
||||||
EVP_DigestUpdate(&ctx,s->session->master_key,s->session->master_key_length);
|
EVP_DigestUpdate(&ctx,s->session->master_key,s->session->master_key_length);
|
||||||
EVP_DigestUpdate(&ctx,&c,1);
|
EVP_DigestUpdate(&ctx,&c,1);
|
||||||
c++;
|
c++;
|
||||||
|
@ -495,7 +497,7 @@ void ssl2_write_error(SSL *s)
|
||||||
|
|
||||||
error=s->error; /* number of bytes left to write */
|
error=s->error; /* number of bytes left to write */
|
||||||
s->error=0;
|
s->error=0;
|
||||||
OPENSSL_assert(error >= 0 && error <= sizeof buf);
|
OPENSSL_assert(error >= 0 && error <= (int)sizeof(buf));
|
||||||
i=ssl2_write(s,&(buf[3-error]),error);
|
i=ssl2_write(s,&(buf[3-error]),error);
|
||||||
|
|
||||||
/* if (i == error) s->rwstate=state; */
|
/* if (i == error) s->rwstate=state; */
|
||||||
|
|
|
@ -582,7 +582,7 @@ static int ssl3_client_hello(SSL *s)
|
||||||
*(p++)=i;
|
*(p++)=i;
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
if (i > sizeof s->session->session_id)
|
if (i > (int)sizeof(s->session->session_id))
|
||||||
{
|
{
|
||||||
SSLerr(SSL_F_SSL3_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
|
SSLerr(SSL_F_SSL3_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
|
||||||
goto err;
|
goto err;
|
||||||
|
|
|
@ -139,7 +139,7 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
|
||||||
EVP_MD_CTX s1;
|
EVP_MD_CTX s1;
|
||||||
unsigned char buf[16],smd[SHA_DIGEST_LENGTH];
|
unsigned char buf[16],smd[SHA_DIGEST_LENGTH];
|
||||||
unsigned char c='A';
|
unsigned char c='A';
|
||||||
int i,j,k;
|
unsigned int i,j,k;
|
||||||
|
|
||||||
#ifdef CHARSET_EBCDIC
|
#ifdef CHARSET_EBCDIC
|
||||||
c = os_toascii[c]; /*'A' in ASCII */
|
c = os_toascii[c]; /*'A' in ASCII */
|
||||||
|
@ -147,7 +147,7 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
|
||||||
k=0;
|
k=0;
|
||||||
EVP_MD_CTX_init(&m5);
|
EVP_MD_CTX_init(&m5);
|
||||||
EVP_MD_CTX_init(&s1);
|
EVP_MD_CTX_init(&s1);
|
||||||
for (i=0; i<num; i+=MD5_DIGEST_LENGTH)
|
for (i=0; (int)i<num; i+=MD5_DIGEST_LENGTH)
|
||||||
{
|
{
|
||||||
k++;
|
k++;
|
||||||
if (k > sizeof buf)
|
if (k > sizeof buf)
|
||||||
|
@ -172,7 +172,7 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num)
|
||||||
EVP_DigestUpdate(&m5,s->session->master_key,
|
EVP_DigestUpdate(&m5,s->session->master_key,
|
||||||
s->session->master_key_length);
|
s->session->master_key_length);
|
||||||
EVP_DigestUpdate(&m5,smd,SHA_DIGEST_LENGTH);
|
EVP_DigestUpdate(&m5,smd,SHA_DIGEST_LENGTH);
|
||||||
if ((i+MD5_DIGEST_LENGTH) > num)
|
if ((int)(i+MD5_DIGEST_LENGTH) > num)
|
||||||
{
|
{
|
||||||
EVP_DigestFinal_ex(&m5,smd,NULL);
|
EVP_DigestFinal_ex(&m5,smd,NULL);
|
||||||
memcpy(km,smd,(num-i));
|
memcpy(km,smd,(num-i));
|
||||||
|
|
|
@ -1914,7 +1914,7 @@ SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p)
|
||||||
static SSL_CIPHER *sorted[SSL3_NUM_CIPHERS];
|
static SSL_CIPHER *sorted[SSL3_NUM_CIPHERS];
|
||||||
SSL_CIPHER c,*cp= &c,**cpp;
|
SSL_CIPHER c,*cp= &c,**cpp;
|
||||||
unsigned long id;
|
unsigned long id;
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (init)
|
if (init)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1016,7 +1016,7 @@ static int ssl3_send_server_hello(SSL *s)
|
||||||
s->session->session_id_length=0;
|
s->session->session_id_length=0;
|
||||||
|
|
||||||
sl=s->session->session_id_length;
|
sl=s->session->session_id_length;
|
||||||
if (sl > sizeof s->session->session_id)
|
if (sl > (int)sizeof(s->session->session_id))
|
||||||
{
|
{
|
||||||
SSLerr(SSL_F_SSL3_SEND_SERVER_HELLO, ERR_R_INTERNAL_ERROR);
|
SSLerr(SSL_F_SSL3_SEND_SERVER_HELLO, ERR_R_INTERNAL_ERROR);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -295,11 +295,11 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp,
|
||||||
|
|
||||||
if (os.length > i)
|
if (os.length > i)
|
||||||
os.length = i;
|
os.length = i;
|
||||||
if (os.length > sizeof ret->session_id) /* can't happen */
|
if (os.length > (int)sizeof(ret->session_id)) /* can't happen */
|
||||||
os.length = sizeof ret->session_id;
|
os.length = sizeof(ret->session_id);
|
||||||
|
|
||||||
ret->session_id_length=os.length;
|
ret->session_id_length=os.length;
|
||||||
OPENSSL_assert(os.length <= sizeof ret->session_id);
|
OPENSSL_assert(os.length <= (int)sizeof(ret->session_id));
|
||||||
memcpy(ret->session_id,os.data,os.length);
|
memcpy(ret->session_id,os.data,os.length);
|
||||||
|
|
||||||
M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING);
|
M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING);
|
||||||
|
|
|
@ -794,7 +794,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
|
||||||
}
|
}
|
||||||
|
|
||||||
r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
|
r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
|
||||||
if (r <= 0 || r >= sizeof buf)
|
if (r <= 0 || r >= (int)sizeof(buf))
|
||||||
goto err;
|
goto err;
|
||||||
if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
|
if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
|
@ -1350,8 +1350,8 @@ int doit(SSL *s_ssl, SSL *c_ssl, long count)
|
||||||
{
|
{
|
||||||
if (c_write)
|
if (c_write)
|
||||||
{
|
{
|
||||||
j=(cw_num > (long)sizeof(cbuf))
|
j = (cw_num > (long)sizeof(cbuf)) ?
|
||||||
?sizeof(cbuf):(int)cw_num;
|
(int)sizeof(cbuf) : (int)cw_num;
|
||||||
i=BIO_write(c_bio,cbuf,j);
|
i=BIO_write(c_bio,cbuf,j);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
{
|
{
|
||||||
|
@ -1481,8 +1481,8 @@ int doit(SSL *s_ssl, SSL *c_ssl, long count)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
j=(sw_num > (long)sizeof(sbuf))?
|
j = (sw_num > (long)sizeof(sbuf)) ?
|
||||||
sizeof(sbuf):(int)sw_num;
|
(int)sizeof(sbuf) : (int)sw_num;
|
||||||
i=BIO_write(s_bio,sbuf,j);
|
i=BIO_write(s_bio,sbuf,j);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue