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_make_settings.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'librecrypt_make_settings.c') diff --git a/librecrypt_make_settings.c b/librecrypt_make_settings.c index b883e4f..075d2a6 100644 --- a/librecrypt_make_settings.c +++ b/librecrypt_make_settings.c @@ -4,17 +4,13 @@ ssize_t -librecrypt_make_settings(char *out_buffer, size_t size, const char *algorithm, size_t memcost, uintmax_t timecost, - int gensalt, ssize_t (*rng)(void *out, size_t n, void *user), void *user, void *reserved) +librecrypt_make_settings(char *out_buffer, size_t size, const char *algorithm, + size_t memcost, uintmax_t timecost, int gensalt, + ssize_t (*rng)(void *out, size_t n, void *user), void *user, + LIBRECRYPT_CONTEXT *ctx) { const struct librecrypt_algorithm *algo; - /* Ensure the reserved parameter is NULL */ - if (reserved != NULL) { - errno = EINVAL; - return -1; - } - /* Get algorithm */ if (!algorithm) { /* Select best algorithm if `NULL` is specified */ @@ -28,7 +24,7 @@ librecrypt_make_settings(char *out_buffer, size_t size, const char *algorithm, s return -1; } /* Identify the algorithm */ - algo = librecrypt_find_first_algorithm_(algorithm, strlen(algorithm)); + algo = librecrypt_find_first_algorithm_(algorithm, strlen(algorithm), ctx); if (!algo) goto enosys; } @@ -81,7 +77,6 @@ main(void) int any_supported = 0; int any_salted = 0; ssize_t r; - char reserved[1] = {0}; SET_UP_ALARM(); INIT_RESOURCE_TEST(); @@ -103,10 +98,6 @@ main(void) EXPECT(errno == ENOSYS); #if defined(SUPPORT_ARGON2I) - errno = 0; - EXPECT(librecrypt_make_settings(NULL, 0u, "$argon2id$", 0u, 0u, 0, NULL, NULL, reserved) == -1); - EXPECT(errno == EINVAL); - saltbyte = 0u; CANARY_FILL(buf); r = librecrypt_make_settings(buf, sizeof(buf), "$argon2i$", 8192u << 10, (uintmax_t)81920u, 1, &saltgen, &saltbyte, NULL); -- cgit v1.2.3-70-g09d2