aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_settings_prefix.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-05-08 22:29:35 +0200
committerMattias Andrée <m@maandree.se>2026-05-08 22:29:35 +0200
commit2d3a573977417d917c16742d8d9d8ead047d0ebc (patch)
treecaeac52856a9df0478e2bee53e5dda1f84422461 /librecrypt_settings_prefix.c
parentAdd DEFAULT_SUPPORT option and improve DEPENDENCIES (diff)
downloadlibrecrypt-2d3a573977417d917c16742d8d9d8ead047d0ebc.tar.gz
librecrypt-2d3a573977417d917c16742d8d9d8ead047d0ebc.tar.bz2
librecrypt-2d3a573977417d917c16742d8d9d8ead047d0ebc.tar.xz
Misc
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--librecrypt_settings_prefix.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/librecrypt_settings_prefix.c b/librecrypt_settings_prefix.c
index 7568bb3..0fcf8ae 100644
--- a/librecrypt_settings_prefix.c
+++ b/librecrypt_settings_prefix.c
@@ -21,7 +21,9 @@ librecrypt_settings_prefix(const char *hash, size_t *hashsize_out)
/* and get `strlen(hash)` */
len = i;
- /* TODO "_" is a prefix that is being used */
+ /* Special case for bsdicrypt */
+ if (ret == last_offset && ret < len && hash[ret] == '_')
+ ret += 1u;
/* Return if hash size is not required */
if (!hashsize_out)
@@ -87,6 +89,7 @@ int
main(void)
{
SET_UP_ALARM();
+ INIT_RESOURCE_TEST();
/* Simple cases */
CHECK_NULL("", "result");
@@ -107,8 +110,14 @@ main(void)
CHECK_NULL("a$b$c>", "*2");
CHECK_NULL("a$b$c>*10$", "*2");
+ /* Special case: bsdicrypt */
+ CHECK_NULL("_", "res");
+ CHECK_NULL("_", "");
+ CHECK_NULL("$x$*10>_", "_");
+
/* TODO test hash size output (requires algorithms) */
+ STOP_RESOURCE_TEST();
return 0;
}