PRCYCoin  2.0.0.7rc1
P2P Digital Currency
secp256k1.h
Go to the documentation of this file.
1 #ifndef _SECP256K1_
2 # define _SECP256K1_
3 
4 # ifdef __cplusplus
5 extern "C" {
6 # endif
7 
8 # if !defined(SECP256K1_GNUC_PREREQ)
9 # if defined(__GNUC__)&&defined(__GNUC_MINOR__)
10 # define SECP256K1_GNUC_PREREQ(_maj,_min) \
11  ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min))
12 # else
13 # define SECP256K1_GNUC_PREREQ(_maj,_min) 0
14 # endif
15 # endif
16 
17 # if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
18 # if SECP256K1_GNUC_PREREQ(2,7)
19 # define SECP256K1_INLINE __inline__
20 # elif (defined(_MSC_VER))
21 # define SECP256K1_INLINE __inline
22 # else
23 # define SECP256K1_INLINE
24 # endif
25 # else
26 # define SECP256K1_INLINE inline
27 # endif
28 
32 # if defined(__GNUC__) && SECP256K1_GNUC_PREREQ(3, 4)
33 # define SECP256K1_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__))
34 # else
35 # define SECP256K1_WARN_UNUSED_RESULT
36 # endif
37 # if !defined(SECP256K1_BUILD) && defined(__GNUC__) && SECP256K1_GNUC_PREREQ(3, 4)
38 # define SECP256K1_ARG_NONNULL(_x) __attribute__ ((__nonnull__(_x)))
39 # else
40 # define SECP256K1_ARG_NONNULL(_x)
41 # endif
42 
43 
45 # define SECP256K1_START_VERIFY (1 << 0)
46 # define SECP256K1_START_SIGN (1 << 1)
47 
53 void secp256k1_start(unsigned int flags);
54 
58 void secp256k1_stop(void);
59 
74  const unsigned char *msg,
75  int msglen,
76  const unsigned char *sig,
77  int siglen,
78  const unsigned char *pubkey,
79  int pubkeylen
81 
95  const unsigned char *msg,
96  int msglen,
97  unsigned char *sig,
98  int *siglen,
99  const unsigned char *seckey,
100  const unsigned char *nonce
102 
115  const unsigned char *msg,
116  int msglen,
117  unsigned char *sig64,
118  const unsigned char *seckey,
119  const unsigned char *nonce,
120  int *recid
122 
136  const unsigned char *msg,
137  int msglen,
138  const unsigned char *sig64,
139  unsigned char *pubkey,
140  int *pubkeylen,
141  int compressed,
142  int recid
144 
151 
158 SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_verify(const unsigned char *pubkey, int pubkeylen) SECP256K1_ARG_NONNULL(1);
159 
172  unsigned char *pubkey,
173  int *pubkeylen,
174  const unsigned char *seckey,
175  int compressed
177 
187  unsigned char *pubkey,
188  int *pubkeylen
190 
193  const unsigned char *seckey,
194  unsigned char *privkey,
195  int *privkeylen,
196  int compressed
198 
201  unsigned char *seckey,
202  const unsigned char *privkey,
203  int privkeylen
205 
208  unsigned char *seckey,
209  const unsigned char *tweak
211 
216  unsigned char *pubkey,
217  int pubkeylen,
218  const unsigned char *tweak
220 
223  unsigned char *seckey,
224  const unsigned char *tweak
226 
231  unsigned char *pubkey,
232  int pubkeylen,
233  const unsigned char *tweak
235 
236 # ifdef __cplusplus
237 }
238 # endif
239 
240 #endif
secp256k1_start
void secp256k1_start(unsigned int flags)
Initialize the library.
Definition: secp256k1.c:21
secp256k1_ec_pubkey_verify
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_verify(const unsigned char *pubkey, int pubkeylen) SECP256K1_ARG_NONNULL(1)
Just validate a public key.
Definition: secp256k1.c:184
secp256k1_ec_seckey_verify
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_verify(const unsigned char *seckey) SECP256K1_ARG_NONNULL(1)
Verify an ECDSA secret key.
Definition: secp256k1.c:173
secp256k1_ec_privkey_tweak_mul
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul(unsigned char *seckey, const unsigned char *tweak) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
Tweak a private key by multiplying it with tweak.
Definition: secp256k1.c:262
flags
int flags
Definition: prcycoin-tx.cpp:297
secp256k1_ecdsa_recover_compact
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_recover_compact(const unsigned char *msg, int msglen, const unsigned char *sig64, unsigned char *pubkey, int *pubkeylen, int compressed, int recid) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5)
Recover an ECDSA public key from a compact signature.
Definition: secp256k1.c:141
secp256k1_ecdsa_sign_compact
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_sign_compact(const unsigned char *msg, int msglen, unsigned char *sig64, const unsigned char *seckey, const unsigned char *nonce, int *recid) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5)
Create a compact ECDSA signature (64 byte + recovery id).
Definition: secp256k1.c:108
secp256k1_ec_pubkey_create
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create(unsigned char *pubkey, int *pubkeylen, const unsigned char *seckey, int compressed) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Compute the public key for a secret key.
Definition: secp256k1.c:191
secp256k1_ecdsa_sign
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_sign(const unsigned char *msg, int msglen, unsigned char *sig, int *siglen, const unsigned char *seckey, const unsigned char *nonce) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(6)
Create an ECDSA signature.
Definition: secp256k1.c:75
secp256k1_ec_pubkey_tweak_mul
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_mul(unsigned char *pubkey, int pubkeylen, const unsigned char *tweak) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3)
Tweak a public key by multiplying it with tweak.
Definition: secp256k1.c:281
secp256k1_ec_pubkey_decompress
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_decompress(unsigned char *pubkey, int *pubkeylen) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
Decompress a public key.
Definition: secp256k1.c:207
secp256k1_ec_privkey_import
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_import(unsigned char *seckey, const unsigned char *privkey, int privkeylen) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
Import a private key in DER format.
Definition: secp256k1.c:318
secp256k1_ecdsa_verify
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_verify(const unsigned char *msg, int msglen, const unsigned char *sig, int siglen, const unsigned char *pubkey, int pubkeylen) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(5)
Verify an ECDSA signature.
Definition: secp256k1.c:43
SECP256K1_WARN_UNUSED_RESULT
#define SECP256K1_WARN_UNUSED_RESULT
Warning attributes NONNULL is not used if SECP256K1_BUILD is set to avoid the compiler optimizing out...
Definition: secp256k1.h:35
secp256k1_ec_privkey_tweak_add
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add(unsigned char *seckey, const unsigned char *tweak) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2)
Tweak a private key by adding tweak to it.
Definition: secp256k1.c:217
SECP256K1_ARG_NONNULL
#define SECP256K1_ARG_NONNULL(_x)
Definition: secp256k1.h:40
secp256k1_ec_pubkey_tweak_add
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add(unsigned char *pubkey, int pubkeylen, const unsigned char *tweak) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3)
Tweak a public key by adding tweak times the generator to it.
Definition: secp256k1.c:237
secp256k1_stop
void secp256k1_stop(void)
Free all memory associated with this library.
Definition: secp256k1.c:34
secp256k1_ec_privkey_export
SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_export(const unsigned char *seckey, unsigned char *privkey, int *privkeylen, int compressed) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3)
Export a private key in DER format.
Definition: secp256k1.c:306