A note for MSVC2005 at least: On Sun, Jan 11, 2009 at 4:58 PM, Dr. Stephen Henson <st...@openssl.org> wrote: [...] > Modified files: > openssl/ssl s2_pkt.c t1_enc.c > > Log: > Fix sign-compare warnings. > > Summary: > Revision Changes Path > 1.26 +1 -1 openssl/ssl/s2_pkt.c > 1.56 +1 -1 openssl/ssl/t1_enc.c [...] > --- openssl/ssl/t1_enc.c 5 Jan 2009 14:43:05 -0000 1.55 > +++ openssl/ssl/t1_enc.c 11 Jan 2009 15:58:51 -0000 1.56 > @@ -805,7 +805,7 @@ > { > if (mask & s->s3->tmp.new_cipher->algorithm2) > { > - int hashsize = EVP_MD_size(md); > + unsigned int hashsize = EVP_MD_size(md); > if (hashsize < 0 || hashsize > (sizeof buf - > (size_t)(q-buf))) > { > /* internal error: 'buf' is too small for this > cipersuite! */ > @@ .
The 'if (hashsize < 0 || ' in there will produce a warning now about 'condition is always true' or something along similar lines for other compilers in pedantic mode. Since you treat the hashsize as an unsigned here, the possible error signal -1 will be represented by a very large positive number instead, so the if() can, without loss of functionality, be modified: if (hashsize < 0 || hashsize > (sizeof buf - (size_t)(q-buf))) becomes: if (hashsize > (sizeof buf - (size_t)(q-buf))) and, by the way, it may be handy to use 'size_t' here instead of 'unsigned int' - at least for Win64 MSVC those are not the same and produce additional warnings (which one can ignore ;-) ) Alas, such would require further adjusting OpenSSL code to use size_t for lengths to prevent further yakking from our compilers then. -- Met vriendelijke groeten / Best regards, Ger Hobbelt -------------------------------------------------- web: http://www.hobbelt.com/ http://www.hebbut.net/ mail: g...@hobbelt.com mobile: +31-6-11 120 978 -------------------------------------------------- ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager majord...@openssl.org