diff options
Diffstat (limited to 'librecrypt_create_context.c')
| -rw-r--r-- | librecrypt_create_context.c | 17 |
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; |
