aboutsummaryrefslogtreecommitdiff
path: root/src/noscryptutil.c
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-08-28 19:54:45 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-08-28 19:54:45 -0400
commitde9741b417ee04a54512af106b71cf388c93ea9d (patch)
treed0f2d129d6db16f635c538217ac8fb856f3225be /src/noscryptutil.c
parent85c48ba24c34277ecaeb4ab513bd195a350cee2a (diff)
feat: add library context alloc util functions
Diffstat (limited to 'src/noscryptutil.c')
-rw-r--r--src/noscryptutil.c13
1 files changed, 13 insertions, 0 deletions
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;