forked from bitcoin-core/secp256k1
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
469bfb1
commit 88b60c0
Showing
9 changed files
with
222 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule ci_utils
updated
from e94242 to ad996e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/********************************************************************** | ||
* Copyright (c) 2017 Tomas van der Wansem * | ||
* Distributed under the MIT software license, see the accompanying * | ||
* file COPYING or http://www.opensource.org/licenses/mit-license.php.* | ||
**********************************************************************/ | ||
|
||
|
||
#ifndef _SECP256K1_MULTISET__ | ||
# define _SECP256K1_MULTISET__ | ||
|
||
# include "secp256k1.h" | ||
|
||
|
||
# ifdef __cplusplus | ||
extern "C" { | ||
# endif | ||
|
||
|
||
/** Opaque multiset; this is actually a group element **/ | ||
typedef struct { | ||
unsigned char d[96]; | ||
} secp256k1_multiset; | ||
|
||
|
||
|
||
/** Initialize a multiset | ||
* The resulting multiset the multiset for no data elements | ||
* | ||
* Returns: 1: success | ||
* 0: invalid parameter | ||
* Args: ctx: pointer to a context object (cannot be NULL) | ||
* Out: multiset: the resulting multiset | ||
*/ | ||
SECP256K1_API int secp256k1_multiset_init( | ||
const secp256k1_context* ctx, | ||
secp256k1_multiset *multiset | ||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2); | ||
|
||
|
||
/** Adds an element to a multiset from single data element | ||
* | ||
* Returns: 1: success | ||
* 0: invalid parameter | ||
* Args: ctx: pointer to a context object (cannot be NULL) | ||
* Out: multiset: the multiset to update | ||
* In: input: the data to add | ||
* inputLen: the size of the data to add | ||
*/ | ||
SECP256K1_API int secp256k1_multiset_add( | ||
const secp256k1_context* ctx, | ||
secp256k1_multiset *multiset, | ||
const unsigned char *input, | ||
size_t inputLen | ||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); | ||
|
||
/** Removes an element from a multiset | ||
* | ||
* Returns: 1: success | ||
* 0: invalid parameter | ||
* Args: ctx: pointer to a context object (cannot be NULL) | ||
* Out: multiset: the multiset to update | ||
* In: input: the data to remove | ||
* inputLen: the size of the data to remove | ||
*/ | ||
SECP256K1_API int secp256k1_multiset_remove( | ||
const secp256k1_context* ctx, | ||
secp256k1_multiset *multiset, | ||
const unsigned char *input, | ||
size_t inputLen | ||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); | ||
|
||
|
||
|
||
/** Combines two multisets | ||
* | ||
* Returns: 1: success | ||
* 0: invalid parameter | ||
* Args: ctx: pointer to a context object (cannot be NULL) | ||
* In/Out: multiset: the multiset to which the input must be added | ||
* In: input: the multiset to add | ||
*/ | ||
SECP256K1_API int secp256k1_multiset_combine( | ||
const secp256k1_context* ctx, | ||
secp256k1_multiset *multiset, | ||
const secp256k1_multiset *input | ||
|
||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); | ||
|
||
|
||
/** Converts a multiset to a hash | ||
* | ||
* Returns: 1: success | ||
* 0: invalid parameter | ||
* Args: ctx: pointer to a context object (cannot be NULL) | ||
* Out: hash: the resulting 32-byte hash | ||
* In: multiset: the multiset to hash | ||
*/ | ||
SECP256K1_API int secp256k1_multiset_finalize( | ||
const secp256k1_context* ctx, | ||
unsigned char *resultHash, | ||
const secp256k1_multiset *multiset | ||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); | ||
|
||
|
||
|
||
# ifdef __cplusplus | ||
} | ||
# endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#ifndef _SECP256K1_SCHNORR_ | ||
# define _SECP256K1_SCHNORR_ | ||
|
||
# include "secp256k1.h" | ||
|
||
# ifdef __cplusplus | ||
extern "C" { | ||
# endif | ||
|
||
/** | ||
* Verify a signature created by secp256k1_schnorr_sign. | ||
* Returns: 1: correct signature | ||
* 0: incorrect signature | ||
* Args: ctx: a secp256k1 context object, initialized for verification. | ||
* In: sig64: the 64-byte signature being verified (cannot be NULL) | ||
* msg32: the 32-byte message hash being verified (cannot be NULL) | ||
* pubkey: the public key to verify with (cannot be NULL) | ||
*/ | ||
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_schnorr_verify( | ||
const secp256k1_context* ctx, | ||
const unsigned char *sig64, | ||
const unsigned char *msg32, | ||
const secp256k1_pubkey *pubkey | ||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); | ||
|
||
/** | ||
* Create a signature using a custom EC-Schnorr-SHA256 construction. It | ||
* produces non-malleable 64-byte signatures which support batch validation, | ||
* and multiparty signing. | ||
* Returns: 1: signature created | ||
* 0: the nonce generation function failed, or the private key was | ||
* invalid. | ||
* Args: ctx: pointer to a context object, initialized for signing | ||
* (cannot be NULL) | ||
* Out: sig64: pointer to a 64-byte array where the signature will be | ||
* placed (cannot be NULL) | ||
* In: msg32: the 32-byte message hash being signed (cannot be NULL) | ||
* seckey: pointer to a 32-byte secret key (cannot be NULL) | ||
* noncefp:pointer to a nonce generation function. If NULL, | ||
* secp256k1_nonce_function_default is used | ||
* ndata: pointer to arbitrary data used by the nonce generation | ||
* function (can be NULL) | ||
*/ | ||
SECP256K1_API int secp256k1_schnorr_sign( | ||
const secp256k1_context *ctx, | ||
unsigned char *sig64, | ||
const unsigned char *msg32, | ||
const unsigned char *seckey, | ||
secp256k1_nonce_function noncefp, | ||
const void *ndata | ||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); | ||
|
||
# ifdef __cplusplus | ||
} | ||
# endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.