From 718be80a4810b9352de7eb0707da54020aa6b649 Mon Sep 17 00:00:00 2001 From: vnugent Date: Mon, 27 May 2024 14:52:41 -0400 Subject: fix: Properly build mbedtls & cmake fixes --- src/noscrypt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/noscrypt.c') diff --git a/src/noscrypt.c b/src/noscrypt.c index d1c7dca..258ba8d 100644 --- a/src/noscrypt.c +++ b/src/noscrypt.c @@ -21,6 +21,7 @@ #include "noscrypt.h" #include "nc-util.h" +#include "hkdf.h" #include "nc-crypto.h" #include @@ -103,13 +104,17 @@ STATIC_ASSERT(sizeof(struct nc_expand_keys) == sizeof(struct message_key), "Expe * Check that the fallback hkdf extract internal buffer is large enough * for full converstation key buffers */ -STATIC_ASSERT(HKDF_IN_BUF_SIZE >= NC_CONV_KEY_SIZE + 8, "HKDF Buffer size is too small for Safe HKDF operations") +STATIC_ASSERT(HKDF_IN_BUF_SIZE >= NC_CONV_KEY_SIZE + 8, "HKDF Buffer size is too small for safe HKDF operations") /* * Internal helper functions to do common structure conversions */ -static _nc_fn_inline int _convertToXonly(const NCContext* ctx, const NCPublicKey* compressedPubKey, secp256k1_xonly_pubkey* xonly) +static _nc_fn_inline int _convertToXonly( + const NCContext* ctx, + const NCPublicKey* compressedPubKey, + secp256k1_xonly_pubkey* xonly +) { DEBUG_ASSERT2(ctx != NULL, "Expected valid context") DEBUG_ASSERT2(compressedPubKey != NULL, "Expected a valid public 32byte key structure") @@ -456,6 +461,8 @@ NC_EXPORT NCResult NC_CC NCInitContext( CHECK_NULL_ARG(ctx, 0) CHECK_NULL_ARG(entropy, 1) + ZERO_FILL(ctx, sizeof(NCContext)); + ctx->secpCtx = secp256k1_context_create(SECP256K1_CONTEXT_NONE); /* -- cgit