From df29296c7bc1d838b8a1f90ba864dcefafdd7531 Mon Sep 17 00:00:00 2001 From: Aaron Jones Date: Sun, 5 Nov 2017 16:48:16 +0000 Subject: [PATCH] libathemecore/crypto.c: crypt_string(): generate salt if not given one --- libathemecore/crypto.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libathemecore/crypto.c b/libathemecore/crypto.c index 6b7d97962..6ecbb0921 100644 --- a/libathemecore/crypto.c +++ b/libathemecore/crypto.c @@ -76,8 +76,16 @@ static void crypt_log_modchg(const char *const restrict caller, const char *const restrict which, const crypt_impl_t *const restrict impl) { - const unsigned int level = (runflags & RF_STARTING) ? LG_DEBUG : LG_INFO; - const crypt_impl_t *const ci = crypt_get_default_provider(); + const crypt_impl_t *ci = crypt_get_default_provider(); + + if (!salt || !*salt) + salt = ci->salt(); + + if (!salt) + return NULL; + + return ci->crypt(key, salt); +} (void) slog(level, "%s: %s crypto provider '%s'", caller, which, impl->id);