mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-17 19:00:58 +00:00
Merge pull request #55 from jhoenicke/multicurve
Updated cmake configuration for ed25519
This commit is contained in:
commit
3998e7e883
@ -1,6 +1,7 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
set(SOURCES aescrypt.c aeskey.c aes_modes.c aestab.c base58.c bignum.c bip32.c bip39.c ecdsa.c hmac.c nist256p1.c pbkdf2.c rand.c ripemd160.c secp256k1.c sha2.c)
|
||||
set(SOURCES aescrypt.c aeskey.c aes_modes.c aestab.c base58.c bignum.c bip32.c bip39.c ecdsa.c hmac.c nist256p1.c pbkdf2.c rand.c ripemd160.c secp256k1.c sha2.c ed25519-donna/ed25519.c)
|
||||
include_directories(ed25519-donna)
|
||||
|
||||
# disable sequence point warnings where they are expected
|
||||
set_source_files_properties(aeskey.c PROPERTIES
|
||||
|
2
Makefile
2
Makefile
@ -37,9 +37,9 @@ SRCS = bignum.c ecdsa.c curves.c secp256k1.c nist256p1.c rand.c hmac.c bip32.c
|
||||
SRCS += ripemd160.c
|
||||
SRCS += sha2.c
|
||||
SRCS += aescrypt.c aeskey.c aestab.c aes_modes.c
|
||||
SRCS += ed25519-donna/ed25519.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
OBJS += ed25519-donna/ed25519.o
|
||||
|
||||
TESTLIBS = -lcheck -lrt -lpthread -lm
|
||||
TESTSSLLIBS = -lcrypto
|
||||
|
2
c.pxd
2
c.pxd
@ -5,7 +5,7 @@ cdef extern from "bip32.h":
|
||||
ctypedef struct HDNode:
|
||||
uint8_t public_key[33]
|
||||
|
||||
int hdnode_from_seed(const uint8_t *seed, int seed_len, HDNode *out)
|
||||
int hdnode_from_seed(const uint8_t *seed, int seed_len, const char *curve, HDNode *out)
|
||||
|
||||
int hdnode_private_ckd(HDNode *inout, uint32_t i)
|
||||
|
||||
|
@ -41,11 +41,13 @@ random_iters = int(os.environ.get('ITERS', 1))
|
||||
|
||||
lib = c.cdll.LoadLibrary('./libtrezor-crypto.so')
|
||||
|
||||
lib.get_curve_by_name.restype = c.c_void_p
|
||||
class curve_info(c.Structure):
|
||||
_fields_ = [("bip32_name", c.c_char_p),
|
||||
("params", c.c_void_p)]
|
||||
lib.get_curve_by_name.restype = c.POINTER(curve_info)
|
||||
|
||||
BIGNUM = c.c_uint32 * 9
|
||||
|
||||
|
||||
class Random(random.Random):
|
||||
def randbytes(self, n):
|
||||
buf = (c.c_uint8 * n)()
|
||||
@ -83,7 +85,7 @@ def r(request):
|
||||
@pytest.fixture(params=list(sorted(curves)))
|
||||
def curve(request):
|
||||
name = request.param
|
||||
curve_ptr = lib.get_curve_by_name(name)
|
||||
curve_ptr = lib.get_curve_by_name(name).contents.params
|
||||
assert curve_ptr, 'curve {} not found'.format(name)
|
||||
curve_obj = curves[name]
|
||||
curve_obj.ptr = c.c_void_p(curve_ptr)
|
||||
@ -93,7 +95,7 @@ def curve(request):
|
||||
@pytest.fixture(params=points)
|
||||
def point(request):
|
||||
name = request.param.curve
|
||||
curve_ptr = lib.get_curve_by_name(name)
|
||||
curve_ptr = lib.get_curve_by_name(name).contents.params
|
||||
assert curve_ptr, 'curve {} not found'.format(name)
|
||||
curve_obj = curves[name]
|
||||
curve_obj.ptr = c.c_void_p(curve_ptr)
|
||||
|
Loading…
Reference in New Issue
Block a user