diff options
| author | Mattias Andrée <m@maandree.se> | 2026-05-01 17:45:39 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-05-01 17:45:39 +0200 |
| commit | adfa8e1265f6155d1a582baa9929af198bb5d4de (patch) | |
| tree | e3cee62aa5a8768621cd294295f787b8cc54141b /librecrypt_make_settings.c | |
| parent | Add librecrypt.7 and README (diff) | |
| download | librecrypt-adfa8e1265f6155d1a582baa9929af198bb5d4de.tar.gz librecrypt-adfa8e1265f6155d1a582baa9929af198bb5d4de.tar.bz2 librecrypt-adfa8e1265f6155d1a582baa9929af198bb5d4de.tar.xz | |
Misc
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'librecrypt_make_settings.c')
| -rw-r--r-- | librecrypt_make_settings.c | 6 |
1 files changed, 6 insertions, 0 deletions
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: |
