Merge pull request #2 from sipa/impl

Move implementations from impl/*.h to *_impl.h
This commit is contained in:
Pieter Wuille 2014-03-12 18:40:41 +01:00
commit 8b3263b638
18 changed files with 57 additions and 59 deletions

View File

@ -7,30 +7,30 @@ libsecp256k1_la_LIBADD = $(SECP_LIBS)
include_HEADERS = include/secp256k1.h include_HEADERS = include/secp256k1.h
noinst_HEADERS = noinst_HEADERS =
noinst_HEADERS += src/group.h noinst_HEADERS += src/group.h
noinst_HEADERS += src/group_impl.h
noinst_HEADERS += src/num_openssl.h noinst_HEADERS += src/num_openssl.h
noinst_HEADERS += src/num_openssl_impl.h
noinst_HEADERS += src/num_gmp.h noinst_HEADERS += src/num_gmp.h
noinst_HEADERS += src/num_gmp_impl.h
noinst_HEADERS += src/ecdsa.h noinst_HEADERS += src/ecdsa.h
noinst_HEADERS += src/ecdsa_impl.h
noinst_HEADERS += src/ecmult.h noinst_HEADERS += src/ecmult.h
noinst_HEADERS += src/ecmult_impl.h
noinst_HEADERS += src/num.h noinst_HEADERS += src/num.h
noinst_HEADERS += src/num_impl.h
noinst_HEADERS += src/field_10x26.h noinst_HEADERS += src/field_10x26.h
noinst_HEADERS += src/field_10x26_impl.h
noinst_HEADERS += src/field_5x52.h noinst_HEADERS += src/field_5x52.h
noinst_HEADERS += src/field_5x52_impl.h
noinst_HEADERS += src/field_5x52_int128_impl.h
noinst_HEADERS += src/field_5x52_asm_impl.h
noinst_HEADERS += src/java/org_bitcoin_NativeSecp256k1.h noinst_HEADERS += src/java/org_bitcoin_NativeSecp256k1.h
noinst_HEADERS += src/util.h noinst_HEADERS += src/util.h
noinst_HEADERS += src/util_impl.h
noinst_HEADERS += src/field_gmp.h noinst_HEADERS += src/field_gmp.h
noinst_HEADERS += src/impl/group.h noinst_HEADERS += src/field_gmp_impl.h
noinst_HEADERS += src/impl/num_openssl.h
noinst_HEADERS += src/impl/num_gmp.h
noinst_HEADERS += src/impl/ecdsa.h
noinst_HEADERS += src/impl/field_5x52_int128.h
noinst_HEADERS += src/impl/ecmult.h
noinst_HEADERS += src/impl/num.h
noinst_HEADERS += src/impl/field_10x26.h
noinst_HEADERS += src/impl/field_5x52.h
noinst_HEADERS += src/impl/util.h
noinst_HEADERS += src/impl/field_gmp.h
noinst_HEADERS += src/impl/field_5x52_asm.h
noinst_HEADERS += src/impl/field.h
noinst_HEADERS += src/field.h noinst_HEADERS += src/field.h
noinst_HEADERS += src/field_impl.h
if USE_ASM if USE_ASM
libsecp256k1_la_SOURCES += src/field_5x52_asm.asm libsecp256k1_la_SOURCES += src/field_5x52_asm.asm

View File

@ -4,12 +4,12 @@
#include <stdio.h> #include <stdio.h>
#include "impl/num.h" #include "num_impl.h"
#include "impl/field.h" #include "field_impl.h"
#include "impl/group.h" #include "group_impl.h"
#include "impl/ecmult.h" #include "ecmult_impl.h"
#include "impl/ecdsa.h" #include "ecdsa_impl.h"
#include "impl/util.h" #include "util_impl.h"
void random_num_order(secp256k1_num_t *num) { void random_num_order(secp256k1_num_t *num) {
do { do {

View File

@ -5,11 +5,11 @@
#ifndef _SECP256K1_ECDSA_IMPL_H_ #ifndef _SECP256K1_ECDSA_IMPL_H_
#define _SECP256K1_ECDSA_IMPL_H_ #define _SECP256K1_ECDSA_IMPL_H_
#include "../num.h" #include "num.h"
#include "../field.h" #include "field.h"
#include "../group.h" #include "group.h"
#include "../ecmult.h" #include "ecmult.h"
#include "../ecdsa.h" #include "ecdsa.h"
void static secp256k1_ecdsa_sig_init(secp256k1_ecdsa_sig_t *r) { void static secp256k1_ecdsa_sig_init(secp256k1_ecdsa_sig_t *r) {
secp256k1_num_init(&r->r); secp256k1_num_init(&r->r);

View File

@ -5,9 +5,9 @@
#ifndef _SECP256K1_ECMULT_IMPL_H_ #ifndef _SECP256K1_ECMULT_IMPL_H_
#define _SECP256K1_ECMULT_IMPL_H_ #define _SECP256K1_ECMULT_IMPL_H_
#include "../num.h" #include "num.h"
#include "../group.h" #include "group.h"
#include "../ecmult.h" #include "ecmult.h"
// optimal for 128-bit and 256-bit exponents. // optimal for 128-bit and 256-bit exponents.
#define WINDOW_A 5 #define WINDOW_A 5

View File

@ -8,8 +8,8 @@
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include "../num.h" #include "num.h"
#include "../field.h" #include "field.h"
void static secp256k1_fe_inner_start(void) {} void static secp256k1_fe_inner_start(void) {}
void static secp256k1_fe_inner_stop(void) {} void static secp256k1_fe_inner_stop(void) {}

View File

@ -11,13 +11,13 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include "../num.h" #include "num.h"
#include "../field.h" #include "field.h"
#if defined(USE_FIELD_5X52_ASM) #if defined(USE_FIELD_5X52_ASM)
#include "field_5x52_asm.h" #include "field_5x52_asm_impl.h"
#elif defined(USE_FIELD_5X52_INT128) #elif defined(USE_FIELD_5X52_INT128)
#include "field_5x52_int128.h" #include "field_5x52_int128_impl.h"
#else #else
#error "Please select field_5x52 implementation" #error "Please select field_5x52 implementation"
#endif #endif

View File

@ -8,8 +8,8 @@
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include "../num.h" #include "num.h"
#include "../field.h" #include "field.h"
static mp_limb_t secp256k1_field_p[FIELD_LIMBS]; static mp_limb_t secp256k1_field_p[FIELD_LIMBS];
static mp_limb_t secp256k1_field_pc[(33+GMP_NUMB_BITS-1)/GMP_NUMB_BITS]; static mp_limb_t secp256k1_field_pc[(33+GMP_NUMB_BITS-1)/GMP_NUMB_BITS];

View File

@ -10,11 +10,11 @@
#endif #endif
#if defined(USE_FIELD_GMP) #if defined(USE_FIELD_GMP)
#include "field_gmp.h" #include "field_gmp_impl.h"
#elif defined(USE_FIELD_10X26) #elif defined(USE_FIELD_10X26)
#include "field_10x26.h" #include "field_10x26_impl.h"
#elif defined(USE_FIELD_5X52) #elif defined(USE_FIELD_5X52)
#include "field_5x52.h" #include "field_5x52_impl.h"
#else #else
#error "Please select field implementation" #error "Please select field implementation"
#endif #endif

View File

@ -7,9 +7,9 @@
#include <string.h> #include <string.h>
#include "../num.h" #include "num.h"
#include "../field.h" #include "field.h"
#include "../group.h" #include "group.h"
void static secp256k1_ge_set_infinity(secp256k1_ge_t *r) { void static secp256k1_ge_set_infinity(secp256k1_ge_t *r) {
r->infinity = 1; r->infinity = 1;

View File

@ -9,12 +9,12 @@
#include "libsecp256k1-config.h" #include "libsecp256k1-config.h"
#endif #endif
#include "../num.h" #include "num.h"
#if defined(USE_NUM_GMP) #if defined(USE_NUM_GMP)
#include "num_gmp.h" #include "num_gmp_impl.h"
#elif defined(USE_NUM_OPENSSL) #elif defined(USE_NUM_OPENSSL)
#include "num_openssl.h" #include "num_openssl_impl.h"
#else #else
#error "Please select num implementation" #error "Please select num implementation"
#endif #endif

View File

@ -11,7 +11,7 @@
#include <openssl/bn.h> #include <openssl/bn.h>
#include <openssl/crypto.h> #include <openssl/crypto.h>
#include "../num.h" #include "num.h"
void static secp256k1_num_init(secp256k1_num_t *r) { void static secp256k1_num_init(secp256k1_num_t *r) {
BN_init(&r->bn); BN_init(&r->bn);

View File

@ -2,11 +2,11 @@
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "impl/num.h" #include "num_impl.h"
#include "impl/field.h" #include "field_impl.h"
#include "impl/group.h" #include "group_impl.h"
#include "impl/ecmult.h" #include "ecmult_impl.h"
#include "impl/ecdsa.h" #include "ecdsa_impl.h"
void secp256k1_start(void) { void secp256k1_start(void) {
secp256k1_fe_start(); secp256k1_fe_start();

View File

@ -9,12 +9,12 @@
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include "impl/num.h" #include "num_impl.h"
#include "impl/field.h" #include "field_impl.h"
#include "impl/group.h" #include "group_impl.h"
#include "impl/ecmult.h" #include "ecmult_impl.h"
#include "impl/ecdsa.h" #include "ecdsa_impl.h"
#include "impl/util.h" #include "util_impl.h"
#ifdef ENABLE_OPENSSL_TESTS #ifdef ENABLE_OPENSSL_TESTS
#include "openssl/bn.h" #include "openssl/bn.h"

View File

@ -14,6 +14,4 @@ static void secp256k1_rand256(unsigned char *b32);
/** Generate a pseudorandom 32-byte array with long sequences of zero and one bits. */ /** Generate a pseudorandom 32-byte array with long sequences of zero and one bits. */
static void secp256k1_rand256_test(unsigned char *b32); static void secp256k1_rand256_test(unsigned char *b32);
#include "impl/util.h"
#endif #endif

View File

@ -8,7 +8,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "../util.h" #include "util.h"
static inline uint32_t secp256k1_rand32(void) { static inline uint32_t secp256k1_rand32(void) {
static uint32_t Rz = 11, Rw = 11; static uint32_t Rz = 11, Rw = 11;