Skip to content

Commit 3efeb9d

Browse files
committed
Merge #1121: config: Set preprocessor defaults for ECMULT_* config values
c27ae45 config: Remove basic-config.h (Tim Ruffing) da6514a config: Introduce DEBUG_CONFIG macro for debug output of config (Tim Ruffing) d0cf55e config: Set preprocessor defaults for ECMULT_* config values (Tim Ruffing) Pull request description: ACKs for top commit: sipa: ACK c27ae45 hebasto: ACK c27ae45, I have reviewed the code and it looks correct. jonasnick: ACK c27ae45 Tree-SHA512: 56b0f384bd9f42cf7c903bec08f4807db1415ddf9a06676dfe1e638e4d02431c522ef0422585e85429074e0dbb51da4f400cf53e8f883d6e07122731c57be1e3
2 parents 6a873cc + c27ae45 commit 3efeb9d

File tree

5 files changed

+28
-18
lines changed

5 files changed

+28
-18
lines changed

Makefile.am

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ noinst_HEADERS += src/hash_impl.h
5858
noinst_HEADERS += src/field.h
5959
noinst_HEADERS += src/field_impl.h
6060
noinst_HEADERS += src/bench.h
61-
noinst_HEADERS += src/basic-config.h
6261
noinst_HEADERS += contrib/lax_der_parsing.h
6362
noinst_HEADERS += contrib/lax_der_parsing.c
6463
noinst_HEADERS += contrib/lax_der_privatekey_parsing.h

src/basic-config.h

-17
This file was deleted.

src/ecmult.h

+11
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
#include "scalar.h"
1212
#include "scratch.h"
1313

14+
#ifndef ECMULT_WINDOW_SIZE
15+
# define ECMULT_WINDOW_SIZE 15
16+
# ifdef DEBUG_CONFIG
17+
# pragma message DEBUG_CONFIG_MSG("ECMULT_WINDOW_SIZE undefined, assuming default value")
18+
# endif
19+
#endif
20+
21+
#ifdef DEBUG_CONFIG
22+
# pragma message DEBUG_CONFIG_DEF(ECMULT_WINDOW_SIZE)
23+
#endif
24+
1425
/* Noone will ever need more than a window size of 24. The code might
1526
* be correct for larger values of ECMULT_WINDOW_SIZE but this is not
1627
* tested.

src/ecmult_gen.h

+12
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,21 @@
1010
#include "scalar.h"
1111
#include "group.h"
1212

13+
#ifndef ECMULT_GEN_PREC_BITS
14+
# define ECMULT_GEN_PREC_BITS 4
15+
# ifdef DEBUG_CONFIG
16+
# pragma message DEBUG_CONFIG_MSG("ECMULT_GEN_PREC_BITS undefined, assuming default value")
17+
# endif
18+
#endif
19+
20+
#ifdef DEBUG_CONFIG
21+
# pragma message DEBUG_CONFIG_DEF(ECMULT_GEN_PREC_BITS)
22+
#endif
23+
1324
#if ECMULT_GEN_PREC_BITS != 2 && ECMULT_GEN_PREC_BITS != 4 && ECMULT_GEN_PREC_BITS != 8
1425
# error "Set ECMULT_GEN_PREC_BITS to 2, 4 or 8."
1526
#endif
27+
1628
#define ECMULT_GEN_PREC_G(bits) (1 << bits)
1729
#define ECMULT_GEN_PREC_N(bits) (256 / bits)
1830

src/util.h

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
#include <stdio.h>
1717
#include <limits.h>
1818

19+
#define STR_(x) #x
20+
#define STR(x) STR_(x)
21+
#define DEBUG_CONFIG_MSG(x) "DEBUG_CONFIG: " x
22+
#define DEBUG_CONFIG_DEF(x) DEBUG_CONFIG_MSG(#x "=" STR(x))
23+
1924
typedef struct {
2025
void (*fn)(const char *text, void* data);
2126
const void* data;

0 commit comments

Comments
 (0)