aboutsummaryrefslogtreecommitdiff
path: root/src/noscrypt.c
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-05-18 12:24:17 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-05-18 12:24:17 -0400
commit86b02540cce6015cfe4a2a56499a9a2f45d4e368 (patch)
tree5f527dda3042baa5866107ed1b1ced4cc80663d8 /src/noscrypt.c
parentd09d9330415d463ca19be9394b02ce11b3366f7e (diff)
refactor: Remove NCContext structure definition
Diffstat (limited to 'src/noscrypt.c')
-rw-r--r--src/noscrypt.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/noscrypt.c b/src/noscrypt.c
index fac3dfb..d1c7dca 100644
--- a/src/noscrypt.c
+++ b/src/noscrypt.c
@@ -52,11 +52,24 @@
#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]