[PATCH] use 36 byte buffer in md5 instead of 120, shrink code

Denys Vlasenko vda.linux at googlemail.com
Fri Jun 13 15:45:47 UTC 2008


On Friday 13 June 2008 17:45, Denys Vlasenko wrote:
> md5 crypt stores result in the form $1$xxx$yyyyyyyyy<NUL>
> 
> where xxx is salt (up to 8 chars) and yyy is hash
> (22 chars). Using 120 bytes buffer for it is excessive.
> 
> The patch also replaces e.g. strcat(passwd,"$")
> which writes $ between xxx and yyyy above with one-byte store,
> which is shorter.
> 
> __md5_to64 is made to return advanced pointer, eliminating
> the need to do it at call sites.
> 
> Size:
> 
>     text           data     bss     dec     hex filename
> -   1905              0     120    2025     7e9 libcrypt/md5.o
> +   1879              0      36    1915     77b libcrypt/md5.o
> 
> Run tested:
>   TEST_EXEC crypt/ crypt
>   TEST_DIFF crypt/ crypt.out crypt.out.good
>   TEST_EXEC crypt/ md5c-test
>   TEST_EXEC crypt/ crypt_glibc
>   TEST_DIFF crypt/ crypt_glibc.out crypt.out.good
>   TEST_EXEC crypt/ md5c-test_glibc
> 
> Please review.

Now even with patch actually attached.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.patch
Type: text/x-diff
Size: 2079 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20080613/9c3d74bc/attachment.bin 


More information about the uClibc mailing list