aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_get_encoding.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-05-20 23:04:11 +0200
committerMattias Andrée <m@maandree.se>2026-05-20 23:04:11 +0200
commitc35b47228f5494f4d806e9166628110af6dd2469 (patch)
tree3b5a123af999a5e047b8565efee293a5d95c3f6c /librecrypt_get_encoding.c
parentPrepare for supporting custom algorithms (diff)
downloadlibrecrypt-c35b47228f5494f4d806e9166628110af6dd2469.tar.gz
librecrypt-c35b47228f5494f4d806e9166628110af6dd2469.tar.bz2
librecrypt-c35b47228f5494f4d806e9166628110af6dd2469.tar.xz
Add (so far untested and undocument) support for pepperHEADmaster
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'librecrypt_get_encoding.c')
-rw-r--r--librecrypt_get_encoding.c16
1 files changed, 3 insertions, 13 deletions
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;
@@ -120,10 +114,6 @@ main(void)
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);