From de9741b417ee04a54512af106b71cf388c93ea9d Mon Sep 17 00:00:00 2001 From: vnugent Date: Wed, 28 Aug 2024 19:54:45 -0400 Subject: feat: add library context alloc util functions --- src/noscryptutil.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/noscryptutil.c') diff --git a/src/noscryptutil.c b/src/noscryptutil.c index 115ad04..333ef74 100644 --- a/src/noscryptutil.c +++ b/src/noscryptutil.c @@ -672,6 +672,19 @@ NC_EXPORT NCResult NC_CC NCUtilGetEncryptionBufferSize(uint32_t encVersion, uint } +NC_EXPORT NCContext* NC_CC NCUtilContextAlloc(void) +{ + /* Dynamically allocate context aligned and zeroed */ + return (NCContext*)_nc_mem_alloc(1, NCGetContextStructSize()); +} + + +NC_EXPORT void NC_CC NCUtilContextFree(NCContext* ctx) +{ + _nc_mem_free(ctx); +} + + NC_EXPORT NCUtilCipherContext* NC_CC NCUtilCipherAlloc(uint32_t encVersion, uint32_t flags) { NCUtilCipherContext* encCtx; -- cgit