From c35b47228f5494f4d806e9166628110af6dd2469 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 20 May 2026 23:04:11 +0200 Subject: Add (so far untested and undocument) support for pepper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- librecrypt_get_encoding.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'librecrypt_get_encoding.c') diff --git a/librecrypt_get_encoding.c b/librecrypt_get_encoding.c index cad16df..c1cf64c 100644 --- a/librecrypt_get_encoding.c +++ b/librecrypt_get_encoding.c @@ -4,17 +4,12 @@ const void * -librecrypt_get_encoding(const char *settings, size_t len, char *pad_out, int *strict_pad_out, int decoding, void *reserved) +librecrypt_get_encoding(const char *settings, size_t len, char *pad_out, int *strict_pad_out, + int decoding, LIBRECRYPT_CONTEXT *ctx) { size_t i, start = 0u; const struct librecrypt_algorithm *algo; - /* Ensure the reserved parameter is NULL */ - if (reserved != NULL) { - errno = EINVAL; - return NULL; - } - /* Find last algorithm in the chain */ for (i = 0u; i < len; i++) if (settings[i] == LIBRECRYPT_ALGORITHM_LINK_DELIMITER) @@ -23,7 +18,7 @@ librecrypt_get_encoding(const char *settings, size_t len, char *pad_out, int *st len -= start; /* Identify the algorithm */ - algo = librecrypt_find_first_algorithm_(settings, len); + algo = librecrypt_find_first_algorithm_(settings, len, ctx); if (!algo) { errno = ENOSYS; return NULL; @@ -110,7 +105,6 @@ check_decoding_lut(const unsigned char *lut, const char *alpha) int main(void) { - char reserved[1] = {0}; const char *elut; const unsigned char *dlut; char pad; @@ -119,10 +113,6 @@ main(void) SET_UP_ALARM(); INIT_RESOURCE_TEST(); - errno = 0; - EXPECT(librecrypt_get_encoding("$argon2i$", sizeof("$argon2i$") - 1u, &pad, &strict_pad, 0, reserved) == NULL); - EXPECT(errno == EINVAL); - errno = 0; EXPECT(librecrypt_get_encoding(NSA, sizeof(NSA) - 1u, &pad, &strict_pad, 0, NULL) == NULL); EXPECT(errno == ENOSYS); -- cgit v1.2.3-70-g09d2