diff options
| author | Mattias Andrée <m@maandree.se> | 2026-05-20 23:04:11 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-05-20 23:04:11 +0200 |
| commit | c35b47228f5494f4d806e9166628110af6dd2469 (patch) | |
| tree | 3b5a123af999a5e047b8565efee293a5d95c3f6c /librecrypt_create_context.c | |
| parent | Prepare for supporting custom algorithms (diff) | |
| download | librecrypt-c35b47228f5494f4d806e9166628110af6dd2469.tar.gz librecrypt-c35b47228f5494f4d806e9166628110af6dd2469.tar.bz2 librecrypt-c35b47228f5494f4d806e9166628110af6dd2469.tar.xz | |
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
| -rw-r--r-- | librecrypt_create_context.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/librecrypt_create_context.c b/librecrypt_create_context.c new file mode 100644 index 0000000..c9696d7 --- /dev/null +++ b/librecrypt_create_context.c @@ -0,0 +1,47 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + + +LIBRECRYPT_CONTEXT * +librecrypt_create_context(void) +{ + LIBRECRYPT_CONTEXT *ret; + size_t i; + + ret = calloc(1u, sizeof(*ret)); + if (!ret) + return NULL; + + /* calloc, sets all bytes to 0, but NULL isn't necessarily + * presented by all zeroes even though assigning 0 to a + * pointer assigns it NULL, therefore we have to manually + * set all pointers to NULL; just to be defensive, we + * set all pointers to NULL, even ones that have a length + * (zeroed) associated with them */ + + ret->user_data = NULL; + for (i = 0u; i < ELEMSOF(ret->peppers); i++) + ret->peppers[i].data = NULL; + + return ret; +} + + +#else + + +int +main(void) +{ + SET_UP_ALARM(); + INIT_RESOURCE_TEST(); + + /* TODO test */ + + STOP_RESOURCE_TEST(); + return 0; +} + + +#endif |
