Re: crypt() can't handle SHA-512 crypt hashes

Lorenzo Beretta <[email protected]> Tue, 13 Nov 2012 23:11:04 +0100
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
On 12/11/2012 19:49, Jann Horn wrote:
> I'm trying to write some code that calls crypt() on a user-provided password and
> the hash from the shadowfile, which happens to be a SHA-512 hash (starts with
> $6$). Sadly, it seems that dietlibc's crypt() can't handle anything apart from
> the old unix crypt format and md5. Does anyone happen to have a patch that adds
> support for more hash types?
>
> My usecase is that I'm trying to write a fast web application using CGI scripts,
> and valgrind says that, compared to the time the main method takes to execute,
> setting up dynamic library stuff takes an awfully large amount of time. However,
> glibc doesn't really work for statically compiled stuff (I always get warnings
> like "Using 'getpwuid' in statically linked applications requires at runtime the
> shared libraries from the glibc version used for linking"), so I decided to give
> dietlibc a try. Besides, I don't want 1MB-sized executables.
>
> Jann
>
Couldn't you just use an external library? eg Bruce Guenter's bglibs 
support sha512 and its README.Debian says it's dietlibc-friendly 
(haven't tried it though)