mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-11 16:00:57 +00:00
build(legacy): build with secp256k1-zkp library
This commit is contained in:
parent
71b12a2a71
commit
a22e6a688f
@ -6,6 +6,7 @@ Q := @
|
||||
endif
|
||||
|
||||
PYTHON ?= python
|
||||
CC_FOR_BUILD ?= gcc
|
||||
|
||||
ifeq ($(EMULATOR),1)
|
||||
CC ?= gcc
|
||||
@ -84,6 +85,8 @@ LDFLAGS += -L$(TOP_DIR) \
|
||||
$(CPUFLAGS) \
|
||||
$(FPUFLAGS)
|
||||
|
||||
ZKP_PATH = $(TOP_DIR)vendor/secp256k1-zkp
|
||||
|
||||
ifeq ($(EMULATOR),1)
|
||||
CFLAGS += -DEMULATOR=1
|
||||
|
||||
@ -200,6 +203,19 @@ $(NAME).elf: $(OBJS) $(LDSCRIPT) $(LIBDEPS)
|
||||
@printf " LD $@\n"
|
||||
$(Q)$(LD) -o $(NAME).elf $(OBJS) $(LDLIBS) $(LDFLAGS)
|
||||
|
||||
$(ZKP_PATH)/src/ecmult_static_context.h: $(ZKP_PATH)/src/gen_context.c
|
||||
@printf " GEN $@\n"
|
||||
$(Q)$(CC_FOR_BUILD) $(ZKP_CFLAGS) $(ZKP_PATH)/src/gen_context.c -o $(ZKP_PATH)/gen_context
|
||||
$(Q)cd $(ZKP_PATH) && ./gen_context
|
||||
|
||||
secp256k1-zkp.o: $(ZKP_PATH)/src/ecmult_static_context.h
|
||||
@printf " CC $@\n"
|
||||
$(Q)$(CC) $(CFLAGS) -Wno-unused-function $(ZKP_CFLAGS) -I$(ZKP_PATH) -I$(ZKP_PATH)/src -c $(ZKP_PATH)/src/secp256k1.c -o secp256k1-zkp.o
|
||||
|
||||
field_10x26_arm.o:
|
||||
@printf " AS $@\n"
|
||||
$(Q)$(CC) $(CFLAGS) $(ZKP_CFLAGS) -c $(ZKP_PATH)/src/asm/field_10x26_arm.s -o field_10x26_arm.o
|
||||
|
||||
%.o: %.S Makefile
|
||||
@printf " AS $@\n"
|
||||
$(Q)$(CC) $(CPUFLAGS) -o $@ -c $<
|
||||
|
1
legacy/firmware/.changelog.d/1897.added
Normal file
1
legacy/firmware/.changelog.d/1897.added
Normal file
@ -0,0 +1 @@
|
||||
Support of BIP-340 Schnorr signatures (using secp256k1-zkp).
|
@ -2,6 +2,41 @@ APPVER = 1.8.0
|
||||
|
||||
NAME = trezor
|
||||
|
||||
SECP256K1_ZKP ?= 1
|
||||
|
||||
|
||||
ifeq ($(SECP256K1_ZKP),1)
|
||||
CFLAGS += -DUSE_SECP256K1_ZKP
|
||||
CFLAGS += -DUSE_SECP256K1_ZKP_ECDSA
|
||||
ifeq ($(EMULATOR),1)
|
||||
CFLAGS += -DSECP256K1_CONTEXT_SIZE=208
|
||||
else
|
||||
CFLAGS += -DSECP256K1_CONTEXT_SIZE=184
|
||||
OBJS += field_10x26_arm.o
|
||||
endif
|
||||
ZKP_CFLAGS = \
|
||||
-DUSE_ASM_ARM \
|
||||
-DUSE_NUM_NONE \
|
||||
-DUSE_FIELD_INV_BUILTIN \
|
||||
-DUSE_SCALAR_INV_BUILTIN \
|
||||
-DUSE_EXTERNAL_ASM \
|
||||
-DUSE_FIELD_10X26 \
|
||||
-DUSE_SCALAR_8X32 \
|
||||
-DUSE_ECMULT_STATIC_PRECOMPUTATION \
|
||||
-DUSE_EXTERNAL_DEFAULT_CALLBACKS \
|
||||
-DECMULT_GEN_PREC_BITS=4 \
|
||||
-DECMULT_WINDOW_SIZE=8 \
|
||||
-DENABLE_MODULE_GENERATOR \
|
||||
-DENABLE_MODULE_RECOVERY \
|
||||
-DENABLE_MODULE_SCHNORRSIG \
|
||||
-DENABLE_MODULE_EXTRAKEYS
|
||||
|
||||
OBJS += secp256k1-zkp.o
|
||||
OBJS += ../vendor/trezor-crypto/zkp_bip340.o
|
||||
OBJS += ../vendor/trezor-crypto/zkp_context.o
|
||||
OBJS += ../vendor/trezor-crypto/zkp_ecdsa.o
|
||||
endif
|
||||
|
||||
ifeq ($(EMULATOR),1)
|
||||
OBJS += udp.o
|
||||
else
|
||||
|
1
legacy/vendor/secp256k1-zkp
vendored
Symbolic link
1
legacy/vendor/secp256k1-zkp
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../../vendor/secp256k1-zkp
|
Loading…
Reference in New Issue
Block a user