On Mon, Jan 25, 2016 at 11:58:18AM +0100, Tomas Mraz wrote:
On Ne, 2016-01-24 at 23:21 +0300, Dmitry V. Levin wrote:
On Wed, Aug 12, 2015 at 05:44:09PM +0200, Tomas Mraz wrote:
Hello,
currently pam_unix hardcodes the new salt length when password is changed to be 8 characters - this makes it due to the limitation to 64 only possible characters to be 48 bits long. This is slightly lower than can be considered as long enough for any paranoid. I propose to make it 12 characters which should satisfy any paranoid person as rainbow tables of 2^72 hashes for each tested password can hardly be created in the foreseeable future.
2^(6*8) looks noticeably less compared to 2^(8*16) implemented in crypt_gensalt_r function from crypt_blowfish.
In current pam_unix implementation, crypt_make_salt loses 2 bits for each 8 bits of hashed randomness, this certainly needs to be fixed.
I see no point in hashing random input with md5. Why not just read 16 bytes of randomness and make 2^(8*16) bits of encoded salt out of it?
Also there is no hashing of the randomness pulled from /dev/urandom. The hashing of fairly nonrandom input (i.e. time) is there only in case the read from /dev/urandom fails.
Here is the proposed trivial patch to raise the salt length to 16 characters. OK to commit?
This should work, although I'd probably replaced 20 with (16 + 1 + (sp - salt)).