Skip to content

Commit 9ccafb1

Browse files
author
MarcoFalke
committed
Merge #11421: Merge current secp256k1 subtree
fd86f99 Squashed 'src/secp256k1/' changes from 84973d393..0b7024185 (MarcoFalke) Pull request description: The subtree should now match upstream again. Check with: ```sh ./contrib/devtools/git-subtree-check.sh src/secp256k1 ``` The changes are only documentation/refactoring related. Tree-SHA512: 43e8a95bcbfefef9e19ec38a92d2d57fdd4a16ddf726e036d36a0d806eb6f35b45b40ee69f980430e107895ec8725b5de4e36456b026214675e0b19630bb6fe9
2 parents 093074b + 999968e commit 9ccafb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+185
-176
lines changed

src/secp256k1/contrib/lax_der_parsing.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@
4848
* 8.3.1.
4949
*/
5050

51-
#ifndef _SECP256K1_CONTRIB_LAX_DER_PARSING_H_
52-
#define _SECP256K1_CONTRIB_LAX_DER_PARSING_H_
51+
#ifndef SECP256K1_CONTRIB_LAX_DER_PARSING_H
52+
#define SECP256K1_CONTRIB_LAX_DER_PARSING_H
5353

5454
#include <secp256k1.h>
5555

56-
# ifdef __cplusplus
56+
#ifdef __cplusplus
5757
extern "C" {
58-
# endif
58+
#endif
5959

6060
/** Parse a signature in "lax DER" format
6161
*
@@ -88,4 +88,4 @@ int ecdsa_signature_parse_der_lax(
8888
}
8989
#endif
9090

91-
#endif
91+
#endif /* SECP256K1_CONTRIB_LAX_DER_PARSING_H */

src/secp256k1/contrib/lax_der_privatekey_parsing.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
* library are sufficient.
2626
*/
2727

28-
#ifndef _SECP256K1_CONTRIB_BER_PRIVATEKEY_H_
29-
#define _SECP256K1_CONTRIB_BER_PRIVATEKEY_H_
28+
#ifndef SECP256K1_CONTRIB_BER_PRIVATEKEY_H
29+
#define SECP256K1_CONTRIB_BER_PRIVATEKEY_H
3030

3131
#include <secp256k1.h>
3232

33-
# ifdef __cplusplus
33+
#ifdef __cplusplus
3434
extern "C" {
35-
# endif
35+
#endif
3636

3737
/** Export a private key in DER format.
3838
*
@@ -87,4 +87,4 @@ SECP256K1_WARN_UNUSED_RESULT int ec_privkey_import_der(
8787
}
8888
#endif
8989

90-
#endif
90+
#endif /* SECP256K1_CONTRIB_BER_PRIVATEKEY_H */

src/secp256k1/include/secp256k1.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#ifndef _SECP256K1_
2-
# define _SECP256K1_
1+
#ifndef SECP256K1_H
2+
#define SECP256K1_H
33

4-
# ifdef __cplusplus
4+
#ifdef __cplusplus
55
extern "C" {
6-
# endif
6+
#endif
77

88
#include <stddef.h>
99

@@ -61,7 +61,7 @@ typedef struct {
6161
* however guaranteed to be 64 bytes in size, and can be safely copied/moved.
6262
* If you need to convert to a format suitable for storage, transmission, or
6363
* comparison, use the secp256k1_ecdsa_signature_serialize_* and
64-
* secp256k1_ecdsa_signature_serialize_* functions.
64+
* secp256k1_ecdsa_signature_parse_* functions.
6565
*/
6666
typedef struct {
6767
unsigned char data[64];
@@ -159,6 +159,13 @@ typedef int (*secp256k1_nonce_function)(
159159
#define SECP256K1_EC_COMPRESSED (SECP256K1_FLAGS_TYPE_COMPRESSION | SECP256K1_FLAGS_BIT_COMPRESSION)
160160
#define SECP256K1_EC_UNCOMPRESSED (SECP256K1_FLAGS_TYPE_COMPRESSION)
161161

162+
/** Prefix byte used to tag various encoded curvepoints for specific purposes */
163+
#define SECP256K1_TAG_PUBKEY_EVEN 0x02
164+
#define SECP256K1_TAG_PUBKEY_ODD 0x03
165+
#define SECP256K1_TAG_PUBKEY_UNCOMPRESSED 0x04
166+
#define SECP256K1_TAG_PUBKEY_HYBRID_EVEN 0x06
167+
#define SECP256K1_TAG_PUBKEY_HYBRID_ODD 0x07
168+
162169
/** Create a secp256k1 context object.
163170
*
164171
* Returns: a newly created context object.
@@ -607,8 +614,8 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_combine(
607614
size_t n
608615
) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);
609616

610-
# ifdef __cplusplus
617+
#ifdef __cplusplus
611618
}
612-
# endif
613-
614619
#endif
620+
621+
#endif /* SECP256K1_H */

src/secp256k1/include/secp256k1_ecdh.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#ifndef _SECP256K1_ECDH_
2-
# define _SECP256K1_ECDH_
1+
#ifndef SECP256K1_ECDH_H
2+
#define SECP256K1_ECDH_H
33

4-
# include "secp256k1.h"
4+
#include "secp256k1.h"
55

6-
# ifdef __cplusplus
6+
#ifdef __cplusplus
77
extern "C" {
8-
# endif
8+
#endif
99

1010
/** Compute an EC Diffie-Hellman secret in constant time
1111
* Returns: 1: exponentiation was successful
@@ -24,8 +24,8 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh(
2424
const unsigned char *privkey
2525
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4);
2626

27-
# ifdef __cplusplus
27+
#ifdef __cplusplus
2828
}
29-
# endif
30-
3129
#endif
30+
31+
#endif /* SECP256K1_ECDH_H */

src/secp256k1/include/secp256k1_recovery.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#ifndef _SECP256K1_RECOVERY_
2-
# define _SECP256K1_RECOVERY_
1+
#ifndef SECP256K1_RECOVERY_H
2+
#define SECP256K1_RECOVERY_H
33

4-
# include "secp256k1.h"
4+
#include "secp256k1.h"
55

6-
# ifdef __cplusplus
6+
#ifdef __cplusplus
77
extern "C" {
8-
# endif
8+
#endif
99

1010
/** Opaque data structured that holds a parsed ECDSA signature,
1111
* supporting pubkey recovery.
@@ -103,8 +103,8 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_recover(
103103
const unsigned char *msg32
104104
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4);
105105

106-
# ifdef __cplusplus
106+
#ifdef __cplusplus
107107
}
108-
# endif
109-
110108
#endif
109+
110+
#endif /* SECP256K1_RECOVERY_H */

src/secp256k1/sage/group_prover.sage

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# - A constraint describing the requirements of the law, called "require"
1818
# * Implementations are transliterated into functions that operate as well on
1919
# algebraic input points, and are called once per combination of branches
20-
# exectured. Each execution returns:
20+
# executed. Each execution returns:
2121
# - A constraint describing the assumptions this implementation requires
2222
# (such as Z1=1), called "assumeFormula"
2323
# - A constraint describing the assumptions this specific branch requires,

src/secp256k1/src/asm/field_10x26_arm.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Note:
2323
.eabi_attribute 10, 0 @ Tag_FP_arch = none
2424
.eabi_attribute 24, 1 @ Tag_ABI_align_needed = 8-byte
2525
.eabi_attribute 25, 1 @ Tag_ABI_align_preserved = 8-byte, except leaf SP
26-
.eabi_attribute 30, 2 @ Tag_ABI_optimization_goals = Agressive Speed
26+
.eabi_attribute 30, 2 @ Tag_ABI_optimization_goals = Aggressive Speed
2727
.eabi_attribute 34, 1 @ Tag_CPU_unaligned_access = v6
2828
.text
2929

src/secp256k1/src/basic-config.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
55
**********************************************************************/
66

7-
#ifndef _SECP256K1_BASIC_CONFIG_
8-
#define _SECP256K1_BASIC_CONFIG_
7+
#ifndef SECP256K1_BASIC_CONFIG_H
8+
#define SECP256K1_BASIC_CONFIG_H
99

1010
#ifdef USE_BASIC_CONFIG
1111

@@ -28,5 +28,6 @@
2828
#define USE_FIELD_10X26 1
2929
#define USE_SCALAR_8X32 1
3030

31-
#endif // USE_BASIC_CONFIG
32-
#endif // _SECP256K1_BASIC_CONFIG_
31+
#endif /* USE_BASIC_CONFIG */
32+
33+
#endif /* SECP256K1_BASIC_CONFIG_H */

src/secp256k1/src/bench.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
55
**********************************************************************/
66

7-
#ifndef _SECP256K1_BENCH_H_
8-
#define _SECP256K1_BENCH_H_
7+
#ifndef SECP256K1_BENCH_H
8+
#define SECP256K1_BENCH_H
99

1010
#include <stdio.h>
1111
#include <math.h>
@@ -63,4 +63,4 @@ void run_benchmark(char *name, void (*benchmark)(void*), void (*setup)(void*), v
6363
printf("us\n");
6464
}
6565

66-
#endif
66+
#endif /* SECP256K1_BENCH_H */

src/secp256k1/src/ecdsa.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
55
**********************************************************************/
66

7-
#ifndef _SECP256K1_ECDSA_
8-
#define _SECP256K1_ECDSA_
7+
#ifndef SECP256K1_ECDSA_H
8+
#define SECP256K1_ECDSA_H
99

1010
#include <stddef.h>
1111

@@ -18,4 +18,4 @@ static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const
1818
static int secp256k1_ecdsa_sig_verify(const secp256k1_ecmult_context *ctx, const secp256k1_scalar* r, const secp256k1_scalar* s, const secp256k1_ge *pubkey, const secp256k1_scalar *message);
1919
static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, secp256k1_scalar* r, secp256k1_scalar* s, const secp256k1_scalar *seckey, const secp256k1_scalar *message, const secp256k1_scalar *nonce, int *recid);
2020

21-
#endif
21+
#endif /* SECP256K1_ECDSA_H */

0 commit comments

Comments
 (0)