[PATCH 2/3] sha1: silence warning on big endian platforms

Marc Kleine-Budde mkl at pengutronix.de
Fri Nov 6 10:56:08 UTC 2009


Stefan Seyfried wrote:
> On Fri,  6 Nov 2009 10:56:46 +0100
> Marc Kleine-Budde <mkl at pengutronix.de> wrote:
> 
>> Silence this warning, which crashes when CONFIG_WERROR is active:
>>
>> cc1: warnings being treated as errors
>> libbb/sha1.c: In function 'sha1_end':
>> libbb/sha1.c:411: error: unused variable 'i'
>> libbb/sha1.c: In function 'sha512_end':
>> libbb/sha1.c:446: error: unused variable 'i'
>>
>> Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>
>> ---
>>  libbb/sha1.c |    4 ++++
>>  1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/libbb/sha1.c b/libbb/sha1.c
>> index ea645b7..964ff3c 100644
>> --- a/libbb/sha1.c
>> +++ b/libbb/sha1.c
>> @@ -410,6 +410,8 @@ void FAST_FUNC sha1_end(void *resbuf, sha1_ctx_t
>> *ctx) {
>>  	unsigned i, pad, in_buf;
>>  
>> +	(void)i;
>> +
>>  	in_buf = ctx->total64 & 63;
>>  	/* Pad the buffer to the next 64-byte boundary with
>> 0x80,0,0,0... */ ctx->wbuffer[in_buf++] = 0x80;
>> @@ -445,6 +447,8 @@ void FAST_FUNC sha512_end(void *resbuf,
>> sha512_ctx_t *ctx) {
>>  	unsigned i, pad, in_buf;
>>  
>> +	(void)i;
>> +
>>  	in_buf = ctx->total64[0] & 127;
>>  	/* Pad the buffer to the next 128-byte boundary with
>> 0x80,0,0,0...
>>  	 * (FIPS 180-2:5.1.2)
> 
> At least those could easily be fixed as
> ---
> #if BB_LITTLE_ENDIAN
> 	unsigned i;
> #endif
> 	unsigned pad, in_buf;
> ---
> 
> Which is less ugly IMHO.

okay, will do

cheers, Marc


-- 
Pengutronix e.K.                         | Marc Kleine-Budde           |
Linux Solutions for Science and Industry | Phone: +49-231-2826-924     |
Vertretung West/Dortmund                 | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686         | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20091106/7ee7ba29/attachment.pgp>


More information about the busybox mailing list