From 556a45f37b87d7fe7f9ce2445a7044964dee4f81 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 21 Feb 2019 04:08:41 -1100 Subject: [PATCH] Extern C --- src/cc/cclib.cpp | 19 ------------------- src/cc/musig.cpp | 22 +++++++++++++++++++++- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/cc/cclib.cpp b/src/cc/cclib.cpp index 5d321bdae..bfd57e61d 100644 --- a/src/cc/cclib.cpp +++ b/src/cc/cclib.cpp @@ -584,14 +584,6 @@ uint256 juint256(cJSON *obj) #else #include "sudoku.cpp" -#define USE_BASIC_CONFIG -#define ENABLE_MODULE_MUSIG -#include "../secp256k1/src/basic-config.h" -#include "../secp256k1/include/secp256k1.h" -#include "../secp256k1/src/ecmult.h" -#include "../secp256k1/src/ecmult_gen.h" - -typedef struct { unsigned char data[64]; } secp256k1_schnorrsig; /* #include "../secp256k1/src/util.h" @@ -623,17 +615,6 @@ return 0; \ } while(0)*/ //#include "../secp256k1/src/secp256k1.c" -struct secp256k1_context_struct { - secp256k1_ecmult_context ecmult_ctx; - secp256k1_ecmult_gen_context ecmult_gen_ctx; - secp256k1_callback illegal_callback; - secp256k1_callback error_callback; -}; - -extern "C" int secp256k1_ecmult_multi_var(const secp256k1_ecmult_context *ctx, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n); -extern "C" int secp256k1_schnorrsig_verify(const secp256k1_context* ctx, const secp256k1_schnorrsig *sig, const unsigned char *msg32, const secp256k1_pubkey *pk); -extern "C" int secp256k1_schnorrsig_parse(const secp256k1_context* ctx, secp256k1_schnorrsig* sig, const unsigned char *in64); - #include "musig.cpp" #endif diff --git a/src/cc/musig.cpp b/src/cc/musig.cpp index 057307fae..23c14bb8e 100755 --- a/src/cc/musig.cpp +++ b/src/cc/musig.cpp @@ -13,8 +13,28 @@ * * ******************************************************************************/ - +#define USE_BASIC_CONFIG +#define ENABLE_MODULE_MUSIG +#include "../secp256k1/src/basic-config.h" #include "../secp256k1/include/secp256k1.h" +#include "../secp256k1/src/ecmult.h" +#include "../secp256k1/src/ecmult_gen.h" + +typedef struct { unsigned char data[64]; } secp256k1_schnorrsig; +struct secp256k1_context_struct { + secp256k1_ecmult_context ecmult_ctx; + secp256k1_ecmult_gen_context ecmult_gen_ctx; + secp256k1_callback illegal_callback; + secp256k1_callback error_callback; +}; + +extern "C" int secp256k1_ecmult_multi_var(const secp256k1_ecmult_context *ctx, secp256k1_scratch *scratch, secp256k1_gej *r, const secp256k1_scalar *inp_g_sc, secp256k1_ecmult_multi_callback cb, void *cbdata, size_t n); +extern "C" int secp256k1_schnorrsig_verify(const secp256k1_context* ctx, const secp256k1_schnorrsig *sig, const unsigned char *msg32, const secp256k1_pubkey *pk); +extern "C" int secp256k1_schnorrsig_parse(const secp256k1_context* ctx, secp256k1_schnorrsig* sig, const unsigned char *in64); +extern "C" int secp256k1_musig_pubkey_combine(const secp256k1_context* ctx, secp256k1_scratch_space *scratch, secp256k1_pubkey *combined_pk, unsigned char *pk_hash32, const secp256k1_pubkey *pubkeys, size_t n_pubkeys); + + +//#include "../secp256k1/include/secp256k1.h" //#include "../secp256k1/include/secp256k1_schnorrsig.h" #include "../secp256k1/include/secp256k1_musig.h"