From 320d34a6062ed1f30d5893e520024971390a2938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= Date: Wed, 23 Oct 2013 14:39:51 +0300 Subject: [PATCH] libratbox/crypt: fix difference from glibc in sha256_crypt() rb_crypt() was generating different SHA256 ($5$) hashes than glibc, making hashes generated with charybdis unusable in ratbox and other software, and vice versa. --- libratbox/src/crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libratbox/src/crypt.c b/libratbox/src/crypt.c index 86c3c3f2..b557cf5d 100644 --- a/libratbox/src/crypt.c +++ b/libratbox/src/crypt.c @@ -1567,7 +1567,7 @@ static char *rb_sha256_crypt_r(const char *key, const char *salt, char *buffer, rb_sha256_init_ctx(&alt_ctx); /* For every character in the password add the entire password. */ - for (cnt = 0; cnt < (size_t)(16 + alt_result[0]); ++cnt) + for (cnt = 0; cnt < key_len; ++cnt) rb_sha256_process_bytes(key, key_len, &alt_ctx); /* Finish the digest. */