aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_create_context.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-05-21 17:12:20 +0200
committerMattias Andrée <m@maandree.se>2026-05-21 17:12:20 +0200
commitb29f4153e83623f24bebe99976e1368ef31bb008 (patch)
tree65473709df1194a2f9277dc5fb47add5e41430c0 /librecrypt_create_context.c
parentAdd (so far untested and undocument) support for pepper (diff)
downloadlibrecrypt-b29f4153e83623f24bebe99976e1368ef31bb008.tar.gz
librecrypt-b29f4153e83623f24bebe99976e1368ef31bb008.tar.bz2
librecrypt-b29f4153e83623f24bebe99976e1368ef31bb008.tar.xz
Add support for custom hash functions
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--librecrypt_create_context.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/librecrypt_create_context.c b/librecrypt_create_context.c
index c9696d7..a6f5153 100644
--- a/librecrypt_create_context.c
+++ b/librecrypt_create_context.c
@@ -21,6 +21,7 @@ librecrypt_create_context(void)
* (zeroed) associated with them */
ret->user_data = NULL;
+ ret->algos = NULL;
for (i = 0u; i < ELEMSOF(ret->peppers); i++)
ret->peppers[i].data = NULL;
@@ -31,13 +32,27 @@ librecrypt_create_context(void)
#else
+extern LIBRECRYPT_CONTEXT *volatile ctx;
+LIBRECRYPT_CONTEXT *volatile ctx;
+
+
int
main(void)
{
SET_UP_ALARM();
INIT_RESOURCE_TEST();
- /* TODO test */
+ ctx = librecrypt_create_context();
+ assert(ctx != NULL);
+ librecrypt_free_context(ctx);
+
+ if (libtest_have_custom_malloc()) {
+ libtest_set_alloc_failure_in(1u);
+ errno = 0;
+ EXPECT(librecrypt_create_context() == NULL);
+ EXPECT(errno == ENOMEM);
+ EXPECT(libtest_get_alloc_failure_in() == 0u);
+ }
STOP_RESOURCE_TEST();
return 0;