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

Enrico Scholz <[email protected]> Wed, 14 Nov 2012 13:35:14 +0100
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
[email protected] (Jann Horn) writes:

> 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?

for non-performance critical cases or in situations where splice(2) is
applicable, you might consider the kernel builtin AF_ALG sockets. E.g.

           https://www.cvg.de/people/ensc/signature-kernel.c

Nevertheless, you will have to implement the special $6$ handling in
crypt(3) by yourself.


Enrico