From 86b02540cce6015cfe4a2a56499a9a2f45d4e368 Mon Sep 17 00:00:00 2001 From: vnugent Date: Sat, 18 May 2024 12:24:17 -0400 Subject: refactor: Remove NCContext structure definition --- src/noscrypt.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/noscrypt.c b/src/noscrypt.c index fac3dfb..d1c7dca 100644 --- a/src/noscrypt.c +++ b/src/noscrypt.c @@ -51,12 +51,25 @@ #define CHECK_ARG_RANGE(x, min, max, argPos) #endif /* !NC_DISABLE_INPUT_VALIDATION */ +/* +* Actual, private defintion of the NCContext structure +* to allow for future development and ABI backords +* compatability. +*/ +struct nc_ctx_struct { + + void* secpCtx; + +}; + /* * The Nip44 constant salt * https://github.com/nostr-protocol/nips/blob/master/44.md#encryption */ static const uint8_t Nip44ConstantSalt[8] = { 0x6e, 0x69, 0x70, 0x34, 0x34, 0x2d, 0x76, 0x32 }; +static struct nc_ctx_struct _ncSharedCtx; + struct shared_secret { uint8_t value[NC_SHARED_SEC_SIZE]; }; @@ -429,6 +442,12 @@ NC_EXPORT uint32_t NC_CC NCGetContextStructSize(void) return sizeof(NCContext); } +NC_EXPORT NCContext* NC_CC NCGetSharedContext(void) +{ + /*Return the global address of the shared context structure */ + return &_ncSharedCtx; +} + NC_EXPORT NCResult NC_CC NCInitContext( NCContext* ctx, const uint8_t entropy[NC_CONTEXT_ENTROPY_SIZE] -- cgit