Skip to content

Commit

Permalink
lib: Silently truncate rbytes after a maximum of 512 bits for sha1crypt.
Browse files Browse the repository at this point in the history
  • Loading branch information
besser82 committed Dec 17, 2021
1 parent a74a677 commit 9014fe9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/crypt-pbkdf1-sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ gensalt_sha1crypt_rn (unsigned long count,
static_assert (sizeof (uint32_t) == 4,
"space calculations below assume 8-bit bytes");

/* Up to 512 bits (64 bytes) of entropy for computing the salt portion
of the MCF-setting are supported. */
nrbytes = (nrbytes > 68 ? 68 : nrbytes);

/* Make sure we have enough random bytes to use for the salt.
The format supports using up to 48 random bytes, but 12 is
enough. We require another 4 bytes of randomness to perturb
Expand Down

0 comments on commit 9014fe9

Please sign in to comment.