Skip to content

Commit fd86f99

Browse files
author
MarcoFalke
committed
Squashed 'src/secp256k1/' changes from 84973d393..0b7024185
0b7024185 Merge ElementsProject#474: Fix header guards using reserved identifiers ab1f89f00 Merge ElementsProject#478: Fixed multiple typos 8c7ea22d5 Fixed multiple typos abe2d3e84 Fix header guards using reserved identifiers f532bdc9f Merge ElementsProject#459: Add pubkey prefix constants to include/secp256k1.h cac7c5559 Merge ElementsProject#470: Fix wnaf_const documentation 768514bac Fix wnaf_const documentation with respect to return value and number of words set b8c26a399 Merge ElementsProject#458: Fix typo in API documentation 817fb2013 Merge ElementsProject#440: Fix typos 12230f90e Merge ElementsProject#468: Remove redundant conditional expression 2e1ccdca0 Remove redundant conditional expression bc61b91ac add pubkey prefix constants to include/secp256k1.h b0452e664 Fix typo in API documentation 4c0f32ed5 Fix typo: "Agressive" → "Aggressive" 73aca8364 Fix typo: "exectured" → "executed" git-subtree-dir: src/secp256k1 git-subtree-split: 0b7024185045a49a1a6a4c5615bf31c94f63d9c4
1 parent e7c1b44 commit fd86f99

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

+187
-178
lines changed

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 */

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 */

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 */

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 */

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 */

sage/group_prover.sage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# to independently set assumptions on input or intermediary variables.
44
#
55
# The general approach is:
6-
# * A constraint is a tuple of two sets of of symbolic expressions:
6+
# * A constraint is a tuple of two sets of symbolic expressions:
77
# the first of which are required to evaluate to zero, the second of which
88
# are required to evaluate to nonzero.
99
# - A constraint is said to be conflicting if any of its nonzero expressions
@@ -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/asm/field_10x26_arm.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Note:
1111

1212
- To avoid unnecessary loads and make use of available registers, two
1313
'passes' have every time been interleaved, with the odd passes accumulating c' and d'
14-
which will be added to c and d respectively in the the even passes
14+
which will be added to c and d respectively in the even passes
1515

1616
*/
1717

@@ -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/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/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/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)