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

Jann Horn <[email protected]> Mon, 12 Nov 2012 19:49:37 +0100
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
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