Skip to content

Commit

Permalink
Merge #227: Use relative #include paths and tidy header guards (as in…
Browse files Browse the repository at this point in the history
… upstream)

e444d24 Fix include guards: No _ prefix/suffix but _H suffix (as in upstream) (Tim Ruffing)
0eea7d9 Use relative #include paths in tests (as in upstream) (Tim Ruffing)
c690d6d Use relative #include paths in benchmarks (as in upstream) (Tim Ruffing)
c565827 Use relative #include paths in ctime_test (as in upstream) (Tim Ruffing)
4eca406 Use relative #include paths in library (as in upstream) (Tim Ruffing)

Pull request description:

ACKs for top commit:
  apoelstra:
    ACK e444d24
  jonasnick:
    ACK e444d24

Tree-SHA512: 4d125cf75748f4a921b70ca933ee59c3cf5c0845c6960e6915a322e53840cb3a0955fe5952e654d133ad36991f3268aeee44430cbd6f7d83e333a554c436f39b
  • Loading branch information
jonasnick committed Apr 23, 2023
2 parents e7fc61f + e444d24 commit 78ed0e0
Show file tree
Hide file tree
Showing 40 changed files with 110 additions and 110 deletions.
4 changes: 2 additions & 2 deletions include/secp256k1_bppp.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _SECP256K1_BPPP_
# define _SECP256K1_BPPP_
#ifndef SECP256K1_BPPP_H
# define SECP256K1_BPPP_H

# include "secp256k1.h"

Expand Down
4 changes: 2 additions & 2 deletions include/secp256k1_generator.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _SECP256K1_GENERATOR_
# define _SECP256K1_GENERATOR_
#ifndef SECP256K1_GENERATOR_H
# define SECP256K1_GENERATOR_H

# include "secp256k1.h"

Expand Down
4 changes: 2 additions & 2 deletions include/secp256k1_rangeproof.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _SECP256K1_RANGEPROOF_
# define _SECP256K1_RANGEPROOF_
#ifndef SECP256K1_RANGEPROOF_H
# define SECP256K1_RANGEPROOF_H

# include "secp256k1.h"
# include "secp256k1_generator.h"
Expand Down
4 changes: 2 additions & 2 deletions include/secp256k1_surjectionproof.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _SECP256K1_SURJECTIONPROOF_
#define _SECP256K1_SURJECTIONPROOF_
#ifndef SECP256K1_SURJECTIONPROOF_H
#define SECP256K1_SURJECTIONPROOF_H

#include "secp256k1.h"
#include "secp256k1_rangeproof.h"
Expand Down
4 changes: 2 additions & 2 deletions include/secp256k1_whitelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef _SECP256K1_WHITELIST_
#define _SECP256K1_WHITELIST_
#ifndef SECP256K1_WHITELIST_H
#define SECP256K1_WHITELIST_H

#include "secp256k1.h"

Expand Down
2 changes: 1 addition & 1 deletion src/bench_bppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <stdint.h>

#include "include/secp256k1_bppp.h"
#include "../include/secp256k1_bppp.h"
#include "util.h"
#include "bench.h"

Expand Down
2 changes: 1 addition & 1 deletion src/bench_generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <stdint.h>
#include <string.h>

#include "include/secp256k1_generator.h"
#include "../include/secp256k1_generator.h"
#include "util.h"
#include "bench.h"

Expand Down
2 changes: 1 addition & 1 deletion src/bench_rangeproof.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <stdint.h>

#include "include/secp256k1_rangeproof.h"
#include "../include/secp256k1_rangeproof.h"
#include "util.h"
#include "bench.h"

Expand Down
4 changes: 2 additions & 2 deletions src/bench_whitelist.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
**********************************************************************/
#include <stdio.h>

#include "include/secp256k1.h"
#include "../include/secp256k1.h"

#include "include/secp256k1_whitelist.h"
#include "../include/secp256k1_whitelist.h"
#include "util.h"
#include "bench.h"
#include "hash_impl.h"
Expand Down
24 changes: 12 additions & 12 deletions src/modules/bppp/bppp_norm_product_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef _SECP256K1_MODULE_BPPP_PP_NORM_PRODUCT_
#define _SECP256K1_MODULE_BPPP_PP_NORM_PRODUCT_

#include "group.h"
#include "scalar.h"
#include "ecmult.h"
#include "ecmult_gen.h"
#include "hash.h"

#include "modules/bppp/main.h"
#include "modules/bppp/bppp_util.h"
#include "modules/bppp/bppp_transcript_impl.h"
#ifndef SECP256K1_MODULE_BPPP_PP_NORM_PRODUCT_H
#define SECP256K1_MODULE_BPPP_PP_NORM_PRODUCT_H

#include "../../group.h"
#include "../../scalar.h"
#include "../../ecmult.h"
#include "../../ecmult_gen.h"
#include "../../hash.h"

#include "../bppp/main.h"
#include "../bppp/bppp_util.h"
#include "../bppp/bppp_transcript_impl.h"

/* Computes the inner product of two vectors of scalars
* with elements starting from offset a and offset b
Expand Down
8 changes: 4 additions & 4 deletions src/modules/bppp/bppp_transcript_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
* Distributed under the MIT software license, see the accompanying *
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/
#ifndef _SECP256K1_MODULE_BPPP_PP_TRANSCRIPT_IMPL_
#define _SECP256K1_MODULE_BPPP_PP_TRANSCRIPT_IMPL_
#ifndef SECP256K1_MODULE_BPPP_PP_TRANSCRIPT_IMPL_H
#define SECP256K1_MODULE_BPPP_PP_TRANSCRIPT_IMPL_H

#include "group.h"
#include "scalar.h"
#include "../../group.h"
#include "../../scalar.h"
#include "bppp_util.h"

/* Initializes SHA256 with fixed midstate. This midstate was computed by applying
Expand Down
12 changes: 6 additions & 6 deletions src/modules/bppp/bppp_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef _SECP256K1_MODULE_BPPP_UTIL_
#define _SECP256K1_MODULE_BPPP_UTIL_
#ifndef SECP256K1_MODULE_BPPP_UTIL_H
#define SECP256K1_MODULE_BPPP_UTIL_H

#include "field.h"
#include "group.h"
#include "hash.h"
#include "eckey.h"
#include "../../field.h"
#include "../../group.h"
#include "../../hash.h"
#include "../../eckey.h"

/* Outputs a pair of points, amortizing the parity byte between them
* Assumes both points' coordinates have been normalized.
Expand Down
20 changes: 10 additions & 10 deletions src/modules/bppp/main_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef _SECP256K1_MODULE_BPPP_MAIN_
#define _SECP256K1_MODULE_BPPP_MAIN_

#include "include/secp256k1_bppp.h"
#include "include/secp256k1_generator.h"
#include "modules/generator/main_impl.h" /* for generator_{load, save} */
#include "hash.h"
#include "util.h"
#include "modules/bppp/main.h"
#include "modules/bppp/bppp_norm_product_impl.h"
#ifndef SECP256K1_MODULE_BPPP_MAIN_IMPL_H
#define SECP256K1_MODULE_BPPP_MAIN_IMPL_H

#include "../../../include/secp256k1_bppp.h"
#include "../../../include/secp256k1_generator.h"
#include "../generator/main_impl.h" /* for generator_{load, save} */
#include "../../hash.h"
#include "../../util.h"
#include "../bppp/main.h"
#include "../bppp/bppp_norm_product_impl.h"

secp256k1_bppp_generators *secp256k1_bppp_generators_create(const secp256k1_context *ctx, size_t n) {
secp256k1_bppp_generators *ret;
Expand Down
6 changes: 3 additions & 3 deletions src/modules/bppp/tests_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef _SECP256K1_MODULE_BPPP_TEST_
#define _SECP256K1_MODULE_BPPP_TEST_
#ifndef SECP256K1_MODULE_BPPP_TEST_H
#define SECP256K1_MODULE_BPPP_TEST_H

#include <stdint.h>

#include "include/secp256k1_bppp.h"
#include "../../../include/secp256k1_bppp.h"
#include "bppp_norm_product_impl.h"
#include "bppp_util.h"
#include "bppp_transcript_impl.h"
Expand Down
4 changes: 2 additions & 2 deletions src/modules/extrakeys/hsort.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* file COPYING or https://www.opensource.org/licenses/mit-license.php.*
***********************************************************************/

#ifndef SECP256K1_HSORT_H_
#define SECP256K1_HSORT_H_
#ifndef SECP256K1_HSORT_H
#define SECP256K1_HSORT_H

#include <stddef.h>
#include <string.h>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/extrakeys/hsort_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* file COPYING or https://www.opensource.org/licenses/mit-license.php.*
***********************************************************************/

#ifndef SECP256K1_HSORT_IMPL_H_
#define SECP256K1_HSORT_IMPL_H_
#ifndef SECP256K1_HSORT_IMPL_H
#define SECP256K1_HSORT_IMPL_H

#include "hsort.h"

Expand Down
2 changes: 1 addition & 1 deletion src/modules/extrakeys/tests_exhaustive_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#ifndef SECP256K1_MODULE_EXTRAKEYS_TESTS_EXHAUSTIVE_H
#define SECP256K1_MODULE_EXTRAKEYS_TESTS_EXHAUSTIVE_H

#include "src/modules/extrakeys/main_impl.h"
#include "../../../include/secp256k1_extrakeys.h"
#include "main_impl.h"

static void test_exhaustive_extrakeys(const secp256k1_context *ctx, const secp256k1_ge* group) {
secp256k1_keypair keypair[EXHAUSTIVE_TEST_ORDER - 1];
Expand Down
6 changes: 3 additions & 3 deletions src/modules/generator/main_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef SECP256K1_MODULE_GENERATOR_MAIN
#define SECP256K1_MODULE_GENERATOR_MAIN
#ifndef SECP256K1_MODULE_GENERATOR_MAIN_H
#define SECP256K1_MODULE_GENERATOR_MAIN_H

#include <stdio.h>

Expand All @@ -14,7 +14,7 @@
#include "../../hash.h"
#include "../../scalar.h"

#include "modules/generator/pedersen_impl.h"
#include "../generator/pedersen_impl.h"

/** Alternative generator for secp256k1.
* This is the sha256 of 'g' after standard encoding (without compression),
Expand Down
4 changes: 2 additions & 2 deletions src/modules/generator/pedersen.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef _SECP256K1_PEDERSEN_H_
#define _SECP256K1_PEDERSEN_H_
#ifndef SECP256K1_PEDERSEN_H
#define SECP256K1_PEDERSEN_H

#include "../../ecmult_gen.h"
#include "../../group.h"
Expand Down
4 changes: 2 additions & 2 deletions src/modules/generator/pedersen_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php. *
***********************************************************************/

#ifndef _SECP256K1_PEDERSEN_IMPL_H_
#define _SECP256K1_PEDERSEN_IMPL_H_
#ifndef SECP256K1_PEDERSEN_IMPL_H
#define SECP256K1_PEDERSEN_IMPL_H

#include <string.h>

Expand Down
4 changes: 2 additions & 2 deletions src/modules/generator/tests_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef SECP256K1_MODULE_GENERATOR_TESTS
#define SECP256K1_MODULE_GENERATOR_TESTS
#ifndef SECP256K1_MODULE_GENERATOR_TESTS_H
#define SECP256K1_MODULE_GENERATOR_TESTS_H

#include <string.h>
#include <stdio.h>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/musig/main_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef SECP256K1_MODULE_MUSIG_MAIN
#define SECP256K1_MODULE_MUSIG_MAIN
#ifndef SECP256K1_MODULE_MUSIG_MAIN_H
#define SECP256K1_MODULE_MUSIG_MAIN_H

#include "keyagg_impl.h"
#include "session_impl.h"
Expand Down
4 changes: 2 additions & 2 deletions src/modules/rangeproof/borromean.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
**********************************************************************/


#ifndef _SECP256K1_BORROMEAN_H_
#define _SECP256K1_BORROMEAN_H_
#ifndef SECP256K1_BORROMEAN_H
#define SECP256K1_BORROMEAN_H

#include "../../scalar.h"
#include "../../field.h"
Expand Down
4 changes: 2 additions & 2 deletions src/modules/rangeproof/borromean_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
**********************************************************************/


#ifndef _SECP256K1_BORROMEAN_IMPL_H_
#define _SECP256K1_BORROMEAN_IMPL_H_
#ifndef SECP256K1_BORROMEAN_IMPL_H
#define SECP256K1_BORROMEAN_IMPL_H

#include "../../scalar.h"
#include "../../field.h"
Expand Down
10 changes: 5 additions & 5 deletions src/modules/rangeproof/main_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef SECP256K1_MODULE_RANGEPROOF_MAIN
#define SECP256K1_MODULE_RANGEPROOF_MAIN
#ifndef SECP256K1_MODULE_RANGEPROOF_MAIN_H
#define SECP256K1_MODULE_RANGEPROOF_MAIN_H

#include "../../group.h"

#include "modules/generator/main_impl.h"
#include "modules/rangeproof/borromean_impl.h"
#include "modules/rangeproof/rangeproof_impl.h"
#include "../generator/main_impl.h"
#include "../rangeproof/borromean_impl.h"
#include "../rangeproof/rangeproof_impl.h"

int secp256k1_rangeproof_info(const secp256k1_context* ctx, int *exp, int *mantissa,
uint64_t *min_value, uint64_t *max_value, const unsigned char *proof, size_t plen) {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/rangeproof/rangeproof.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef _SECP256K1_RANGEPROOF_H_
#define _SECP256K1_RANGEPROOF_H_
#ifndef SECP256K1_RANGEPROOF_H
#define SECP256K1_RANGEPROOF_H

#include "../../scalar.h"
#include "../../group.h"
Expand Down
10 changes: 5 additions & 5 deletions src/modules/rangeproof/rangeproof_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef _SECP256K1_RANGEPROOF_IMPL_H_
#define _SECP256K1_RANGEPROOF_IMPL_H_
#ifndef SECP256K1_RANGEPROOF_IMPL_H
#define SECP256K1_RANGEPROOF_IMPL_H

#include "../../eckey.h"
#include "../../scalar.h"
#include "../../group.h"
#include "../../hash_impl.h"
#include "../../util.h"

#include "modules/generator/pedersen.h"
#include "modules/rangeproof/borromean.h"
#include "modules/rangeproof/rangeproof.h"
#include "../generator/pedersen.h"
#include "../rangeproof/borromean.h"
#include "../rangeproof/rangeproof.h"

SECP256K1_INLINE static void secp256k1_rangeproof_pub_expand(secp256k1_gej *pubs,
int exp, size_t *rsizes, size_t rings, const secp256k1_ge* genp) {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/rangeproof/tests_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#ifndef SECP256K1_MODULE_RANGEPROOF_TESTS
#define SECP256K1_MODULE_RANGEPROOF_TESTS
#ifndef SECP256K1_MODULE_RANGEPROOF_TESTS_H
#define SECP256K1_MODULE_RANGEPROOF_TESTS_H

#include <string.h>

Expand Down
2 changes: 1 addition & 1 deletion src/modules/recovery/tests_exhaustive_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef SECP256K1_MODULE_RECOVERY_EXHAUSTIVE_TESTS_H
#define SECP256K1_MODULE_RECOVERY_EXHAUSTIVE_TESTS_H

#include "src/modules/recovery/main_impl.h"
#include "main_impl.h"
#include "../../../include/secp256k1_recovery.h"

void test_exhaustive_recovery_sign(const secp256k1_context *ctx, const secp256k1_ge *group) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/schnorrsig/tests_exhaustive_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define SECP256K1_MODULE_SCHNORRSIG_TESTS_EXHAUSTIVE_H

#include "../../../include/secp256k1_schnorrsig.h"
#include "src/modules/schnorrsig/main_impl.h"
#include "main_impl.h"

static const unsigned char invalid_pubkey_bytes[][32] = {
/* 0 */
Expand Down
Loading

0 comments on commit 78ed0e0

Please sign in to comment.