From adfa8e1265f6155d1a582baa9929af198bb5d4de Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 1 May 2026 17:45:39 +0200 Subject: Misc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- librecrypt_make_settings.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'librecrypt_make_settings.c') diff --git a/librecrypt_make_settings.c b/librecrypt_make_settings.c index 99c7e3b..49996c1 100644 --- a/librecrypt_make_settings.c +++ b/librecrypt_make_settings.c @@ -9,23 +9,29 @@ librecrypt_make_settings(char *out_buffer, size_t size, const char *algorithm, s { const struct algorithm *algo; + /* Get algorithm */ if (!algorithm) { + /* Select best algorithm if `NULL` is specified */ algo = &librecrypt_algorithms_[0]; if (IS_END_OF_ALGORITHMS(algo)) goto enosys; } else { + /* Verify single, unchained algorithm is specified if not `NULL`*/ if (strchr(algorithm, LIBRECRYPT_ALGORITHM_LINK_DELIMITER)) { errno = EINVAL; return -1; } + /* Identify the algorithm */ algo = librecrypt_find_first_algorithm_(algorithm, strlen(algorithm)); if (!algo) goto enosys; } + /* Use default random number generator if none was specified */ if (!rng) rng = &librecrypt_rng_; + /* Configure */ return (*algo->make_settings)(out_buffer, size, algorithm, memcost, timecost, gensalt, rng, user); enosys: -- cgit v1.2.3-70-g09d2