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:
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];
|
||||
SSL_CIPHER c,*cp= &c,**cpp;
|
||||
unsigned long id;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (init)
|
||||
{
|
||||
@@ -437,7 +437,8 @@ int ssl2_generate_key_material(SSL *s)
|
||||
EVP_MD_CTX_init(&ctx);
|
||||
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);
|
||||
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))
|
||||
{
|
||||
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 */
|
||||
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
|
||||
&& 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,&c,1);
|
||||
c++;
|
||||
@@ -495,7 +497,7 @@ void ssl2_write_error(SSL *s)
|
||||
|
||||
error=s->error; /* number of bytes left to write */
|
||||
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);
|
||||
|
||||
/* if (i == error) s->rwstate=state; */
|
||||
|
Reference in New Issue
Block a user