aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_get_encoding.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-05-01 17:45:39 +0200
committerMattias Andrée <m@maandree.se>2026-05-01 17:45:39 +0200
commitadfa8e1265f6155d1a582baa9929af198bb5d4de (patch)
treee3cee62aa5a8768621cd294295f787b8cc54141b /librecrypt_get_encoding.c
parentAdd librecrypt.7 and README (diff)
downloadlibrecrypt-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_get_encoding.c')
-rw-r--r--librecrypt_get_encoding.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/librecrypt_get_encoding.c b/librecrypt_get_encoding.c
index dd5d33d..2eef882 100644
--- a/librecrypt_get_encoding.c
+++ b/librecrypt_get_encoding.c
@@ -9,18 +9,21 @@ librecrypt_get_encoding(const char *settings, size_t len, char *pad_out, int *st
size_t i, start = 0u;
const struct algorithm *algo;
+ /* Find last algorithm in the chain */
for (i = 0u; i < len; i++)
if (settings[i] == LIBRECRYPT_ALGORITHM_LINK_DELIMITER)
start = i + 1u;
settings = &settings[start];
len -= start;
+ /* Identify the algorithm */
algo = librecrypt_find_first_algorithm_(settings, len);
if (!algo) {
errno = ENOSYS;
return NULL;
}
+ /* Return the algorithms salt/hash encoding format */
*pad_out = algo->pad;
*strict_pad_out = algo->strict_pad;
if (decoding)