From 2d3a573977417d917c16742d8d9d8ead047d0ebc Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 8 May 2026 22:29:35 +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_settings_prefix.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'librecrypt_settings_prefix.c') 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; } -- cgit v1.2.3-70-g09d2