[PATCH] sha512crypt from eglibc
Markus Wichmann <[email protected]> Sun, 13 Mar 2011 11:11:30 +0100
| Newsgroups | gmane.linux.lib.dietlibc |
|---|---|
| Message-ID | <[email protected]> |
Hi all, some time ago, a Debian update made my passwd program write passwords sha512-crypted to /etc/shadow. Since I'm using fgetty (linked against dietlibc) to log in, I could not log in as normal user after changing the password (since diet-crypt doesn't know about sha512). So here's the really Q&D patch. I send it over webspace because Thunderbird is too stupid not to break lines automatically in #v+-Parts. <http://www.hs-merseburg.de/~8mwichma/crypt-sha.patch> I know the code is incredibly bad style (my patch to crypt.c contains local function declarations and the eglibc code actually uses snprintf() *shudder*) but hey, it works. Though I have no idea why they are computing the sha512 over salt and password 5000 times. They say it's to burn CPU power. OK, to make it harder to bruteforce it? If a hash could be bruteforced in a reasonable time after a single use, it would be an epic fail. Multiplying the strength by 5000 seems like overkill to me. I mean, a 2x2.1 GHz Pentium Core 2 Duo won't have a problem with that many iterations, but a 32 MHz AVR8 probably will. Unfortunately, to maintain compatibility (without which that patch would be quite senseless) I had to make dietlibc do the same. And while I was at it, I made the DES code conditional (who uses it nowadays anyway? Oh, fuck, my uni does!) HTH, Markus -- () ASCII Ribbon Campaign /\ Against HTML in Mail and News