From cb9ccc5cf4ea3992172f31e8d1506f1a5b791157 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 12 Mar 2015 15:53:41 +0100 Subject: [PATCH] remove all references to USE_PUBKEY_VALIDATE --- Makefile | 2 +- bip32.c | 2 -- options.h | 5 ----- setup.py | 2 +- tests.c | 2 -- tools/Makefile | 2 -- 6 files changed, 2 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 95ab8f8466..f24d375da3 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ CFLAGS += -Wno-sequence-point # disable certain optimizations and features when small footprint is required ifdef SMALL -CFLAGS += -DUSE_PRECOMPUTED_IV=0 -DUSE_PRECOMPUTED_CP=0 -DUSE_PUBKEY_VALIDATE=0 +CFLAGS += -DUSE_PRECOMPUTED_IV=0 -DUSE_PRECOMPUTED_CP=0 endif OBJS = bignum.o ecdsa.o secp256k1.o rand.o hmac.o bip32.o bip39.o pbkdf2.o base58.o diff --git a/bip32.c b/bip32.c index 43218aed98..daf500b8c9 100644 --- a/bip32.c +++ b/bip32.c @@ -162,11 +162,9 @@ int hdnode_public_ckd(HDNode *inout, uint32_t i) scalar_multiply(&c, &b); // b = c * G point_add(&a, &b); // b = a + b -#if USE_PUBKEY_VALIDATE if (!ecdsa_validate_pubkey(&b)) { return 0; } -#endif inout->public_key[0] = 0x02 | (b.y.val[0] & 0x01); bn_write_be(&b.x, inout->public_key + 1); diff --git a/options.h b/options.h index 0e68178c2e..8c8a329dca 100644 --- a/options.h +++ b/options.h @@ -48,11 +48,6 @@ #define USE_RFC6979 1 #endif -// check public key for validity -#ifndef USE_PUBKEY_VALIDATE -#define USE_PUBKEY_VALIDATE 1 -#endif - // implement BIP32 caching #ifndef USE_BIP32_CACHE #define USE_BIP32_CACHE 1 diff --git a/setup.py b/setup.py index 592976a211..106171681e 100755 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ srcs = [ extensions = [ Extension('TrezorCrypto', sources = ['TrezorCrypto.pyx', 'c.pxd'] + [ x + '.c' for x in srcs ], - extra_compile_args = ['-DUSE_PUBKEY_VALIDATE=0'], + extra_compile_args = [], ) ] diff --git a/tests.c b/tests.c index 57431da194..57dc0c9b0a 100644 --- a/tests.c +++ b/tests.c @@ -1060,7 +1060,6 @@ START_TEST(test_pubkey_validity) res = ecdsa_read_pubkey(pub_key, &pub); ck_assert_int_eq(res, 1); -#if USE_PUBKEY_VALIDATE memcpy(pub_key, fromhex("04f80490839af36d13701ec3f9eebdac901b51c362119d74553a3c537faff31b17e2a59ebddbdac9e87b816307a7ed5b826b8f40b92719086238e1bebf00000000"), 65); res = ecdsa_read_pubkey(pub_key, &pub); ck_assert_int_eq(res, 0); @@ -1068,7 +1067,6 @@ START_TEST(test_pubkey_validity) memcpy(pub_key, fromhex("04f80490839af36d13701ec3f9eebdac901b51c362119d74553a3c537faff31b17e2a59ebddbdac9e87b816307a7ed5b8211111111111111111111111111111111"), 65); res = ecdsa_read_pubkey(pub_key, &pub); ck_assert_int_eq(res, 0); -#endif memcpy(pub_key, fromhex("00"), 1); res = ecdsa_read_pubkey(pub_key, &pub); diff --git a/tools/Makefile b/tools/Makefile index 8b83089f94..67c652637f 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -23,8 +23,6 @@ CFLAGS += $(OPTFLAGS) \ -Werror \ -I.. -CFLAGS += -DUSE_PUBKEY_VALIDATE=0 - all: xpubaddrgen OBJS = ../bip32.o ../ecdsa.o ../sha2.o ../bignum.o ../base58.o ../secp256k1.o ../ripemd160.o ../hmac.o ../rand.o