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 --- include/noscryptutil.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/noscryptutil.h') diff --git a/include/noscryptutil.h b/include/noscryptutil.h index 63e08f8..ea5dad0 100644 --- a/include/noscryptutil.h +++ b/include/noscryptutil.h @@ -77,6 +77,19 @@ NC_EXPORT NCResult NC_CC NCUtilGetEncryptionPaddedSize(uint32_t encVersion, uint */ NC_EXPORT NCResult NC_CC NCUtilGetEncryptionBufferSize(uint32_t encVersion, uint32_t plaintextSize); +/* +* Allocates a new library context structure dynamically on the heap and returns a pointer to +* it. The library context must be freed with NCUtilContextFree when it is no longer needed. +* @return A valid pointer to a new library context or NULL if the operation failed +*/ +NC_EXPORT NCContext* NC_CC NCUtilContextAlloc(void); + +/* +* Frees the library context structure and clears the memory it points to. +* @param ctx A valid pointer to a library context memory +*/ +NC_EXPORT void NC_CC NCUtilContextFree(NCContext* ctx); + /* * Allocates a new encryption context and sets the encryption version and flags. The encryption context * must be freed with NCUtilCipherFree when it is no longer needed. -- cgit