Compare commits
280 Commits
Author | SHA1 | Date |
---|---|---|
Chris Sulmone | a20c2a7823 | |
Pavol Rusnak | 3971f4bf13 | |
Jochen Hoenicke | ffe151459b | |
Pavol Rusnak | a697d482bf | |
Pavol Rusnak | 1b8217ca66 | |
Jan Pochyla | eed57a6c44 | |
Pavol Rusnak | 21d07ec99d | |
Pavol Rusnak | 611d374bbd | |
Pavol Rusnak | c7c5f55508 | |
Pavol Rusnak | 34e60899c0 | |
matejcik | d866128fbe | |
Pavol Rusnak | 8852fb5482 | |
Pavol Rusnak | 0ec62dfa5c | |
Pavol Rusnak | 842ebd6e83 | |
Pavol Rusnak | 63773e99b7 | |
Jan Pochyla | eda280213f | |
Jan Pochyla | f74cbead5e | |
Pavol Rusnak | 144e2013bd | |
Pavol Rusnak | b77646904b | |
Pavol Rusnak | 7dc207a8df | |
Pavol Rusnak | df10f5df3f | |
Pavol Rusnak | c937d73217 | |
Pavol Rusnak | 2e3dc8b29d | |
Pavol Rusnak | 01bb1e34fa | |
Pavol Rusnak | 1269a0239d | |
Pavol Rusnak | 4f98f02ff9 | |
Pavol Rusnak | c0a0630cba | |
Pavol Rusnak | 67d835fd3e | |
Pavol Rusnak | a13639997e | |
Jan Pochyla | 8ac915e75f | |
Jan Pochyla | 8f1ed5edce | |
matejcik | a46f7b2fad | |
Pavol Rusnak | 248f479d68 | |
Pavol Rusnak | 829d92079d | |
Pavol Rusnak | 59d1cc1e1b | |
Pavol Rusnak | a38e57a31f | |
Pavol Rusnak | ba870fbf9b | |
Pavol Rusnak | 19bae93d92 | |
Jan Pochyla | 0c42976e91 | |
Jan Pochyla | 5ec3ef7835 | |
Pavol Rusnak | 9549ef9865 | |
Pavol Rusnak | 27f9f986c5 | |
Pavol Rusnak | 7fa146fedb | |
Pavol Rusnak | 97fee650ca | |
Peter Jensen | e43ce25611 | |
Jan Pochyla | 9e5aad9ab4 | |
Jan Pochyla | f4c1bfda22 | |
Jan Pochyla | 20ca86229c | |
Pavol Rusnak | 2523442eb3 | |
Pavol Rusnak | f9b16cfa34 | |
Jan Pochyla | 9f48e3d471 | |
Pavol Rusnak | c1f097f2b4 | |
Pavol Rusnak | fa056518f1 | |
Jan Pochyla | 375a95c214 | |
Jan Pochyla | 4ef79ca48b | |
Jan Pochyla | a4081bab72 | |
Jan Pochyla | d4038cc03a | |
Pavol Rusnak | 2cf917e58d | |
Pavol Rusnak | d6563a213c | |
Peter Jensen | 05ccdecbc6 | |
Tomas Susanka | 20456a263a | |
Pavol Rusnak | 91dc487dcd | |
Pavol Rusnak | 865070d083 | |
Pavol Rusnak | 13ffe75a48 | |
Tomas Susanka | 5f362f7493 | |
Jan Pochyla | 85e5a87c24 | |
Jan Pochyla | f6e06b768d | |
Jan Pochyla | 8e5125a3fe | |
Pavol Rusnak | 2854583b52 | |
Pavol Rusnak | 9c7ddba217 | |
Pavol Rusnak | 2be0a4d31a | |
Jan Pochyla | 323714dc61 | |
Jan Pochyla | 5e8ea18cce | |
Pavol Rusnak | 0eff62bb5c | |
Pavol Rusnak | fd597d23a4 | |
Pavol Rusnak | be79a8cff4 | |
Pavol Rusnak | 1c92002954 | |
Peter Jensen | 5d992c45c7 | |
Jan Pochyla | 0c9cc99bd7 | |
Jan Pochyla | 048e0706b3 | |
Jan Pochyla | a4477b8bef | |
Jan Pochyla | fd95bb482e | |
Pavol Rusnak | 20f1644ef9 | |
Pavol Rusnak | b97e5b7a55 | |
Pavol Rusnak | 081dcdd98f | |
Pavol Rusnak | 81e31afc58 | |
Pavol Rusnak | f20febeef0 | |
Jan Pochyla | 54128b7568 | |
Jan Pochyla | 031d20b25f | |
Peter Jensen | 375402db67 | |
Pavol Rusnak | bce101b96a | |
Pavol Rusnak | ee242ea416 | |
Jan Pochyla | ab9a82e95a | |
Jan Pochyla | af53d39c44 | |
Jan Pochyla | c568071177 | |
Pavol Rusnak | d323aa88f7 | |
Jan Pochyla | 6e7a15c088 | |
Jan Pochyla | 4622ee32bc | |
Jan Pochyla | b88e4e5d5a | |
Jan Pochyla | 9291de47d0 | |
Jan Pochyla | c01ebeb552 | |
Jan Pochyla | b9c111f6ae | |
Jan Pochyla | fa5dbadc93 | |
Jan Pochyla | 72aa5e5204 | |
Jan Pochyla | 0ad58aad2b | |
Jan Pochyla | e3847cf31f | |
Jan Pochyla | b8769bd9a5 | |
Jan Pochyla | e9ae9e6f1e | |
Jan Pochyla | d6c0fae045 | |
Jan Pochyla | 6472b201f7 | |
Jan Pochyla | a46934459a | |
Jan Pochyla | 1b64088957 | |
Tomas Susanka | b98171e273 | |
Tomas Susanka | da6cc4a6e5 | |
Tomas Susanka | e71b51046d | |
Tomas Susanka | 78c7e80319 | |
Tomas Susanka | 69bd1ef676 | |
Tomas Susanka | fb7a315208 | |
Tomas Susanka | 16072d7011 | |
Tomas Susanka | 4c2dec55ed | |
Tomas Susanka | b7e4fe02a9 | |
Tomas Susanka | 01317eef18 | |
Tomas Susanka | 805593c1ac | |
Tomas Susanka | e6d693d18a | |
Tomas Susanka | 6bc0f82642 | |
Tomas Susanka | 985c01caf4 | |
Tomas Susanka | 26a89a8e5f | |
Tomas Susanka | 6a73a7922b | |
Tomas Susanka | 8715e20b79 | |
Tomas Susanka | 2c2f2ff97b | |
Tomas Susanka | b5e26f1d44 | |
Tomas Susanka | f36b475109 | |
Tomas Susanka | d23a236616 | |
Tomas Susanka | 368ba963a6 | |
Tomas Susanka | 858f2583a5 | |
Tomas Susanka | e4423567cb | |
Tomas Susanka | 8fbf89b7f3 | |
Pavol Rusnak | 14b0d4439a | |
Pavol Rusnak | 6fd7782ac7 | |
Pavol Rusnak | 872c44c477 | |
Pavol Rusnak | db141fbc14 | |
Pavol Rusnak | 2bb9d80c18 | |
Pavol Rusnak | 64f7089d45 | |
Pavol Rusnak | c53b0afd5b | |
Jan Pochyla | 300016cc92 | |
Pavol Rusnak | 502ecd7bcc | |
Pavol Rusnak | 35e1135c95 | |
Pavol Rusnak | adaa53174b | |
Pavol Rusnak | fae8ffda9f | |
Pavol Rusnak | 02358b3932 | |
Pavol Rusnak | 21bb815945 | |
Pavol Rusnak | 2bebd0eec5 | |
Pavol Rusnak | 748a53a2c9 | |
Pavol Rusnak | 8e3e1837d1 | |
Pavol Rusnak | 3eab20e278 | |
Pavol Rusnak | d8ac07e455 | |
Pavol Rusnak | d9324f3e57 | |
Pavol Rusnak | d5ab82ae2b | |
Jan Pochyla | b0aae19929 | |
Jan Pochyla | fcd712a0b0 | |
Jan Pochyla | 76590c44ad | |
Jan Pochyla | 168cbabbf5 | |
Jan Pochyla | 213e1b32ec | |
Jan Pochyla | b5e142307b | |
Jan Pochyla | d49fa2fb9c | |
Jan Pochyla | 34f722f2df | |
Pavol Rusnak | badd0e5677 | |
Peter Jensen | cacbbf80eb | |
Peter Jensen | c34ee98731 | |
Peter Jensen | 22c9296aac | |
Jan Pochyla | 0592cfe356 | |
Tomas Susanka | b659f1b29c | |
Saleem Rashid | 3f63acdd77 | |
Pavol Rusnak | 30396f9cf0 | |
Pavol Rusnak | e264090678 | |
Pavol Rusnak | f65c409416 | |
Pavol Rusnak | 736dec1419 | |
Pavol Rusnak | 3c738b62c4 | |
Pavol Rusnak | 75e87ede86 | |
Pavol Rusnak | 4ad6a7a634 | |
Pavol Rusnak | 5ded086800 | |
Pavol Rusnak | 302a31e8d2 | |
Pavol Rusnak | 1469ede956 | |
Pavol Rusnak | c115faf2cd | |
Pavol Rusnak | 7b2fd6ae4c | |
Pavol Rusnak | 936f0e3e26 | |
Pavol Rusnak | 8a409bd99a | |
mcudev | 0a15b03917 | |
Peter Jensen | b8cf98b78b | |
Tomas Susanka | 901b0a53a1 | |
Peter Jensen | a83d7b9067 | |
Pavol Rusnak | 34c6fb987a | |
Pavol Rusnak | 77568496da | |
Pavol Rusnak | c1e1e8bf02 | |
Pavol Rusnak | 6fad2f4283 | |
Pavol Rusnak | e93ef0c296 | |
Jan Pochyla | e888b6b967 | |
Pavol Rusnak | 800c2c64c8 | |
Pavol Rusnak | b0242d3a3e | |
Pavol Rusnak | 9aa947d2e1 | |
Pavol Rusnak | 593ccdafec | |
Jan Pochyla | 350de72c54 | |
Jan Pochyla | d0c742e884 | |
Pavol Rusnak | 2fe0ce542f | |
Pavol Rusnak | fa697ba322 | |
Pavol Rusnak | 77ea31aa8a | |
Pavol Rusnak | 984327fea5 | |
Pavol Rusnak | 329b7d1488 | |
Pavol Rusnak | c4990646c7 | |
Pavol Rusnak | 39576eb2a7 | |
Pavol Rusnak | a25af7d22a | |
Pavol Rusnak | d5ae4d72b6 | |
Pavol Rusnak | fedfde7e99 | |
Pavol Rusnak | 340f926804 | |
Pavol Rusnak | 47c598b56e | |
Pavol Rusnak | 1c5beb1c12 | |
Pavol Rusnak | 548b8cb25b | |
Pavol Rusnak | 585e9842f8 | |
Pavol Rusnak | 69344f34b6 | |
Jan Pochyla | b139e1a7ac | |
Jan Pochyla | deb64c3c43 | |
Jan Pochyla | 1c9380a9d9 | |
Peter Jensen | 7b89e4b14c | |
Jan Pochyla | bd44eceeef | |
Pavol Rusnak | 8b49e04ade | |
Jan Pochyla | 00c4da83b9 | |
Jan Pochyla | 32c74e6e9a | |
Jan Pochyla | 58f48f8ade | |
Peter Jensen | f56aaa3b1c | |
Peter Jensen | 9c84b742a0 | |
Jan Pochyla | ac0be4b061 | |
Jan Pochyla | 5a5842111b | |
Jan Pochyla | f20ce1fcc9 | |
Jan Pochyla | e907099be1 | |
Jan Pochyla | 5f76dc714a | |
Jan Pochyla | a7f011d59e | |
Jan Pochyla | 6a0f18bef1 | |
Pavol Rusnak | d791253e07 | |
Pavol Rusnak | 46fc37f977 | |
Pavol Rusnak | a9aa5febda | |
Pavol Rusnak | e865012663 | |
Pavol Rusnak | c627fcb836 | |
Pavol Rusnak | 40e20e2e9d | |
Jan Pochyla | 7ef79a73fa | |
Pavol Rusnak | 61b4e3d6e3 | |
Peter Jensen | ea6763c4ec | |
Peter Jensen | fac8932a85 | |
Peter Jensen | b64be539d4 | |
Peter Jensen | dc5049a3d6 | |
Pavol Rusnak | b8b8e38765 | |
Pavol Rusnak | 4f44c2577b | |
Pavol Rusnak | d1b5a254ef | |
Pavol Rusnak | 94fc0f7ac0 | |
Pavol Rusnak | 1e03a5d554 | |
Pavol Rusnak | db71afca60 | |
Pavol Rusnak | 488e516cbf | |
Pavol Rusnak | 52a942afd4 | |
Pavol Rusnak | cf9c97288e | |
Jan Pochyla | 2625c940db | |
Jan Pochyla | 6f8a4de4e6 | |
Tomas Susanka | a306ce60c2 | |
Jan Pochyla | 9c469d583a | |
Jan Pochyla | 64d5f18ed6 | |
Jan Pochyla | 710306495e | |
Jan Pochyla | 898b33cffb | |
Pavol Rusnak | 36d034d83a | |
Pavol Rusnak | ec52ff882f | |
Pavol Rusnak | b79ea10434 | |
Pavol Rusnak | 5f9c079f5c | |
Pavol Rusnak | f0152902fc | |
Pavol Rusnak | 132660c378 | |
Pavol Rusnak | 81ff60c3e1 | |
Pavol Rusnak | 5ede6864d5 | |
Pavol Rusnak | bfa79cbfd3 | |
Pavol Rusnak | ebc585fd40 | |
Pavol Rusnak | 1bf278c3ee | |
Pavol Rusnak | 03943c960b | |
Pavol Rusnak | 754cf3672d | |
Pavol Rusnak | 11245a82ea | |
Pavol Rusnak | 706ddda1a7 |
6
.flake8
|
@ -4,15 +4,13 @@ ignore =
|
|||
E221,
|
||||
# E241: multiple spaces after comma
|
||||
E241,
|
||||
# F401: module imported but unused
|
||||
F401,
|
||||
# E402: module level import not at top of file
|
||||
E402,
|
||||
# E501: line too long
|
||||
E501,
|
||||
# F403: star import used, unable to detect undefined names
|
||||
E741,
|
||||
# E741 ambiguous variable name
|
||||
E741,
|
||||
# F403: star import used, unable to detect undefined names
|
||||
F403,
|
||||
# F405: name may be undefined, or defined from star imports
|
||||
F405
|
||||
|
|
|
@ -45,10 +45,10 @@ before_script:
|
|||
- test "$GOAL" != "stm32" || export PATH=$PWD/$TOOLCHAIN_LONGVER/bin:$PATH
|
||||
|
||||
script:
|
||||
- test "$GOAL" != "stm32" || make vendorheader
|
||||
- test "$GOAL" != "stm32" || make build_cross
|
||||
- test "$GOAL" != "stm32" || make build_boardloader
|
||||
- test "$GOAL" != "stm32" || make build_bootloader
|
||||
- test "$GOAL" != "stm32" || make build_prodtest
|
||||
- test "$GOAL" != "stm32" || make build_firmware
|
||||
- test "$GOAL" != "stm32" || make sizecheck
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
Developers:
|
||||
|
||||
Pavol Rusnak
|
||||
Jan Pochyla
|
||||
Marek Palatinus
|
||||
Peter Jensen
|
||||
Tomas Susanka
|
||||
Karel Bilek
|
||||
|
||||
Contributors:
|
||||
|
||||
mcudev
|
||||
Jochen Hoenicke
|
||||
Saleem Rashid
|
||||
Arthur Gautier
|
17
Makefile
|
@ -81,7 +81,7 @@ style: ## run code style check on application sources and tests
|
|||
|
||||
## build commands:
|
||||
|
||||
build: build_boardloader build_bootloader build_prodtest build_firmware build_unix build_cross ## build all
|
||||
build: build_boardloader build_bootloader build_firmware build_prodtest build_unix ## build all
|
||||
|
||||
build_boardloader: ## build boardloader
|
||||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" $(BOARDLOADER_BUILD_DIR)/boardloader.bin
|
||||
|
@ -90,15 +90,15 @@ build_bootloader: ## build bootloader
|
|||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" $(BOOTLOADER_BUILD_DIR)/bootloader.bin
|
||||
|
||||
build_prodtest: ## build production test firmware
|
||||
$(SCONS) CFLAGS="$(CFLAGS)" $(PRODTEST_BUILD_DIR)/prodtest.bin
|
||||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" $(PRODTEST_BUILD_DIR)/prodtest.bin
|
||||
|
||||
build_reflash: ## build reflash firmware + reflash image
|
||||
$(SCONS) CFLAGS="$(CFLAGS)" $(REFLASH_BUILD_DIR)/reflash.bin
|
||||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" $(REFLASH_BUILD_DIR)/reflash.bin
|
||||
dd if=build/boardloader/boardloader.bin of=$(REFLASH_BUILD_DIR)/sdimage.bin bs=1 seek=0
|
||||
dd if=build/bootloader/bootloader.bin of=$(REFLASH_BUILD_DIR)/sdimage.bin bs=1 seek=49152
|
||||
|
||||
build_firmware: res build_cross ## build firmware with frozen modules
|
||||
$(SCONS) CFLAGS="$(CFLAGS)" $(FIRMWARE_BUILD_DIR)/firmware.bin
|
||||
$(SCONS) CFLAGS="$(CFLAGS)" PRODUCTION="$(PRODUCTION)" $(FIRMWARE_BUILD_DIR)/firmware.bin
|
||||
|
||||
build_unix: res ## build unix port
|
||||
$(SCONS) CFLAGS="$(CFLAGS)" $(UNIX_BUILD_DIR)/micropython $(UNIX_PORT_OPTS)
|
||||
|
@ -180,17 +180,8 @@ gdb_firmware: $(FIRMWARE_BUILD_DIR)/firmware.elf ## start remote gdb session to
|
|||
|
||||
## misc commands:
|
||||
|
||||
vendorheader: ## construct and sign the default vendor header
|
||||
./tools/build_vendorheader e28a8970753332bd72fef413e6b0b2ef1b4aadda7aa2c141f233712a6876b351:d4eec1869fb1b8a4e817516ad5a931557cb56805c3eb16e8f3a803d647df7869:772c8a442b7db06e166cfbc1ccbcbcde6f3eba76a4e98ef3ffc519502237d6ef 2 0.0 x.....x DEVELOPMENT assets/vendor_devel.toif embed/firmware/vendorheader.bin
|
||||
./tools/binctl embed/firmware/vendorheader.bin -s 1:2 `./tools/combine_sign vendorheader embed/firmware/vendorheader.bin 4444444444444444444444444444444444444444444444444444444444444444 4545454545454545454545454545454545454545454545454545454545454545`
|
||||
|
||||
vendorheader_sl: ## construct SatoshiLabs vendor header
|
||||
./tools/build_vendorheader 47fbdc84d8abef44fe6abde8f87b6ead821b7082ec63b9f7cc33dc53bf6c708d:9af22a52ab47a93091403612b3d6731a2dfef8a33383048ed7556a20e8b03c81:2218c25f8ba70c82eba8ed6a321df209c0a7643d014f33bf9317846f62923830 2 0.0 ....... SatoshiLabs assets/vendor_satoshilabs.toif embed/firmware/vendorheader_sl.bin
|
||||
|
||||
binctl: ## print info about binary files
|
||||
./tools/binctl $(BOOTLOADER_BUILD_DIR)/bootloader.bin
|
||||
./tools/binctl embed/firmware/vendorheader.bin
|
||||
./tools/binctl $(PRODTEST_BUILD_DIR)/prodtest.bin
|
||||
./tools/binctl $(FIRMWARE_BUILD_DIR)/firmware.bin
|
||||
|
||||
bloaty: ## run bloaty size profiler
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
|
||||
This is the source code for 2nd generation of TREZOR called TREZOR model T.
|
||||
|
||||
It runs both inside of the device and also in the TREZOR Emulator.
|
||||
|
||||
![emulator](docs/emulator.jpg)
|
||||
|
||||
## Documentation
|
||||
|
||||
* [API](docs/api.md)
|
||||
|
|
|
@ -93,7 +93,7 @@ env.Replace(
|
|||
AS='arm-none-eabi-as',
|
||||
AR='arm-none-eabi-ar',
|
||||
CC='arm-none-eabi-gcc',
|
||||
LINK='arm-none-eabi-ld',
|
||||
LINK='arm-none-eabi-gcc',
|
||||
SIZE='arm-none-eabi-size',
|
||||
STRIP='arm-none-eabi-strip',
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
@ -109,7 +109,7 @@ env.Replace(
|
|||
'-fstack-protector-all '
|
||||
+ CCFLAGS_MOD,
|
||||
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
||||
LINKFLAGS='-nostdlib -T embed/boardloader/memory.ld --gc-sections -Map=build/boardloader/boardloader.map --warn-common',
|
||||
LINKFLAGS='-T embed/boardloader/memory.ld -Wl,--gc-sections -Wl,-Map=build/boardloader/boardloader.map -Wl,--warn-common',
|
||||
CPPPATH=[
|
||||
'embed/boardloader',
|
||||
'embed/trezorhal',
|
||||
|
@ -121,7 +121,7 @@ env.Replace(
|
|||
'vendor/micropython/lib/cmsis/inc',
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
'TREZOR_STM32',
|
||||
'TREZOR_MODEL_T',
|
||||
'MCU_SERIES_F4',
|
||||
'STM32F427xx',
|
||||
'USE_HAL_DRIVER',
|
||||
|
@ -144,7 +144,7 @@ program_elf = env.Command(
|
|||
target='boardloader.elf',
|
||||
source=obj_program,
|
||||
action=
|
||||
'$LINK -o $TARGET $LINKFLAGS $SOURCES `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-file-name=libc_nano.a` `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-libgcc-file-name`',
|
||||
'$LINK -o $TARGET $CCFLAGS $CFLAGS $LINKFLAGS $SOURCES -lc_nano -lgcc',
|
||||
)
|
||||
|
||||
program_bin = env.Command(
|
||||
|
|
|
@ -34,7 +34,6 @@ SOURCE_MOD += [
|
|||
CPPDEFINES_MOD += [
|
||||
'TREZOR_FONT_MONO_ENABLE',
|
||||
'TREZOR_FONT_NORMAL_ENABLE',
|
||||
('TREZOR_FONT_PREFILL', '0'),
|
||||
('QR_MAX_VERSION', '0'),
|
||||
]
|
||||
SOURCE_MOD += [
|
||||
|
@ -115,7 +114,7 @@ env.Replace(
|
|||
AS='arm-none-eabi-as',
|
||||
AR='arm-none-eabi-ar',
|
||||
CC='arm-none-eabi-gcc',
|
||||
LINK='arm-none-eabi-ld',
|
||||
LINK='arm-none-eabi-gcc',
|
||||
SIZE='arm-none-eabi-size',
|
||||
STRIP='arm-none-eabi-strip',
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
@ -131,7 +130,7 @@ env.Replace(
|
|||
'-fstack-protector-all '
|
||||
+ CCFLAGS_MOD,
|
||||
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
||||
LINKFLAGS='-nostdlib -T embed/bootloader/memory.ld --gc-sections -Map=build/bootloader/bootloader.map --warn-common',
|
||||
LINKFLAGS='-T embed/bootloader/memory.ld -Wl,--gc-sections -Wl,-Map=build/bootloader/bootloader.map -Wl,--warn-common',
|
||||
CPPPATH=[
|
||||
'embed/bootloader',
|
||||
'embed/bootloader/nanopb',
|
||||
|
@ -144,7 +143,7 @@ env.Replace(
|
|||
'vendor/micropython/lib/cmsis/inc',
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
'TREZOR_STM32',
|
||||
'TREZOR_MODEL_T',
|
||||
'MCU_SERIES_F4',
|
||||
'STM32F427xx',
|
||||
'USE_HAL_DRIVER',
|
||||
|
@ -156,7 +155,7 @@ env.Replace(
|
|||
|
||||
env.Replace(
|
||||
BINCTL='tools/binctl',
|
||||
COMBINE_SIGN='tools/combine_sign',
|
||||
KEYCTL='tools/keyctl',
|
||||
)
|
||||
|
||||
#
|
||||
|
@ -173,7 +172,7 @@ program_elf = env.Command(
|
|||
target='bootloader.elf',
|
||||
source=obj_program,
|
||||
action=
|
||||
'$LINK -o $TARGET $LINKFLAGS $SOURCES `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-file-name=libc_nano.a` `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-libgcc-file-name`',
|
||||
'$LINK -o $TARGET $CCFLAGS $CFLAGS $LINKFLAGS $SOURCES -lc_nano -lgcc',
|
||||
)
|
||||
|
||||
program_bin = env.Command(
|
||||
|
@ -182,6 +181,5 @@ program_bin = env.Command(
|
|||
action=[
|
||||
'$OBJCOPY -O binary -j .header -j .flash -j .data $SOURCE $TARGET',
|
||||
'$BINCTL $TARGET -h',
|
||||
'dd if=$TARGET of=build/bootloader/header.tosign bs=1 count=1024',
|
||||
'$BINCTL $TARGET -s 1:2 `$COMBINE_SIGN bootloader build/bootloader/header.tosign 4141414141414141414141414141414141414141414141414141414141414141 4242424242424242424242424242424242424242424242424242424242424242`',
|
||||
'$BINCTL $TARGET -s 1:2 `$KEYCTL sign bootloader $TARGET 4141414141414141414141414141414141414141414141414141414141414141 4242424242424242424242424242424242424242424242424242424242424242`' if ARGUMENTS.get('PRODUCTION', '0') == '0' else '',
|
||||
], )
|
||||
|
|
|
@ -7,6 +7,8 @@ CPPPATH_MOD = []
|
|||
CPPDEFINES_MOD = []
|
||||
SOURCE_MOD = []
|
||||
|
||||
PYOPT = '1'
|
||||
|
||||
# modtrezorconfig
|
||||
SOURCE_MOD += [
|
||||
'embed/extmod/modtrezorconfig/modtrezorconfig.c',
|
||||
|
@ -209,7 +211,6 @@ SOURCE_MICROPYTHON = [
|
|||
'vendor/micropython/ports/stm32/gccollect.c',
|
||||
'vendor/micropython/ports/stm32/gchelper.s',
|
||||
'vendor/micropython/ports/stm32/pendsv.c',
|
||||
'vendor/micropython/ports/stm32/systick.c',
|
||||
]
|
||||
|
||||
SOURCE_MICROPYTHON_SPEED = [
|
||||
|
@ -262,10 +263,12 @@ SOURCE_TREZORHAL = [
|
|||
'embed/trezorhal/common.c',
|
||||
'embed/trezorhal/flash.c',
|
||||
'embed/trezorhal/mini_printf.c',
|
||||
'embed/trezorhal/mpu.c',
|
||||
'embed/trezorhal/rng.c',
|
||||
'embed/trezorhal/sbu.c',
|
||||
'embed/trezorhal/sdcard.c',
|
||||
'embed/trezorhal/stm32.c',
|
||||
'embed/trezorhal/systick.c',
|
||||
'embed/trezorhal/touch.c',
|
||||
'embed/trezorhal/usb.c',
|
||||
'embed/trezorhal/usbd_conf.c',
|
||||
|
@ -286,7 +289,7 @@ SOURCE_PY.extend(Glob('src/*/*/*/*.py'))
|
|||
SOURCE_PY.extend(Glob('src/*/*/*/*/*.py'))
|
||||
SOURCE_PY_DIR = 'src/'
|
||||
|
||||
env = Environment(ENV=os.environ, CFLAGS=ARGUMENTS.get('CFLAGS', ''))
|
||||
env = Environment(ENV=os.environ, CFLAGS='%s -DPRODUCTION=%s -DPYOPT=%s' % (ARGUMENTS.get('CFLAGS', ''), ARGUMENTS.get('PRODUCTION', '0'), PYOPT))
|
||||
|
||||
env.Tool('micropython')
|
||||
|
||||
|
@ -295,7 +298,7 @@ env.Replace(
|
|||
AS='arm-none-eabi-as',
|
||||
AR='arm-none-eabi-ar',
|
||||
CC='arm-none-eabi-gcc',
|
||||
LINK='arm-none-eabi-ld',
|
||||
LINK='arm-none-eabi-gcc',
|
||||
SIZE='arm-none-eabi-size',
|
||||
STRIP='arm-none-eabi-strip',
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
@ -312,7 +315,7 @@ env.Replace(
|
|||
'-fstack-protector-all '
|
||||
+ CCFLAGS_MOD,
|
||||
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
||||
LINKFLAGS='-nostdlib -T embed/firmware/memory.ld --gc-sections -Map=build/firmware/firmware.map --warn-common',
|
||||
LINKFLAGS='-T embed/firmware/memory.ld -Wl,--gc-sections -Wl,-Map=build/firmware/firmware.map -Wl,--warn-common',
|
||||
CPPPATH=[
|
||||
'.',
|
||||
'embed/firmware',
|
||||
|
@ -325,7 +328,7 @@ env.Replace(
|
|||
'vendor/micropython/ports/stm32',
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
'TREZOR_STM32',
|
||||
'TREZOR_MODEL_T',
|
||||
'MCU_SERIES_F4',
|
||||
'STM32F427xx',
|
||||
'USE_HAL_DRIVER',
|
||||
|
@ -336,12 +339,12 @@ env.Replace(
|
|||
|
||||
env.Replace(
|
||||
BINCTL='tools/binctl',
|
||||
COMBINE_SIGN='tools/combine_sign',
|
||||
KEYCTL='tools/keyctl',
|
||||
PYTHON='python',
|
||||
MAKEQSTRDATA='$PYTHON vendor/micropython/py/makeqstrdata.py',
|
||||
MAKEVERSIONHDR='$PYTHON vendor/micropython/py/makeversionhdr.py',
|
||||
MPY_TOOL='$PYTHON vendor/micropython/tools/mpy-tool.py',
|
||||
MPY_CROSS='vendor/micropython/mpy-cross/mpy-cross',
|
||||
MPY_CROSS='vendor/micropython/mpy-cross/mpy-cross -O' + PYOPT
|
||||
)
|
||||
|
||||
#
|
||||
|
@ -395,10 +398,12 @@ obj_program.extend(env.Object(source=SOURCE_STMHAL))
|
|||
obj_program.extend(env.Object(source=SOURCE_TREZORHAL))
|
||||
obj_program.extend(env.Object(source=source_mpyc))
|
||||
|
||||
VENDORHEADER = 'embed/vendorheader/vendorheader_' + ('unsafe_signed_prod.bin' if ARGUMENTS.get('PRODUCTION', '0') == '0' else 'satoshilabs_signed_prod.bin')
|
||||
|
||||
obj_program.extend(
|
||||
env.Command(
|
||||
target='embed/firmware/vendorheader.o',
|
||||
source='embed/firmware/vendorheader.bin',
|
||||
source=VENDORHEADER,
|
||||
action='$OBJCOPY -I binary -O elf32-littlearm -B arm'
|
||||
' --rename-section .data=.vendorheader,alloc,load,readonly,contents'
|
||||
' $SOURCE $TARGET', ))
|
||||
|
@ -409,7 +414,7 @@ program_elf = env.Command(
|
|||
target='firmware.elf',
|
||||
source=obj_program,
|
||||
action=
|
||||
'$LINK -o $TARGET $LINKFLAGS $SOURCES `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-file-name=libc_nano.a` `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-file-name=libm.a` `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-libgcc-file-name`',
|
||||
'$LINK -o $TARGET $CCFLAGS $CFLAGS $LINKFLAGS $SOURCES -lc_nano -lm -lgcc',
|
||||
)
|
||||
|
||||
program_bin = env.Command(
|
||||
|
@ -418,6 +423,5 @@ program_bin = env.Command(
|
|||
action=[
|
||||
'$OBJCOPY -O binary -j .vendorheader -j .header -j .flash -j .data $SOURCE $TARGET',
|
||||
'$BINCTL $TARGET -h',
|
||||
'dd if=$TARGET of=build/firmware/header.tosign bs=1 count=1024 skip=`wc -c < embed/firmware/vendorheader.bin | tr -d " "`',
|
||||
'$BINCTL $TARGET -s 1:2 `$COMBINE_SIGN firmware build/firmware/header.tosign 4747474747474747474747474747474747474747474747474747474747474747 4848484848484848484848484848484848484848484848484848484848484848`',
|
||||
'$BINCTL $TARGET -s 1:2 `$KEYCTL sign firmware $TARGET 4747474747474747474747474747474747474747474747474747474747474747 4848484848484848484848484848484848484848484848484848484848484848`' if ARGUMENTS.get('PRODUCTION', '0') == '0' else '',
|
||||
], )
|
||||
|
|
|
@ -83,7 +83,7 @@ env.Replace(
|
|||
AS='arm-none-eabi-as',
|
||||
AR='arm-none-eabi-ar',
|
||||
CC='arm-none-eabi-gcc',
|
||||
LINK='arm-none-eabi-ld',
|
||||
LINK='arm-none-eabi-gcc',
|
||||
SIZE='arm-none-eabi-size',
|
||||
STRIP='arm-none-eabi-strip',
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
@ -99,7 +99,7 @@ env.Replace(
|
|||
'-fstack-protector-all '
|
||||
+ CCFLAGS_MOD,
|
||||
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
||||
LINKFLAGS='-nostdlib -T embed/prodtest/memory.ld --gc-sections -Map=build/prodtest/prodtest.map --warn-common',
|
||||
LINKFLAGS='-T embed/prodtest/memory.ld -Wl,--gc-sections -Wl,-Map=build/prodtest/prodtest.map -Wl,--warn-common',
|
||||
CPPPATH=[
|
||||
'embed/prodtest',
|
||||
'embed/trezorhal',
|
||||
|
@ -110,7 +110,7 @@ env.Replace(
|
|||
'vendor/micropython/ports/stm32',
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
'TREZOR_STM32',
|
||||
'TREZOR_MODEL_T',
|
||||
'MCU_SERIES_F4',
|
||||
'STM32F427xx',
|
||||
('STM32_HAL_H', '"<stm32f4xx_hal.h>"'),
|
||||
|
@ -120,7 +120,7 @@ env.Replace(
|
|||
|
||||
env.Replace(
|
||||
BINCTL='tools/binctl',
|
||||
COMBINE_SIGN='tools/combine_sign',
|
||||
KEYCTL='tools/keyctl',
|
||||
)
|
||||
|
||||
#
|
||||
|
@ -133,10 +133,12 @@ obj_program += env.Object(source=SOURCE_PRODTEST)
|
|||
obj_program += env.Object(source=SOURCE_STMHAL)
|
||||
obj_program += env.Object(source=SOURCE_TREZORHAL)
|
||||
|
||||
VENDORHEADER = 'embed/vendorheader/vendorheader_' + ('unsafe_signed_dev.bin' if ARGUMENTS.get('PRODUCTION', '0') == '0' else 'satoshilabs_signed_prod.bin')
|
||||
|
||||
obj_program.extend(
|
||||
env.Command(
|
||||
target='embed/prodtest/vendorheader.o',
|
||||
source='embed/firmware/vendorheader.bin',
|
||||
source=VENDORHEADER,
|
||||
action='$OBJCOPY -I binary -O elf32-littlearm -B arm'
|
||||
' --rename-section .data=.vendorheader,alloc,load,readonly,contents'
|
||||
' $SOURCE $TARGET', ))
|
||||
|
@ -145,7 +147,7 @@ program_elf = env.Command(
|
|||
target='prodtest.elf',
|
||||
source=obj_program,
|
||||
action=
|
||||
'$LINK -o $TARGET $LINKFLAGS $SOURCES `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-file-name=libc_nano.a` `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-libgcc-file-name`',
|
||||
'$LINK -o $TARGET $CCFLAGS $CFLAGS $LINKFLAGS $SOURCES -lc_nano -lgcc',
|
||||
)
|
||||
|
||||
program_bin = env.Command(
|
||||
|
@ -154,6 +156,5 @@ program_bin = env.Command(
|
|||
action=[
|
||||
'$OBJCOPY -O binary -j .vendorheader -j .header -j .flash -j .data $SOURCE $TARGET',
|
||||
'$BINCTL $TARGET -h',
|
||||
'dd if=$TARGET of=build/prodtest/header.tosign bs=1 count=1024 skip=`wc -c < embed/firmware/vendorheader.bin | tr -d " "`',
|
||||
'$BINCTL $TARGET -s 1:2 `$COMBINE_SIGN firmware build/prodtest/header.tosign 4747474747474747474747474747474747474747474747474747474747474747 4848484848484848484848484848484848484848484848484848484848484848`',
|
||||
'$BINCTL $TARGET -s 1:2 `$KEYCTL sign firmware $TARGET 4747474747474747474747474747474747474747474747474747474747474747 4848484848484848484848484848484848484848484848484848484848484848`' if ARGUMENTS.get('PRODUCTION', '0') == '0' else '',
|
||||
], )
|
||||
|
|
|
@ -83,7 +83,7 @@ env.Replace(
|
|||
AS='arm-none-eabi-as',
|
||||
AR='arm-none-eabi-ar',
|
||||
CC='arm-none-eabi-gcc',
|
||||
LINK='arm-none-eabi-ld',
|
||||
LINK='arm-none-eabi-gcc',
|
||||
SIZE='arm-none-eabi-size',
|
||||
STRIP='arm-none-eabi-strip',
|
||||
OBJCOPY='arm-none-eabi-objcopy', )
|
||||
|
@ -99,7 +99,7 @@ env.Replace(
|
|||
'-fstack-protector-all '
|
||||
+ CCFLAGS_MOD,
|
||||
CCFLAGS_QSTR='-DNO_QSTR -DN_X64 -DN_X86 -DN_THUMB',
|
||||
LINKFLAGS='-nostdlib -T embed/reflash/memory.ld --gc-sections -Map=build/reflash/reflash.map --warn-common',
|
||||
LINKFLAGS='-T embed/reflash/memory.ld -Wl,--gc-sections -Wl,-Map=build/reflash/reflash.map -Wl,--warn-common',
|
||||
CPPPATH=[
|
||||
'embed/reflash',
|
||||
'embed/trezorhal',
|
||||
|
@ -110,7 +110,7 @@ env.Replace(
|
|||
'vendor/micropython/ports/stm32',
|
||||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
'TREZOR_STM32',
|
||||
'TREZOR_MODEL_T',
|
||||
'MCU_SERIES_F4',
|
||||
'STM32F427xx',
|
||||
('STM32_HAL_H', '"<stm32f4xx_hal.h>"'),
|
||||
|
@ -120,7 +120,7 @@ env.Replace(
|
|||
|
||||
env.Replace(
|
||||
BINCTL='tools/binctl',
|
||||
COMBINE_SIGN='tools/combine_sign',
|
||||
KEYCTL='tools/keyctl',
|
||||
)
|
||||
|
||||
#
|
||||
|
@ -133,10 +133,12 @@ obj_program += env.Object(source=SOURCE_REFLASH)
|
|||
obj_program += env.Object(source=SOURCE_STMHAL)
|
||||
obj_program += env.Object(source=SOURCE_TREZORHAL)
|
||||
|
||||
VENDORHEADER = 'embed/vendorheader/vendorheader_' + ('unsafe_signed_dev.bin' if ARGUMENTS.get('PRODUCTION', '0') == '0' else 'satoshilabs_signed_prod.bin')
|
||||
|
||||
obj_program.extend(
|
||||
env.Command(
|
||||
target='embed/reflash/vendorheader.o',
|
||||
source='embed/firmware/vendorheader.bin',
|
||||
source=VENDORHEADER,
|
||||
action='$OBJCOPY -I binary -O elf32-littlearm -B arm'
|
||||
' --rename-section .data=.vendorheader,alloc,load,readonly,contents'
|
||||
' $SOURCE $TARGET', ))
|
||||
|
@ -145,7 +147,7 @@ program_elf = env.Command(
|
|||
target='reflash.elf',
|
||||
source=obj_program,
|
||||
action=
|
||||
'$LINK -o $TARGET $LINKFLAGS $SOURCES `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-file-name=libc_nano.a` `$CC $CFLAGS $CCFLAGS $_CCCOMCOM -print-libgcc-file-name`',
|
||||
'$LINK -o $TARGET $CCFLAGS $CFLAGS $LINKFLAGS $SOURCES -lc_nano -lgcc',
|
||||
)
|
||||
|
||||
program_bin = env.Command(
|
||||
|
@ -154,6 +156,5 @@ program_bin = env.Command(
|
|||
action=[
|
||||
'$OBJCOPY -O binary -j .vendorheader -j .header -j .flash -j .data $SOURCE $TARGET',
|
||||
'$BINCTL $TARGET -h',
|
||||
'dd if=$TARGET of=build/reflash/header.tosign bs=1 count=1024 skip=`wc -c < embed/firmware/vendorheader.bin | tr -d " "`',
|
||||
'$BINCTL $TARGET -s 1:2 `$COMBINE_SIGN firmware build/reflash/header.tosign 4747474747474747474747474747474747474747474747474747474747474747 4848484848484848484848484848484848484848484848484848484848484848`',
|
||||
'$BINCTL $TARGET -s 1:2 `$KEYCTL sign firmware $TARGET 4747474747474747474747474747474747474747474747474747474747474747 4848484848484848484848484848484848484848484848484848484848484848`' if ARGUMENTS.get('PRODUCTION', '0') == '0' else '',
|
||||
], )
|
||||
|
|
|
@ -212,13 +212,13 @@ SOURCE_MICROPYTHON = [
|
|||
]
|
||||
|
||||
SOURCE_UNIX = [
|
||||
'vendor/micropython/ports/unix/main.c',
|
||||
'vendor/micropython/ports/unix/gccollect.c',
|
||||
'vendor/micropython/ports/unix/unix_mphal.c',
|
||||
'vendor/micropython/ports/unix/input.c',
|
||||
'vendor/micropython/ports/unix/alloc.c',
|
||||
'embed/unix/common.c',
|
||||
'embed/unix/flash.c',
|
||||
'embed/unix/main.c',
|
||||
'embed/unix/rng.c',
|
||||
'embed/unix/sdcard.c',
|
||||
'embed/unix/sbu.c',
|
||||
|
@ -261,7 +261,7 @@ env.Replace(
|
|||
] + CPPPATH_MOD,
|
||||
CPPDEFINES=[
|
||||
'UNIX',
|
||||
'TREZOR_UNIX',
|
||||
'TREZOR_MODEL_EMU',
|
||||
'MICROPY_USE_READLINE',
|
||||
('MP_CONFIGFILE', '\\"embed/unix/mpconfigport.h\\"'),
|
||||
] + CPPDEFINES_MOD,
|
||||
|
|
After Width: | Height: | Size: 747 KiB |
After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 38 KiB |
BIN
assets/cross.png
Before Width: | Height: | Size: 1.1 KiB |
BIN
assets/lock.png
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 4.9 KiB |
BIN
assets/send.png
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 968 B |
Before Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.2 KiB |
|
@ -12,4 +12,4 @@ docker run -t -v $(pwd)/build-docker:/build:z $IMAGE /bin/sh -c "\
|
|||
ln -s /build build &&
|
||||
git checkout $TAG && \
|
||||
git submodule update --init --recursive && \
|
||||
make clean vendor vendorheader build_boardloader build_bootloader build_prodtest build_firmware"
|
||||
make clean vendor build_boardloader build_bootloader build_prodtest build_firmware"
|
||||
|
|
|
@ -12,4 +12,4 @@ docker run -t -v $(pwd)/build-docker:/build:z $IMAGE /bin/sh -c "\
|
|||
ln -s /build build &&
|
||||
git checkout $TAG && \
|
||||
git submodule update --init --recursive && \
|
||||
make clean vendor vendorheader build_boardloader build_bootloader build_prodtest build_firmware"
|
||||
make clean vendor build_boardloader build_bootloader build_prodtest build_firmware"
|
||||
|
|
|
@ -9,6 +9,12 @@ git clone --recursive https://github.com/trezor/trezor-core.git
|
|||
cd trezor-core
|
||||
```
|
||||
|
||||
If are building the already cloned the project, don't forget to use the following to refresh the submodules:
|
||||
|
||||
```sh
|
||||
make vendor
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
#### Debian/Ubuntu
|
||||
|
|
After Width: | Height: | Size: 152 KiB |
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include STM32_HAL_H
|
||||
|
||||
#include "flash.h"
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BOARDLOADER_LOWLEVEL_H
|
||||
#define BOARDLOADER_LOWLEVEL_H
|
||||
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "common.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define VERSION_MAJOR 2
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 0
|
||||
#define VERSION_MAJOR 2
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 0
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "display.h"
|
||||
|
@ -42,8 +61,8 @@ static const char *format_ver(const char *format, uint32_t version)
|
|||
mini_snprintf(ver_str, sizeof(ver_str), format,
|
||||
(int)(version & 0xFF),
|
||||
(int)((version >> 8) & 0xFF),
|
||||
(int)((version >> 16) & 0xFF),
|
||||
(int)((version >> 24) & 0xFF)
|
||||
(int)((version >> 16) & 0xFF)
|
||||
// ignore build field (int)((version >> 24) & 0xFF)
|
||||
);
|
||||
return ver_str;
|
||||
}
|
||||
|
@ -75,9 +94,9 @@ void ui_screen_boot(const vendor_header * const vhdr, const image_header * const
|
|||
}
|
||||
|
||||
if (show_string) {
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5 - 50, vhdr->vstr, vhdr->vstr_len, FONT_NORMAL, COLOR_WHITE, boot_background, 0);
|
||||
const char *ver_str = format_ver("%d.%d.%d.%d", fw_version);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5 - 25, ver_str, -1, FONT_NORMAL, COLOR_WHITE, boot_background, 0);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5 - 50, vhdr->vstr, vhdr->vstr_len, FONT_NORMAL, COLOR_WHITE, boot_background);
|
||||
const char *ver_str = format_ver("%d.%d.%d", fw_version);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5 - 25, ver_str, -1, FONT_NORMAL, COLOR_WHITE, boot_background);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,12 +105,12 @@ void ui_screen_boot_wait(int wait_seconds)
|
|||
char wait_str[16];
|
||||
mini_snprintf(wait_str, sizeof(wait_str), "starting in %d s", wait_seconds);
|
||||
display_bar(0, DISPLAY_RESY - 5 - 20, DISPLAY_RESX, 5 + 20, boot_background);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5, wait_str, -1, FONT_NORMAL, COLOR_WHITE, boot_background, 0);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5, wait_str, -1, FONT_NORMAL, COLOR_WHITE, boot_background);
|
||||
}
|
||||
|
||||
void ui_screen_boot_click(void) {
|
||||
display_bar(0, DISPLAY_RESY - 5 - 20, DISPLAY_RESX, 5 + 20, boot_background);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5, "click to continue ...", -1, FONT_NORMAL, COLOR_WHITE, boot_background, 0);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 5, "click to continue ...", -1, FONT_NORMAL, COLOR_WHITE, boot_background);
|
||||
}
|
||||
|
||||
// welcome UI
|
||||
|
@ -110,8 +129,8 @@ void ui_screen_second(void)
|
|||
void ui_screen_third(void)
|
||||
{
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_icon((DISPLAY_RESX - 180) / 2, (DISPLAY_RESY - 30) / 2, 180, 30, toi_icon_welcome + 12, sizeof(toi_icon_welcome) - 12, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text_center(120, 220, "Go to trezor.io/start", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_icon((DISPLAY_RESX - 180) / 2, (DISPLAY_RESY - 30) / 2 - 5, 180, 30, toi_icon_welcome + 12, sizeof(toi_icon_welcome) - 12, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text_center(120, 220, "Go to trezor.io/start", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
// info UI
|
||||
|
@ -119,31 +138,31 @@ void ui_screen_third(void)
|
|||
void ui_screen_info(secbool buttons, const vendor_header * const vhdr, const image_header * const hdr)
|
||||
{
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
const char *ver_str = format_ver("Bootloader %d.%d.%d.%d", VERSION_UINT32);
|
||||
display_text(16, 32, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
const char *ver_str = format_ver("Bootloader %d.%d.%d", VERSION_UINT32);
|
||||
display_text(16, 32, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12, COLOR_BL_GRAY, COLOR_WHITE);
|
||||
if (vhdr && hdr) {
|
||||
ver_str = format_ver("Firmware %d.%d.%d.%d", (hdr->version));
|
||||
display_text(55, 70, ver_str, -1, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE, 0);
|
||||
display_text(55, 95, "by", -1, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE, 0);
|
||||
display_text(55, 120, vhdr->vstr, vhdr->vstr_len, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE, 0);
|
||||
ver_str = format_ver("Firmware %d.%d.%d", (hdr->version));
|
||||
display_text(55, 70, ver_str, -1, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE);
|
||||
display_text(55, 95, "by", -1, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE);
|
||||
display_text(55, 120, vhdr->vstr, vhdr->vstr_len, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE);
|
||||
} else {
|
||||
display_text(55, 70, "No Firmware", -1, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE, 0);
|
||||
display_text(55, 70, "No Firmware", -1, FONT_NORMAL, COLOR_BL_GRAY, COLOR_WHITE);
|
||||
}
|
||||
|
||||
if (sectrue == buttons) {
|
||||
display_text_center(120, 170, "Connect to host?", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text_center(120, 170, "Connect to host?", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
ui_confirm_cancel_buttons();
|
||||
} else {
|
||||
display_text_center(120, 220, "Go to trezor.io/start", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text_center(120, 220, "Go to trezor.io/start", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
void ui_screen_info_fingerprint(const image_header * const hdr)
|
||||
{
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(16, 32, "Firmware fingerprint", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text(16, 32, "Firmware fingerprint", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
|
||||
static const char *hexdigits = "0123456789abcdef";
|
||||
|
@ -153,7 +172,7 @@ void ui_screen_info_fingerprint(const image_header * const hdr)
|
|||
fingerprint_str[i * 2 + 1] = hexdigits[hdr->fingerprint[i] & 0xF];
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
display_text_center(120, 70 + i * 25, fingerprint_str + i * 16, 16, FONT_MONO, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text_center(120, 70 + i * 25, fingerprint_str + i * 16, 16, FONT_MONO, COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
display_bar_radius(9, 184, 222, 50, COLOR_BL_DONE, COLOR_WHITE, 4);
|
||||
|
@ -165,27 +184,27 @@ void ui_screen_info_fingerprint(const image_header * const hdr)
|
|||
void ui_screen_install_confirm_upgrade(const vendor_header * const vhdr, const image_header * const hdr)
|
||||
{
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(16, 32, "Firmware update", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text(16, 32, "Firmware update", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 70, "Update firmware by", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text(55, 95, vhdr->vstr, vhdr->vstr_len, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
const char *ver_str = format_ver("to version %d.%d.%d.%d?", hdr->version);
|
||||
display_text(55, 120, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text(55, 70, "Update firmware by", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 95, vhdr->vstr, vhdr->vstr_len, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
const char *ver_str = format_ver("to version %d.%d.%d?", hdr->version);
|
||||
display_text(55, 120, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
ui_confirm_cancel_buttons();
|
||||
}
|
||||
|
||||
void ui_screen_install_confirm_newvendor(const vendor_header * const vhdr, const image_header * const hdr)
|
||||
{
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(16, 32, "Vendor change", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text(16, 32, "Vendor change", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 70, "Install firmware by", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text(55, 95, vhdr->vstr, vhdr->vstr_len, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
const char *ver_str = format_ver("(version %d.%d.%d.%d)?", hdr->version);
|
||||
display_text(55, 120, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text_center(120, 170, "Seed will be erased!", -1, FONT_NORMAL, COLOR_BL_FAIL, COLOR_WHITE, 0);
|
||||
display_text(55, 70, "Install firmware by", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 95, vhdr->vstr, vhdr->vstr_len, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
const char *ver_str = format_ver("(version %d.%d.%d)?", hdr->version);
|
||||
display_text(55, 120, ver_str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text_center(120, 170, "Seed will be erased!", -1, FONT_NORMAL, COLOR_BL_FAIL, COLOR_WHITE);
|
||||
ui_confirm_cancel_buttons();
|
||||
}
|
||||
|
||||
|
@ -193,7 +212,7 @@ void ui_screen_install(void)
|
|||
{
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(0, -20, COLOR_BL_PROCESS, COLOR_WHITE, toi_icon_install, sizeof(toi_icon_install), COLOR_BLACK);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Installing firmware", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Installing firmware", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
void ui_screen_install_progress_erase(int pos, int len)
|
||||
|
@ -211,13 +230,13 @@ void ui_screen_install_progress_upload(int pos)
|
|||
void ui_screen_wipe_confirm(void)
|
||||
{
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_text(16, 32, "Wipe device", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text(16, 32, "Wipe device", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_bar(16, 44, DISPLAY_RESX - 14 * 2, 1, COLOR_BLACK);
|
||||
display_icon(16, 54, 32, 32, toi_icon_info + 12, sizeof(toi_icon_info) - 12, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 70, "Do you want to", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text(55, 95, "wipe the device?", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text(55, 70, "Do you want to", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
display_text(55, 95, "wipe the device?", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
|
||||
display_text_center(120, 170, "Seed will be erased!", -1, FONT_NORMAL, COLOR_BL_FAIL, COLOR_WHITE, 0);
|
||||
display_text_center(120, 170, "Seed will be erased!", -1, FONT_NORMAL, COLOR_BL_FAIL, COLOR_WHITE);
|
||||
ui_confirm_cancel_buttons();
|
||||
}
|
||||
|
||||
|
@ -225,7 +244,7 @@ void ui_screen_wipe(void)
|
|||
{
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(0, -20, COLOR_BL_PROCESS, COLOR_WHITE, toi_icon_wipe, sizeof(toi_icon_wipe), COLOR_BLACK);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Wiping device", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Wiping device", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
void ui_screen_wipe_progress(int pos, int len)
|
||||
|
@ -252,7 +271,7 @@ void ui_screen_done(int restart_seconds, secbool full_redraw)
|
|||
if (secfalse == full_redraw) {
|
||||
display_bar(0, DISPLAY_RESY - 24 - 18, 240, 23, COLOR_WHITE);
|
||||
}
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, str, -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
// error UI
|
||||
|
@ -261,7 +280,7 @@ void ui_screen_fail(void)
|
|||
{
|
||||
display_bar(0, 0, DISPLAY_RESX, DISPLAY_RESY, COLOR_WHITE);
|
||||
display_loader(1000, -20, COLOR_BL_FAIL, COLOR_WHITE, toi_icon_fail, sizeof(toi_icon_fail), COLOR_BLACK);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Failed! Please, reconnect.", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE, 0);
|
||||
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY - 24, "Failed! Please, reconnect.", -1, FONT_NORMAL, COLOR_BLACK, COLOR_WHITE);
|
||||
}
|
||||
|
||||
// general functions
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __BOOTUI_H__
|
||||
#define __BOOTUI_H__
|
||||
|
||||
|
|
|
@ -6,5 +6,5 @@ static const uint8_t toi_icon_install[] = {
|
|||
// compressed data length (32-bit)
|
||||
0xb8, 0x00, 0x00, 0x00,
|
||||
// compressed data
|
||||
0x63, 0x60, 0x18, 0x05, 0xa3, 0x80, 0x58, 0x60, 0xe2, 0xe2, 0xe2, 0x8c, 0x4f, 0xfe, 0xfc, 0xff, 0xff, 0x7f, 0x46, 0xe5, 0xc9, 0x93, 0x5f, 0x83, 0x90, 0x3f, 0x85, 0x45, 0x9a, 0xeb, 0xff, 0x05, 0x98, 0x3c, 0xef, 0xff, 0x05, 0x98, 0xf2, 0xeb, 0xff, 0xff, 0x86, 0xc9, 0xef, 0xff, 0xff, 0x0b, 0x43, 0x9a, 0xe7, 0xff, 0x7f, 0xa0, 0x01, 0x60, 0x79, 0x5e, 0x20, 0xf3, 0x00, 0xba, 0x3c, 0x0b, 0x50, 0xf0, 0x8f, 0x00, 0x48, 0x9e, 0x11, 0x48, 0xfc, 0x77, 0xc0, 0x30, 0xc0, 0x1f, 0x28, 0x7a, 0x09, 0x24, 0xaf, 0x0b, 0x64, 0x7c, 0xc1, 0xb4, 0x9f, 0x09, 0x28, 0xfc, 0xef, 0x3d, 0x04, 0xff, 0x57, 0xc0, 0xe2, 0x01, 0x90, 0x01, 0x50, 0xf0, 0x05, 0x9b, 0xff, 0x99, 0x10, 0xf2, 0x0a, 0x58, 0x03, 0x48, 0x1f, 0x26, 0xfd, 0x09, 0x7b, 0x00, 0x32, 0xc3, 0xe4, 0x0d, 0x70, 0x84, 0x30, 0x1f, 0x44, 0xfa, 0x01, 0xae, 0x18, 0x60, 0x02, 0x39, 0xfd, 0xff, 0x3f, 0x05, 0x9c, 0xd1, 0x27, 0x0b, 0x92, 0xbf, 0x88, 0x3b, 0x7a, 0x19, 0xef, 0xff, 0xff, 0xff, 0x57, 0x00, 0x4f, 0xfc, 0xcb, 0xfc, 0xff, 0x7f, 0x90, 0x01, 0x6f, 0x02, 0xc1, 0x9b, 0x7c, 0x80, 0x06, 0xe0, 0xd7, 0xce, 0xc0, 0x28, 0xc0, 0x30, 0x0a, 0x46, 0x01, 0xf1, 0x00, 0x00,
|
||||
0x63, 0x60, 0x18, 0x05, 0xa3, 0x80, 0x58, 0x60, 0xe2, 0xe2, 0xe2, 0x8c, 0x4f, 0xfe, 0xfc, 0xff, 0xff, 0x7f, 0x46, 0xe5, 0xc9, 0x93, 0x5f, 0x83, 0x90, 0x3f, 0x85, 0x45, 0x9a, 0xeb, 0xff, 0x05, 0x98, 0x3c, 0xef, 0xff, 0x05, 0x98, 0xf2, 0xeb, 0xff, 0xff, 0x86, 0xc9, 0xef, 0xff, 0xff, 0x0b, 0x43, 0x9a, 0xe7, 0xff, 0x7f, 0xa0, 0x01, 0x60, 0x79, 0x5e, 0x20, 0xf3, 0x00, 0xba, 0x3c, 0x0b, 0x50, 0xf0, 0x8f, 0x00, 0x48, 0x9e, 0x11, 0x48, 0xfc, 0x77, 0xc0, 0x30, 0xc0, 0x1f, 0x28, 0x7a, 0x09, 0x24, 0xaf, 0x0b, 0x64, 0x7c, 0xc1, 0xb4, 0x9f, 0x09, 0x28, 0xfc, 0xef, 0x3d, 0x04, 0xff, 0x57, 0xc0, 0xe2, 0x01, 0x90, 0x01, 0x50, 0xf0, 0x05, 0x9b, 0xff, 0x99, 0x10, 0xf2, 0x0a, 0x58, 0x03, 0x48, 0x1f, 0x26, 0xfd, 0x09, 0x7b, 0x00, 0x32, 0xc3, 0xe4, 0x0d, 0x70, 0x84, 0xb0, 0x1d, 0x44, 0xfa, 0x11, 0xae, 0x18, 0x60, 0x02, 0x39, 0xfd, 0xff, 0x3f, 0x05, 0x9c, 0xd1, 0x27, 0x0b, 0x92, 0xbf, 0x88, 0x3b, 0x7a, 0x19, 0xef, 0xff, 0xff, 0xff, 0x57, 0x00, 0x4f, 0xfc, 0xcb, 0xfc, 0xff, 0x7f, 0x90, 0x01, 0x6f, 0x02, 0xc1, 0x9b, 0x7c, 0x80, 0x06, 0xe0, 0xd7, 0xce, 0xc0, 0x28, 0xc0, 0x30, 0x0a, 0x46, 0x01, 0xf1, 0x00, 0x00,
|
||||
};
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
@ -13,6 +32,7 @@
|
|||
|
||||
#include "bootui.h"
|
||||
#include "messages.h"
|
||||
// #include "mpu.h"
|
||||
|
||||
const uint8_t BOOTLOADER_KEY_M = 2;
|
||||
const uint8_t BOOTLOADER_KEY_N = 3;
|
||||
|
@ -28,21 +48,26 @@ static const uint8_t * const BOOTLOADER_KEYS[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
#define USB_IFACE_NUM 0
|
||||
|
||||
static void usb_init_all(void) {
|
||||
|
||||
static const usb_dev_info_t dev_info = {
|
||||
.vendor_id = 0x1209,
|
||||
.product_id = 0x53C0,
|
||||
.release_num = 0x0200,
|
||||
.manufacturer = "SatoshiLabs",
|
||||
.product = "TREZOR",
|
||||
.serial_number = "000000000000000000000000",
|
||||
.interface = "TREZOR Interface",
|
||||
.device_class = 0x00,
|
||||
.device_subclass = 0x00,
|
||||
.device_protocol = 0x00,
|
||||
.vendor_id = 0x1209,
|
||||
.product_id = 0x53C0,
|
||||
.release_num = 0x0200,
|
||||
.manufacturer = "SatoshiLabs",
|
||||
.product = "TREZOR",
|
||||
.serial_number = "000000000000000000000000",
|
||||
.interface = "TREZOR Interface",
|
||||
.usb21_enabled = sectrue,
|
||||
};
|
||||
|
||||
static uint8_t rx_buffer[USB_PACKET_SIZE];
|
||||
|
||||
#if USE_WEBUSB
|
||||
static const usb_webusb_info_t webusb_info = {
|
||||
.iface_num = USB_IFACE_NUM,
|
||||
.ep_in = USB_EP_DIR_IN | 0x01,
|
||||
|
@ -53,46 +78,10 @@ static void usb_init_all(void) {
|
|||
.rx_buffer = rx_buffer,
|
||||
.polling_interval = 1,
|
||||
};
|
||||
#else
|
||||
static const uint8_t hid_report_desc[] = {
|
||||
0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined)
|
||||
0x09, 0x01, // USAGE (1)
|
||||
0xa1, 0x01, // COLLECTION (Application)
|
||||
0x09, 0x20, // USAGE (Input Report Data)
|
||||
0x15, 0x00, // LOGICAL_MINIMUM (0)
|
||||
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
|
||||
0x75, 0x08, // REPORT_SIZE (8)
|
||||
0x95, 0x40, // REPORT_COUNT (64)
|
||||
0x81, 0x02, // INPUT (Data,Var,Abs)
|
||||
0x09, 0x21, // USAGE (Output Report Data)
|
||||
0x15, 0x00, // LOGICAL_MINIMUM (0)
|
||||
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
|
||||
0x75, 0x08, // REPORT_SIZE (8)
|
||||
0x95, 0x40, // REPORT_COUNT (64)
|
||||
0x91, 0x02, // OUTPUT (Data,Var,Abs)
|
||||
0xc0 // END_COLLECTION
|
||||
};
|
||||
static const usb_hid_info_t hid_info = {
|
||||
.iface_num = USB_IFACE_NUM,
|
||||
.ep_in = USB_EP_DIR_IN | 0x01,
|
||||
.ep_out = USB_EP_DIR_OUT | 0x01,
|
||||
.subclass = 0,
|
||||
.protocol = 0,
|
||||
.max_packet_len = sizeof(rx_buffer),
|
||||
.rx_buffer = rx_buffer,
|
||||
.polling_interval = 1,
|
||||
.report_desc_len = sizeof(hid_report_desc),
|
||||
.report_desc = hid_report_desc,
|
||||
};
|
||||
#endif
|
||||
|
||||
usb_init(&dev_info);
|
||||
|
||||
#if USE_WEBUSB
|
||||
ensure(usb_webusb_add(&webusb_info), NULL);
|
||||
#else
|
||||
ensure(usb_hid_add(&hid_info), NULL);
|
||||
#endif
|
||||
|
||||
usb_start();
|
||||
}
|
||||
|
@ -104,11 +93,7 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
|
|||
uint8_t buf[USB_PACKET_SIZE];
|
||||
|
||||
for (;;) {
|
||||
#if USE_WEBUSB
|
||||
int r = usb_webusb_read_blocking(USB_IFACE_NUM, buf, USB_PACKET_SIZE, USB_TIMEOUT);
|
||||
#else
|
||||
int r = usb_hid_read_blocking(USB_IFACE_NUM, buf, USB_PACKET_SIZE, USB_TIMEOUT);
|
||||
#endif
|
||||
if (r != USB_PACKET_SIZE) {
|
||||
continue;
|
||||
}
|
||||
|
@ -187,6 +172,9 @@ static secbool bootloader_usb_loop(const vendor_header * const vhdr, const image
|
|||
return sectrue; // jump to firmware
|
||||
}
|
||||
break;
|
||||
case 55: // GetFeatures
|
||||
process_msg_GetFeatures(USB_IFACE_NUM, msg_size, buf, vhdr, hdr);
|
||||
break;
|
||||
default:
|
||||
process_msg_unknown(USB_IFACE_NUM, msg_size, buf);
|
||||
break;
|
||||
|
@ -261,14 +249,20 @@ main_start:
|
|||
image_header hdr;
|
||||
secbool firmware_present;
|
||||
|
||||
// detect whether the devices contains a firmware
|
||||
// detect whether the devices contains a valid firmware
|
||||
|
||||
firmware_present = load_vendor_header_keys((const uint8_t *)FIRMWARE_START, &vhdr);
|
||||
if (sectrue == firmware_present) {
|
||||
firmware_present = check_vendor_keys_lock(&vhdr);
|
||||
}
|
||||
if (sectrue == firmware_present) {
|
||||
firmware_present = load_image_header((const uint8_t *)(FIRMWARE_START + vhdr.hdrlen), FIRMWARE_IMAGE_MAGIC, FIRMWARE_IMAGE_MAXSIZE, vhdr.vsig_m, vhdr.vsig_n, vhdr.vpub, &hdr);
|
||||
}
|
||||
if (sectrue == firmware_present) {
|
||||
firmware_present = check_image_contents(&hdr, IMAGE_HEADER_SIZE + vhdr.hdrlen, firmware_sectors, FIRMWARE_SECTORS_COUNT);
|
||||
}
|
||||
|
||||
// start the bootloader if no firmware found ...
|
||||
// start the bootloader if no or broken firmware found ...
|
||||
if (firmware_present != sectrue) {
|
||||
// show intro animation
|
||||
|
||||
|
@ -379,6 +373,9 @@ main_start:
|
|||
ui_fadeout();
|
||||
}
|
||||
|
||||
// mpu_config();
|
||||
// jump_to_unprivileged(FIRMWARE_START + vhdr.hdrlen + IMAGE_HEADER_SIZE);
|
||||
|
||||
jump_to(FIRMWARE_START + vhdr.hdrlen + IMAGE_HEADER_SIZE);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <pb.h>
|
||||
|
@ -73,11 +92,7 @@ static bool _usb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count)
|
|||
memcpy(state->buf + state->packet_pos, buf + written, USB_PACKET_SIZE - state->packet_pos);
|
||||
written += USB_PACKET_SIZE - state->packet_pos;
|
||||
// send packet
|
||||
#if USE_WEBUSB
|
||||
int r = usb_webusb_write_blocking(state->iface_num, state->buf, USB_PACKET_SIZE, USB_TIMEOUT);
|
||||
#else
|
||||
int r = usb_hid_write_blocking(state->iface_num, state->buf, USB_PACKET_SIZE, USB_TIMEOUT);
|
||||
#endif
|
||||
ensure(sectrue * (r == USB_PACKET_SIZE), NULL);
|
||||
// prepare new packet
|
||||
state->packet_index++;
|
||||
|
@ -98,11 +113,7 @@ static void _usb_write_flush(usb_write_state *state)
|
|||
memset(state->buf + state->packet_pos, 0, USB_PACKET_SIZE - state->packet_pos);
|
||||
}
|
||||
// send packet
|
||||
#if USE_WEBUSB
|
||||
int r = usb_webusb_write_blocking(state->iface_num, state->buf, USB_PACKET_SIZE, USB_TIMEOUT);
|
||||
#else
|
||||
int r = usb_hid_write_blocking(state->iface_num, state->buf, USB_PACKET_SIZE, USB_TIMEOUT);
|
||||
#endif
|
||||
ensure(sectrue * (r == USB_PACKET_SIZE), NULL);
|
||||
}
|
||||
|
||||
|
@ -151,6 +162,8 @@ static secbool _send_msg(uint8_t iface_num, uint16_t msg_id, const pb_field_t fi
|
|||
#define MSG_SEND_INIT(TYPE) TYPE msg_send = TYPE##_init_default
|
||||
#define MSG_SEND_ASSIGN_VALUE(FIELD, VALUE) { msg_send.has_##FIELD = true; msg_send.FIELD = VALUE; }
|
||||
#define MSG_SEND_ASSIGN_STRING(FIELD, VALUE) { msg_send.has_##FIELD = true; memset(msg_send.FIELD, 0, sizeof(msg_send.FIELD)); strncpy(msg_send.FIELD, VALUE, sizeof(msg_send.FIELD) - 1); }
|
||||
#define MSG_SEND_ASSIGN_STRING_LEN(FIELD, VALUE, LEN) { msg_send.has_##FIELD = true; memset(msg_send.FIELD, 0, sizeof(msg_send.FIELD)); strncpy(msg_send.FIELD, VALUE, MIN(LEN, sizeof(msg_send.FIELD) - 1)); }
|
||||
#define MSG_SEND_ASSIGN_BYTES(FIELD, VALUE, LEN) { msg_send.has_##FIELD = true; memset(msg_send.FIELD.bytes, 0, sizeof(msg_send.FIELD.bytes)); memcpy(msg_send.FIELD.bytes, VALUE, MIN(LEN, sizeof(msg_send.FIELD.bytes))); msg_send.FIELD.size = MIN(LEN, sizeof(msg_send.FIELD.bytes)); }
|
||||
#define MSG_SEND(TYPE) _send_msg(iface_num, MessageType_MessageType_##TYPE, TYPE##_fields, &msg_send)
|
||||
|
||||
typedef struct {
|
||||
|
@ -182,11 +195,7 @@ static bool _usb_read(pb_istream_t *stream, uint8_t *buf, size_t count)
|
|||
memcpy(buf + read, state->buf + state->packet_pos, USB_PACKET_SIZE - state->packet_pos);
|
||||
read += USB_PACKET_SIZE - state->packet_pos;
|
||||
// read next packet
|
||||
#if USE_WEBUSB
|
||||
int r = usb_webusb_read_blocking(state->iface_num, state->buf, USB_PACKET_SIZE, USB_TIMEOUT);
|
||||
#else
|
||||
int r = usb_hid_read_blocking(state->iface_num, state->buf, USB_PACKET_SIZE, USB_TIMEOUT);
|
||||
#endif
|
||||
ensure(sectrue * (r == USB_PACKET_SIZE), NULL);
|
||||
// prepare next packet
|
||||
state->packet_index++;
|
||||
|
@ -239,23 +248,44 @@ void send_user_abort(uint8_t iface_num, const char *msg)
|
|||
MSG_SEND(Failure);
|
||||
}
|
||||
|
||||
void process_msg_Initialize(uint8_t iface_num, uint32_t msg_size, uint8_t *buf, const vendor_header * const vhdr, const image_header * const hdr)
|
||||
static void send_msg_features(uint8_t iface_num, const vendor_header * const vhdr, const image_header * const hdr)
|
||||
{
|
||||
MSG_RECV_INIT(Initialize);
|
||||
MSG_RECV(Initialize);
|
||||
|
||||
MSG_SEND_INIT(Features);
|
||||
MSG_SEND_ASSIGN_STRING(vendor, "trezor.io");
|
||||
MSG_SEND_ASSIGN_VALUE(major_version, VERSION_MAJOR);
|
||||
MSG_SEND_ASSIGN_VALUE(minor_version, VERSION_MINOR);
|
||||
MSG_SEND_ASSIGN_VALUE(patch_version, VERSION_PATCH);
|
||||
MSG_SEND_ASSIGN_VALUE(bootloader_mode, true);
|
||||
MSG_SEND_ASSIGN_VALUE(firmware_present, (vhdr && hdr));
|
||||
MSG_SEND_ASSIGN_STRING(model, "T");
|
||||
// TODO: pass info about installed firmware (vendor, version, etc.)
|
||||
if (vhdr && hdr) {
|
||||
MSG_SEND_ASSIGN_VALUE(firmware_present, true);
|
||||
MSG_SEND_ASSIGN_VALUE(fw_major, (hdr->version & 0xFF));
|
||||
MSG_SEND_ASSIGN_VALUE(fw_minor, ((hdr->version >> 8) & 0xFF));
|
||||
MSG_SEND_ASSIGN_VALUE(fw_patch, ((hdr->version >> 16) & 0xFF));
|
||||
MSG_SEND_ASSIGN_STRING_LEN(fw_vendor, vhdr->vstr, vhdr->vstr_len);
|
||||
uint8_t hash[32];
|
||||
vendor_keys_hash(vhdr, hash);
|
||||
MSG_SEND_ASSIGN_BYTES(fw_vendor_keys, hash, 32);
|
||||
} else {
|
||||
MSG_SEND_ASSIGN_VALUE(firmware_present, false);
|
||||
}
|
||||
MSG_SEND(Features);
|
||||
}
|
||||
|
||||
void process_msg_Initialize(uint8_t iface_num, uint32_t msg_size, uint8_t *buf, const vendor_header * const vhdr, const image_header * const hdr)
|
||||
{
|
||||
MSG_RECV_INIT(Initialize);
|
||||
MSG_RECV(Initialize);
|
||||
send_msg_features(iface_num, vhdr, hdr);
|
||||
}
|
||||
|
||||
void process_msg_GetFeatures(uint8_t iface_num, uint32_t msg_size, uint8_t *buf, const vendor_header * const vhdr, const image_header * const hdr)
|
||||
{
|
||||
MSG_RECV_INIT(GetFeatures);
|
||||
MSG_RECV(GetFeatures);
|
||||
send_msg_features(iface_num, vhdr, hdr);
|
||||
}
|
||||
|
||||
void process_msg_Ping(uint8_t iface_num, uint32_t msg_size, uint8_t *buf)
|
||||
{
|
||||
MSG_RECV_INIT(Ping);
|
||||
|
@ -435,7 +465,7 @@ int process_msg_FirmwareUpload(uint8_t iface_num, uint32_t msg_size, uint8_t *bu
|
|||
ui_fadeout();
|
||||
ui_screen_info(secfalse, ¤t_vhdr, ¤t_hdr);
|
||||
ui_fadein();
|
||||
send_user_abort(USB_IFACE_NUM, "Firmware install cancelled");
|
||||
send_user_abort(iface_num, "Firmware install cancelled");
|
||||
return -4;
|
||||
}
|
||||
|
||||
|
@ -538,13 +568,15 @@ int process_msg_WipeDevice(uint8_t iface_num, uint32_t msg_size, uint8_t *buf)
|
|||
void process_msg_unknown(uint8_t iface_num, uint32_t msg_size, uint8_t *buf)
|
||||
{
|
||||
// consume remaining message
|
||||
int remaining_chunks = (msg_size - (USB_PACKET_SIZE - MSG_HEADER1_LEN)) / (USB_PACKET_SIZE - MSG_HEADER2_LEN);
|
||||
int remaining_chunks = 0;
|
||||
|
||||
if (msg_size > (USB_PACKET_SIZE - MSG_HEADER1_LEN)) {
|
||||
// calculate how many blocks need to be read to drain the message (rounded up to not leave any behind)
|
||||
remaining_chunks = (msg_size - (USB_PACKET_SIZE - MSG_HEADER1_LEN) + ((USB_PACKET_SIZE - MSG_HEADER2_LEN) - 1)) / (USB_PACKET_SIZE - MSG_HEADER2_LEN);
|
||||
}
|
||||
|
||||
for (int i = 0; i < remaining_chunks; i++) {
|
||||
#if USE_WEBUSB
|
||||
int r = usb_webusb_read_blocking(USB_IFACE_NUM, buf, USB_PACKET_SIZE, USB_TIMEOUT);
|
||||
#else
|
||||
int r = usb_hid_read_blocking(USB_IFACE_NUM, buf, USB_PACKET_SIZE, USB_TIMEOUT);
|
||||
#endif
|
||||
int r = usb_webusb_read_blocking(iface_num, buf, USB_PACKET_SIZE, USB_TIMEOUT);
|
||||
ensure(sectrue * (r == USB_PACKET_SIZE), NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __MESSAGES_H__
|
||||
#define __MESSAGES_H__
|
||||
|
||||
|
@ -5,11 +24,8 @@
|
|||
#include "image.h"
|
||||
#include "secbool.h"
|
||||
|
||||
#define USE_WEBUSB 1
|
||||
|
||||
#define USB_TIMEOUT 100
|
||||
#define USB_TIMEOUT 500
|
||||
#define USB_PACKET_SIZE 64
|
||||
#define USB_IFACE_NUM 0
|
||||
|
||||
#define FIRMWARE_SECTORS_COUNT 13
|
||||
extern const uint8_t firmware_sectors[FIRMWARE_SECTORS_COUNT];
|
||||
|
@ -19,6 +35,7 @@ secbool msg_parse_header(const uint8_t *buf, uint16_t *msg_id, uint32_t *msg_siz
|
|||
void send_user_abort(uint8_t iface_num, const char *msg);
|
||||
|
||||
void process_msg_Initialize(uint8_t iface_num, uint32_t msg_size, uint8_t *buf, const vendor_header * const vhdr, const image_header * const hdr);
|
||||
void process_msg_GetFeatures(uint8_t iface_num, uint32_t msg_size, uint8_t *buf, const vendor_header * const vhdr, const image_header * const hdr);
|
||||
void process_msg_Ping(uint8_t iface_num, uint32_t msg_size, uint8_t *buf);
|
||||
void process_msg_FirmwareErase(uint8_t iface_num, uint32_t msg_size, uint8_t *buf);
|
||||
int process_msg_FirmwareUpload(uint8_t iface_num, uint32_t msg_size, uint8_t *buf);
|
||||
|
|
|
@ -5,6 +5,8 @@ Features.label max_size:33
|
|||
Features.revision max_size:20
|
||||
Features.bootloader_hash max_size:32
|
||||
Features.model max_size:17
|
||||
Features.fw_vendor max_size:256
|
||||
Features.fw_vendor_keys max_size:32
|
||||
|
||||
Ping.message max_size:256
|
||||
|
||||
|
|
|
@ -18,25 +18,24 @@ const pb_field_t GetFeatures_fields[1] = {
|
|||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
const pb_field_t Features_fields[19] = {
|
||||
const pb_field_t Features_fields[18] = {
|
||||
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, Features, vendor, vendor, 0),
|
||||
PB_FIELD( 2, UINT32 , OPTIONAL, STATIC , OTHER, Features, major_version, vendor, 0),
|
||||
PB_FIELD( 3, UINT32 , OPTIONAL, STATIC , OTHER, Features, minor_version, major_version, 0),
|
||||
PB_FIELD( 4, UINT32 , OPTIONAL, STATIC , OTHER, Features, patch_version, minor_version, 0),
|
||||
PB_FIELD( 5, BOOL , OPTIONAL, STATIC , OTHER, Features, bootloader_mode, patch_version, 0),
|
||||
PB_FIELD( 6, STRING , OPTIONAL, STATIC , OTHER, Features, device_id, bootloader_mode, 0),
|
||||
PB_FIELD( 7, BOOL , OPTIONAL, STATIC , OTHER, Features, pin_protection, device_id, 0),
|
||||
PB_FIELD( 8, BOOL , OPTIONAL, STATIC , OTHER, Features, passphrase_protection, pin_protection, 0),
|
||||
PB_FIELD( 9, STRING , OPTIONAL, STATIC , OTHER, Features, language, passphrase_protection, 0),
|
||||
PB_FIELD( 9, STRING , OPTIONAL, STATIC , OTHER, Features, language, device_id, 0),
|
||||
PB_FIELD( 10, STRING , OPTIONAL, STATIC , OTHER, Features, label, language, 0),
|
||||
PB_FIELD( 12, BOOL , OPTIONAL, STATIC , OTHER, Features, initialized, label, 0),
|
||||
PB_FIELD( 13, BYTES , OPTIONAL, STATIC , OTHER, Features, revision, initialized, 0),
|
||||
PB_FIELD( 14, BYTES , OPTIONAL, STATIC , OTHER, Features, bootloader_hash, revision, 0),
|
||||
PB_FIELD( 15, BOOL , OPTIONAL, STATIC , OTHER, Features, imported, bootloader_hash, 0),
|
||||
PB_FIELD( 16, BOOL , OPTIONAL, STATIC , OTHER, Features, pin_cached, imported, 0),
|
||||
PB_FIELD( 17, BOOL , OPTIONAL, STATIC , OTHER, Features, passphrase_cached, pin_cached, 0),
|
||||
PB_FIELD( 18, BOOL , OPTIONAL, STATIC , OTHER, Features, firmware_present, passphrase_cached, 0),
|
||||
PB_FIELD( 18, BOOL , OPTIONAL, STATIC , OTHER, Features, firmware_present, revision, 0),
|
||||
PB_FIELD( 21, STRING , OPTIONAL, STATIC , OTHER, Features, model, firmware_present, 0),
|
||||
PB_FIELD( 22, UINT32 , OPTIONAL, STATIC , OTHER, Features, fw_major, model, 0),
|
||||
PB_FIELD( 23, UINT32 , OPTIONAL, STATIC , OTHER, Features, fw_minor, fw_major, 0),
|
||||
PB_FIELD( 24, UINT32 , OPTIONAL, STATIC , OTHER, Features, fw_patch, fw_minor, 0),
|
||||
PB_FIELD( 25, STRING , OPTIONAL, STATIC , OTHER, Features, fw_vendor, fw_patch, 0),
|
||||
PB_FIELD( 26, BYTES , OPTIONAL, STATIC , OTHER, Features, fw_vendor_keys, fw_vendor, 0),
|
||||
PB_LAST_FIELD
|
||||
};
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ typedef struct _Failure {
|
|||
} Failure;
|
||||
|
||||
typedef PB_BYTES_ARRAY_T(20) Features_revision_t;
|
||||
typedef PB_BYTES_ARRAY_T(32) Features_bootloader_hash_t;
|
||||
typedef PB_BYTES_ARRAY_T(32) Features_fw_vendor_keys_t;
|
||||
typedef struct _Features {
|
||||
bool has_vendor;
|
||||
char vendor[33];
|
||||
|
@ -81,10 +81,6 @@ typedef struct _Features {
|
|||
bool bootloader_mode;
|
||||
bool has_device_id;
|
||||
char device_id[25];
|
||||
bool has_pin_protection;
|
||||
bool pin_protection;
|
||||
bool has_passphrase_protection;
|
||||
bool passphrase_protection;
|
||||
bool has_language;
|
||||
char language[17];
|
||||
bool has_label;
|
||||
|
@ -93,18 +89,20 @@ typedef struct _Features {
|
|||
bool initialized;
|
||||
bool has_revision;
|
||||
Features_revision_t revision;
|
||||
bool has_bootloader_hash;
|
||||
Features_bootloader_hash_t bootloader_hash;
|
||||
bool has_imported;
|
||||
bool imported;
|
||||
bool has_pin_cached;
|
||||
bool pin_cached;
|
||||
bool has_passphrase_cached;
|
||||
bool passphrase_cached;
|
||||
bool has_firmware_present;
|
||||
bool firmware_present;
|
||||
bool has_model;
|
||||
char model[17];
|
||||
bool has_fw_major;
|
||||
uint32_t fw_major;
|
||||
bool has_fw_minor;
|
||||
uint32_t fw_minor;
|
||||
bool has_fw_patch;
|
||||
uint32_t fw_patch;
|
||||
bool has_fw_vendor;
|
||||
char fw_vendor[256];
|
||||
bool has_fw_vendor_keys;
|
||||
Features_fw_vendor_keys_t fw_vendor_keys;
|
||||
/* @@protoc_insertion_point(struct:Features) */
|
||||
} Features;
|
||||
|
||||
|
@ -153,7 +151,7 @@ typedef struct _Success {
|
|||
/* Initializer values for message structs */
|
||||
#define Initialize_init_default {0}
|
||||
#define GetFeatures_init_default {0}
|
||||
#define Features_init_default {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, "", false, "", false, 0, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0, false, 0, false, 0, false, ""}
|
||||
#define Features_init_default {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}, false, 0, false, "", false, 0, false, 0, false, 0, false, "", false, {0, {0}}}
|
||||
#define Ping_init_default {false, "", false, 0, false, 0, false, 0}
|
||||
#define Success_init_default {false, ""}
|
||||
#define Failure_init_default {false, (FailureType)0, false, ""}
|
||||
|
@ -164,7 +162,7 @@ typedef struct _Success {
|
|||
#define FirmwareUpload_init_default {{{NULL}, NULL}, false, {0, {0}}}
|
||||
#define Initialize_init_zero {0}
|
||||
#define GetFeatures_init_zero {0}
|
||||
#define Features_init_zero {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, "", false, "", false, 0, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0, false, 0, false, 0, false, ""}
|
||||
#define Features_init_zero {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, "", false, "", false, 0, false, {0, {0}}, false, 0, false, "", false, 0, false, 0, false, 0, false, "", false, {0, {0}}}
|
||||
#define Ping_init_zero {false, "", false, 0, false, 0, false, 0}
|
||||
#define Success_init_zero {false, ""}
|
||||
#define Failure_init_zero {false, (FailureType)0, false, ""}
|
||||
|
@ -185,18 +183,17 @@ typedef struct _Success {
|
|||
#define Features_patch_version_tag 4
|
||||
#define Features_bootloader_mode_tag 5
|
||||
#define Features_device_id_tag 6
|
||||
#define Features_pin_protection_tag 7
|
||||
#define Features_passphrase_protection_tag 8
|
||||
#define Features_language_tag 9
|
||||
#define Features_label_tag 10
|
||||
#define Features_initialized_tag 12
|
||||
#define Features_revision_tag 13
|
||||
#define Features_bootloader_hash_tag 14
|
||||
#define Features_imported_tag 15
|
||||
#define Features_pin_cached_tag 16
|
||||
#define Features_passphrase_cached_tag 17
|
||||
#define Features_firmware_present_tag 18
|
||||
#define Features_model_tag 21
|
||||
#define Features_fw_major_tag 22
|
||||
#define Features_fw_minor_tag 23
|
||||
#define Features_fw_patch_tag 24
|
||||
#define Features_fw_vendor_tag 25
|
||||
#define Features_fw_vendor_keys_tag 26
|
||||
#define FirmwareErase_length_tag 1
|
||||
#define FirmwareRequest_offset_tag 1
|
||||
#define FirmwareRequest_length_tag 2
|
||||
|
@ -211,7 +208,7 @@ typedef struct _Success {
|
|||
/* Struct field encoding specification for nanopb */
|
||||
extern const pb_field_t Initialize_fields[1];
|
||||
extern const pb_field_t GetFeatures_fields[1];
|
||||
extern const pb_field_t Features_fields[19];
|
||||
extern const pb_field_t Features_fields[18];
|
||||
extern const pb_field_t Ping_fields[5];
|
||||
extern const pb_field_t Success_fields[2];
|
||||
extern const pb_field_t Failure_fields[3];
|
||||
|
@ -224,7 +221,7 @@ extern const pb_field_t FirmwareUpload_fields[3];
|
|||
/* Maximum encoded size of messages (where known) */
|
||||
#define Initialize_size 0
|
||||
#define GetFeatures_size 0
|
||||
#define Features_size 229
|
||||
#define Features_size 499
|
||||
#define Ping_size 265
|
||||
#define Success_size 259
|
||||
#define Failure_size 270
|
||||
|
|
|
@ -37,27 +37,32 @@ message GetFeatures {
|
|||
* @prev GetFeatures
|
||||
*/
|
||||
message Features {
|
||||
optional string vendor = 1; // name of the manufacturer, e.g. "bitcointrezor.com"
|
||||
optional uint32 major_version = 2; // major version of the device, e.g. 1
|
||||
optional uint32 minor_version = 3; // minor version of the device, e.g. 0
|
||||
optional uint32 patch_version = 4; // patch version of the device, e.g. 0
|
||||
optional string vendor = 1; // name of the manufacturer, e.g. "trezor.io"
|
||||
optional uint32 major_version = 2; // major version of the firmware/bootloader, e.g. 1
|
||||
optional uint32 minor_version = 3; // minor version of the firmware/bootloader, e.g. 0
|
||||
optional uint32 patch_version = 4; // patch version of the firmware/bootloader, e.g. 0
|
||||
optional bool bootloader_mode = 5; // is device in bootloader mode?
|
||||
optional string device_id = 6; // device's unique identifier
|
||||
optional bool pin_protection = 7; // is device protected by PIN?
|
||||
optional bool passphrase_protection = 8; // is node/mnemonic encrypted using passphrase?
|
||||
// optional bool pin_protection = 7; // is device protected by PIN?
|
||||
// optional bool passphrase_protection = 8; // is node/mnemonic encrypted using passphrase?
|
||||
optional string language = 9; // device language
|
||||
optional string label = 10; // device description label
|
||||
// repeated CoinType coins = 11; // supported coins
|
||||
optional bool initialized = 12; // does device contain seed?
|
||||
optional bytes revision = 13; // SCM revision of firmware
|
||||
optional bytes bootloader_hash = 14; // hash of the bootloader
|
||||
optional bool imported = 15; // was storage imported from an external source?
|
||||
optional bool pin_cached = 16; // is PIN already cached in session?
|
||||
optional bool passphrase_cached = 17; // is passphrase already cached in session?
|
||||
// optional bytes bootloader_hash = 14; // hash of the bootloader
|
||||
// optional bool imported = 15; // was storage imported from an external source?
|
||||
// optional bool pin_cached = 16; // is PIN already cached in session?
|
||||
// optional bool passphrase_cached = 17; // is passphrase already cached in session?
|
||||
optional bool firmware_present = 18; // is valid firmware loaded?
|
||||
// optional bool needs_backup = 19; // does storage need backup? (equals to Storage.needs_backup)
|
||||
// optional uint32 flags = 20; // device flags (equals to Storage.flags)
|
||||
optional string model = 21; // device hardware model
|
||||
optional uint32 fw_major = 22; // reported firmware version if in bootloader mode
|
||||
optional uint32 fw_minor = 23; // reported firmware version if in bootloader mode
|
||||
optional uint32 fw_patch = 24; // reported firmware version if in bootloader mode
|
||||
optional string fw_vendor = 25; // reported firmware vendor if in bootloader mode
|
||||
optional bytes fw_vendor_keys = 26; // reported firmware vendor keys (their hash)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define VERSION_MAJOR 2
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 0
|
||||
#define VERSION_UINT32 (VERSION_MAJOR | (VERSION_MINOR << 8) | (VERSION_PATCH << 16) | (VERSION_BUILD << 24))
|
||||
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, Jan Pochyla, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/runtime.h"
|
||||
|
@ -21,10 +33,27 @@
|
|||
/// '''
|
||||
STATIC mp_obj_t mod_trezorconfig_init(void) {
|
||||
storage_init();
|
||||
// wipe storage when debug build is used
|
||||
if (MP_STATE_VM(mp_optimise_value) == 0) {
|
||||
storage_wipe();
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorconfig_init_obj, mod_trezorconfig_init);
|
||||
|
||||
/// def check_pin(pin: int, waitcallback: (int, int -> None)) -> bool:
|
||||
/// '''
|
||||
/// Check the given PIN. Returns True on success, False on failure.
|
||||
/// '''
|
||||
STATIC mp_obj_t mod_trezorconfig_check_pin(mp_obj_t pin, mp_obj_t waitcallback) {
|
||||
uint32_t pin_i = mp_obj_get_int(pin);
|
||||
if (sectrue != storage_check_pin(pin_i, waitcallback)) {
|
||||
return mp_const_false;
|
||||
}
|
||||
return mp_const_true;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_trezorconfig_check_pin_obj, mod_trezorconfig_check_pin);
|
||||
|
||||
/// def unlock(pin: int, waitcallback: (int, int -> None)) -> bool:
|
||||
/// '''
|
||||
/// Attempts to unlock the storage with given PIN. Returns True on
|
||||
|
@ -118,6 +147,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorconfig_wipe_obj, mod_trezorconfig_wip
|
|||
STATIC const mp_rom_map_elem_t mp_module_trezorconfig_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorconfig) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&mod_trezorconfig_init_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_check_pin), MP_ROM_PTR(&mod_trezorconfig_check_pin_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_unlock), MP_ROM_PTR(&mod_trezorconfig_unlock_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_has_pin), MP_ROM_PTR(&mod_trezorconfig_has_pin_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_change_pin), MP_ROM_PTR(&mod_trezorconfig_change_pin_obj) },
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "norcow.h"
|
||||
|
@ -196,10 +215,7 @@ static void compact()
|
|||
|
||||
// copy the last item
|
||||
uint32_t posw;
|
||||
r = write_item(norcow_next_sector, offsetw, k, v, l, &posw);
|
||||
if (sectrue != r) {
|
||||
// TODO: error
|
||||
}
|
||||
ensure(write_item(norcow_next_sector, offsetw, k, v, l, &posw), "compaction write failed");
|
||||
offsetw = posw;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __NORCOW_H__
|
||||
#define __NORCOW_H__
|
||||
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, Jan Pochyla, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
@ -119,7 +131,7 @@ static secbool pin_get_fails(const uint32_t **pinfail, uint32_t *pofs)
|
|||
return sectrue;
|
||||
}
|
||||
|
||||
static secbool pin_check(uint32_t pin, mp_obj_t callback)
|
||||
secbool storage_check_pin(uint32_t pin, mp_obj_t callback)
|
||||
{
|
||||
const uint32_t *pinfail = NULL;
|
||||
uint32_t ofs;
|
||||
|
@ -136,11 +148,23 @@ static secbool pin_check(uint32_t pin, mp_obj_t callback)
|
|||
pin_fails_check_max(ctr);
|
||||
|
||||
// Sleep for ~ctr seconds before checking the PIN.
|
||||
uint32_t progress;
|
||||
for (uint32_t wait = ~ctr; wait > 0; wait--) {
|
||||
if (mp_obj_is_callable(callback)) {
|
||||
mp_call_function_2(callback, mp_obj_new_int(wait), mp_obj_new_int(~ctr));
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (mp_obj_is_callable(callback)) {
|
||||
if ((~ctr) > 1000000) { // precise enough
|
||||
progress = (~ctr - wait) / ((~ctr) / 1000);
|
||||
} else {
|
||||
progress = ((~ctr - wait) * 10 + i) * 100 / (~ctr);
|
||||
}
|
||||
mp_call_function_2(callback, mp_obj_new_int(wait), mp_obj_new_int(progress));
|
||||
}
|
||||
hal_delay(100);
|
||||
}
|
||||
hal_delay(1000);
|
||||
}
|
||||
// Show last frame if we were waiting
|
||||
if ((~ctr > 0) && mp_obj_is_callable(callback)) {
|
||||
mp_call_function_2(callback, mp_obj_new_int(0), mp_obj_new_int(1000));
|
||||
}
|
||||
|
||||
// First, we increase PIN fail counter in storage, even before checking the
|
||||
|
@ -161,7 +185,7 @@ static secbool pin_check(uint32_t pin, mp_obj_t callback)
|
|||
secbool storage_unlock(const uint32_t pin, mp_obj_t callback)
|
||||
{
|
||||
unlocked = secfalse;
|
||||
if (sectrue == initialized && sectrue == pin_check(pin, callback)) {
|
||||
if (sectrue == initialized && sectrue == storage_check_pin(pin, callback)) {
|
||||
unlocked = sectrue;
|
||||
}
|
||||
return unlocked;
|
||||
|
@ -196,10 +220,7 @@ secbool storage_has_pin(void)
|
|||
if (sectrue != initialized) {
|
||||
return secfalse;
|
||||
}
|
||||
const void *spin = NULL;
|
||||
uint16_t spinlen = 0;
|
||||
norcow_get(PIN_KEY, &spin, &spinlen);
|
||||
return sectrue * (0 != spinlen);
|
||||
return sectrue == pin_cmp(1) ? secfalse : sectrue;
|
||||
}
|
||||
|
||||
secbool storage_change_pin(const uint32_t pin, const uint32_t newpin, mp_obj_t callback)
|
||||
|
@ -207,7 +228,7 @@ secbool storage_change_pin(const uint32_t pin, const uint32_t newpin, mp_obj_t c
|
|||
if (sectrue != initialized || sectrue != unlocked) {
|
||||
return secfalse;
|
||||
}
|
||||
if (sectrue != pin_check(pin, callback)) {
|
||||
if (sectrue != storage_check_pin(pin, callback)) {
|
||||
return secfalse;
|
||||
}
|
||||
return norcow_set(PIN_KEY, &newpin, sizeof(uint32_t));
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, Jan Pochyla, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
@ -12,9 +24,9 @@
|
|||
|
||||
void storage_init(void);
|
||||
void storage_wipe(void);
|
||||
secbool storage_check_pin(uint32_t pin, mp_obj_t callback);
|
||||
secbool storage_unlock(const uint32_t pin, mp_obj_t callback);
|
||||
secbool storage_has_pin(void);
|
||||
uint32_t storage_pin_wait_time(void);
|
||||
secbool storage_change_pin(const uint32_t pin, const uint32_t newpin, mp_obj_t callback);
|
||||
secbool storage_get(uint16_t key, const void **val, uint16_t *len);
|
||||
secbool storage_set(uint16_t key, const void *val, uint16_t len);
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* CRC32 checksum
|
||||
*
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __CRC_H__
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Jan Pochyla, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
@ -39,9 +51,9 @@ STATIC const mp_obj_type_t mod_trezorcrypto_HDNode_type;
|
|||
STATIC mp_obj_t mod_trezorcrypto_HDNode_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
|
||||
STATIC const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_depth, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_fingerprint, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_child_num, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_depth, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_fingerprint, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_child_num, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_chain_code, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
|
||||
{ MP_QSTR_private_key, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
|
||||
{ MP_QSTR_public_key, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
|
||||
|
@ -54,29 +66,29 @@ STATIC mp_obj_t mod_trezorcrypto_HDNode_make_new(const mp_obj_type_t *type, size
|
|||
mp_buffer_info_t private_key;
|
||||
mp_buffer_info_t public_key;
|
||||
mp_buffer_info_t curve_name;
|
||||
const mp_int_t depth = vals[0].u_int;
|
||||
const mp_int_t fingerprint = vals[1].u_int;
|
||||
const mp_int_t child_num = vals[2].u_int;
|
||||
const uint32_t depth = mp_obj_get_int_truncated(vals[0].u_obj);
|
||||
const uint32_t fingerprint = mp_obj_get_int_truncated(vals[1].u_obj);
|
||||
const uint32_t child_num = mp_obj_get_int_truncated(vals[2].u_obj);
|
||||
mp_get_buffer_raise(vals[3].u_obj, &chain_code, MP_BUFFER_READ);
|
||||
mp_get_buffer_raise(vals[4].u_obj, &private_key, MP_BUFFER_READ);
|
||||
mp_get_buffer_raise(vals[5].u_obj, &public_key, MP_BUFFER_READ);
|
||||
mp_get_buffer_raise(vals[6].u_obj, &curve_name, MP_BUFFER_READ);
|
||||
|
||||
if (NULL == chain_code.buf || 32 != chain_code.len) {
|
||||
if (32 != chain_code.len) {
|
||||
mp_raise_ValueError("chain_code is invalid");
|
||||
}
|
||||
if (NULL == public_key.buf && NULL == private_key.buf) {
|
||||
if (0 == public_key.len && 0 == private_key.len) {
|
||||
mp_raise_ValueError("either public_key or private_key is required");
|
||||
}
|
||||
if (NULL != private_key.buf && 32 != private_key.len) {
|
||||
if (0 != private_key.len && 32 != private_key.len) {
|
||||
mp_raise_ValueError("private_key is invalid");
|
||||
}
|
||||
if (NULL != public_key.buf && 33 != public_key.len) {
|
||||
if (0 != public_key.len && 33 != public_key.len) {
|
||||
mp_raise_ValueError("public_key is invalid");
|
||||
}
|
||||
|
||||
const curve_info *curve = NULL;
|
||||
if (NULL == curve_name.buf) {
|
||||
if (0 == curve_name.len) {
|
||||
curve = get_curve_by_name(SECP256K1_NAME);
|
||||
} else {
|
||||
curve = get_curve_by_name(curve_name.buf);
|
||||
|
@ -88,20 +100,20 @@ STATIC mp_obj_t mod_trezorcrypto_HDNode_make_new(const mp_obj_type_t *type, size
|
|||
mp_obj_HDNode_t *o = m_new_obj(mp_obj_HDNode_t);
|
||||
o->base.type = type;
|
||||
|
||||
o->fingerprint = (uint32_t)fingerprint;
|
||||
o->hdnode.depth = (uint32_t)depth;
|
||||
o->hdnode.child_num = (uint32_t)child_num;
|
||||
if (NULL != chain_code.buf && 32 == chain_code.len) {
|
||||
o->fingerprint = fingerprint;
|
||||
o->hdnode.depth = depth;
|
||||
o->hdnode.child_num = child_num;
|
||||
if (32 == chain_code.len) {
|
||||
memcpy(o->hdnode.chain_code, chain_code.buf, 32);
|
||||
} else {
|
||||
memzero(o->hdnode.chain_code, 32);
|
||||
}
|
||||
if (NULL != private_key.buf && 32 == private_key.len) {
|
||||
if (32 == private_key.len) {
|
||||
memcpy(o->hdnode.private_key, private_key.buf, 32);
|
||||
} else {
|
||||
memzero(o->hdnode.private_key, 32);
|
||||
}
|
||||
if (NULL != public_key.buf && 33 == public_key.len) {
|
||||
if (33 == public_key.len) {
|
||||
memcpy(o->hdnode.public_key, public_key.buf, 33);
|
||||
} else {
|
||||
memzero(o->hdnode.public_key, 33);
|
||||
|
@ -111,16 +123,27 @@ STATIC mp_obj_t mod_trezorcrypto_HDNode_make_new(const mp_obj_type_t *type, size
|
|||
return MP_OBJ_FROM_PTR(o);
|
||||
}
|
||||
|
||||
/// def derive(self, index: int) -> None:
|
||||
/// def derive(self, index: int, public: bool=False) -> None:
|
||||
/// '''
|
||||
/// Derive a BIP0032 child node in place.
|
||||
/// '''
|
||||
STATIC mp_obj_t mod_trezorcrypto_HDNode_derive(mp_obj_t self, mp_obj_t index) {
|
||||
mp_obj_HDNode_t *o = MP_OBJ_TO_PTR(self);
|
||||
uint32_t i = mp_obj_get_int_truncated(index);
|
||||
STATIC mp_obj_t mod_trezorcrypto_HDNode_derive(size_t n_args, const mp_obj_t *args) {
|
||||
mp_obj_HDNode_t *o = MP_OBJ_TO_PTR(args[0]);
|
||||
uint32_t i = mp_obj_get_int_truncated(args[1]);
|
||||
uint32_t fp = hdnode_fingerprint(&o->hdnode);
|
||||
bool public = n_args > 2 && args[2] == mp_const_true;
|
||||
|
||||
if (!hdnode_private_ckd(&o->hdnode, i)) {
|
||||
int res;
|
||||
if (public) {
|
||||
res = hdnode_public_ckd(&o->hdnode, i);
|
||||
} else {
|
||||
if (0 == memcmp(o->hdnode.private_key, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 32)) {
|
||||
memzero(&o->hdnode, sizeof(o->hdnode));
|
||||
mp_raise_ValueError("Failed to derive, private key not set");
|
||||
}
|
||||
res = hdnode_private_ckd(&o->hdnode, i);
|
||||
}
|
||||
if (!res) {
|
||||
memzero(&o->hdnode, sizeof(o->hdnode));
|
||||
mp_raise_ValueError("Failed to derive");
|
||||
}
|
||||
|
@ -128,7 +151,7 @@ STATIC mp_obj_t mod_trezorcrypto_HDNode_derive(mp_obj_t self, mp_obj_t index) {
|
|||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_trezorcrypto_HDNode_derive_obj, mod_trezorcrypto_HDNode_derive);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_trezorcrypto_HDNode_derive_obj, 2, 3, mod_trezorcrypto_HDNode_derive);
|
||||
|
||||
/// def derive_path(self, path: List[int]) -> None:
|
||||
/// '''
|
||||
|
@ -149,9 +172,6 @@ STATIC mp_obj_t mod_trezorcrypto_HDNode_derive_path(mp_obj_t self, mp_obj_t path
|
|||
uint32_t pi;
|
||||
uint32_t pints[plen];
|
||||
for (pi = 0; pi < plen; pi++) {
|
||||
if (!MP_OBJ_IS_INT(pitems[pi])) {
|
||||
mp_raise_TypeError("Index has to be int");
|
||||
}
|
||||
pints[pi] = mp_obj_get_int_truncated(pitems[pi]);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/objstr.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "rand.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "flash.h"
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/// class HID:
|
||||
/// '''
|
||||
/// USB HID interface configuration.
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "sbu.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "sdcard.h"
|
||||
|
@ -21,7 +33,7 @@ STATIC mp_obj_t mod_trezorio_SDCard_make_new(const mp_obj_type_t *type, size_t n
|
|||
mp_arg_check_num(n_args, n_kw, 0, 0, false);
|
||||
mp_obj_SDCard_t *o = m_new_obj(mp_obj_SDCard_t);
|
||||
o->base.type = type;
|
||||
#if defined TREZOR_UNIX
|
||||
#if defined TREZOR_MODEL_EMU
|
||||
sdcard_init();
|
||||
#endif
|
||||
return MP_OBJ_FROM_PTR(o);
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
void mp_hal_set_vcp_iface(int iface_num);
|
||||
|
||||
enum {
|
||||
|
@ -31,18 +50,25 @@ static const char *get_0str(mp_obj_t o, size_t min_len, size_t max_len) {
|
|||
}
|
||||
|
||||
/// def __init__(self,
|
||||
/// device_class: int=0,
|
||||
/// device_subclass: int=0,
|
||||
/// device_protocol: int=0,
|
||||
/// vendor_id: int,
|
||||
/// product_id: int,
|
||||
/// release_num: int,
|
||||
/// manufacturer: str='',
|
||||
/// product: str='',
|
||||
/// serial_number: str='',
|
||||
/// interface: str='') -> None:
|
||||
/// interface: str='',
|
||||
/// usb21_enabled: bool=True) -> None:
|
||||
/// '''
|
||||
/// '''
|
||||
STATIC mp_obj_t mod_trezorio_USB_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
|
||||
STATIC const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_device_class, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_device_subclass, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_device_protocol, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_vendor_id, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_product_id, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_release_num, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
|
@ -50,18 +76,26 @@ STATIC mp_obj_t mod_trezorio_USB_make_new(const mp_obj_type_t *type, size_t n_ar
|
|||
{ MP_QSTR_product, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
|
||||
{ MP_QSTR_serial_number, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
|
||||
{ MP_QSTR_interface, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
|
||||
{ MP_QSTR_usb21_enabled, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} },
|
||||
};
|
||||
mp_arg_val_t vals[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, args, MP_ARRAY_SIZE(allowed_args), allowed_args, vals);
|
||||
|
||||
const mp_int_t vendor_id = vals[0].u_int;
|
||||
const mp_int_t product_id = vals[1].u_int;
|
||||
const mp_int_t release_num = vals[2].u_int;
|
||||
const char *manufacturer = get_0str(vals[3].u_obj, 0, 32);
|
||||
const char *product = get_0str(vals[4].u_obj, 0, 32);
|
||||
const char *serial_number = get_0str(vals[5].u_obj, 0, 32);
|
||||
const char *interface = get_0str(vals[6].u_obj, 0, 32);
|
||||
const mp_int_t device_class = vals[0].u_int;
|
||||
const mp_int_t device_subclass = vals[1].u_int;
|
||||
const mp_int_t device_protocol = vals[2].u_int;
|
||||
const mp_int_t vendor_id = vals[3].u_int;
|
||||
const mp_int_t product_id = vals[4].u_int;
|
||||
const mp_int_t release_num = vals[5].u_int;
|
||||
const char *manufacturer = get_0str(vals[6].u_obj, 0, 32);
|
||||
const char *product = get_0str(vals[7].u_obj, 0, 32);
|
||||
const char *serial_number = get_0str(vals[8].u_obj, 0, 32);
|
||||
const char *interface = get_0str(vals[9].u_obj, 0, 32);
|
||||
const secbool usb21_enabled = vals[10].u_bool ? sectrue : secfalse;
|
||||
|
||||
CHECK_PARAM_RANGE(device_class, 0, 255)
|
||||
CHECK_PARAM_RANGE(device_subclass, 0, 255)
|
||||
CHECK_PARAM_RANGE(device_protocol, 0, 255)
|
||||
CHECK_PARAM_RANGE(vendor_id, 0, 65535)
|
||||
CHECK_PARAM_RANGE(product_id, 0, 65535)
|
||||
CHECK_PARAM_RANGE(release_num, 0, 65535)
|
||||
|
@ -83,13 +117,18 @@ STATIC mp_obj_t mod_trezorio_USB_make_new(const mp_obj_type_t *type, size_t n_ar
|
|||
|
||||
o->state = USB_CLOSED;
|
||||
|
||||
o->info.vendor_id = (uint16_t)(vendor_id);
|
||||
o->info.product_id = (uint16_t)(product_id);
|
||||
o->info.release_num = (uint16_t)(release_num);
|
||||
o->info.manufacturer = manufacturer;
|
||||
o->info.product = product;
|
||||
o->info.serial_number = serial_number;
|
||||
o->info.interface = interface;
|
||||
o->info.device_class = (uint8_t)(device_class);
|
||||
o->info.device_subclass = (uint8_t)(device_subclass);
|
||||
o->info.device_protocol = (uint8_t)(device_protocol);
|
||||
o->info.vendor_id = (uint16_t)(vendor_id);
|
||||
o->info.product_id = (uint16_t)(product_id);
|
||||
o->info.release_num = (uint16_t)(release_num);
|
||||
o->info.manufacturer = manufacturer;
|
||||
o->info.product = product;
|
||||
o->info.serial_number = serial_number;
|
||||
o->info.interface = interface;
|
||||
o->info.usb21_enabled = usb21_enabled;
|
||||
|
||||
mp_obj_list_init(&o->ifaces, 0);
|
||||
|
||||
return MP_OBJ_FROM_PTR(o);
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
void pendsv_kbd_intr(void);
|
||||
|
||||
/// class VCP:
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/// class WebUSB:
|
||||
/// '''
|
||||
/// USB WebUSB interface configuration.
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "py/runtime.h"
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include STM32_HAL_H
|
||||
|
@ -19,8 +31,9 @@
|
|||
#define DISPLAY_MEMORY_BASE 0x60000000
|
||||
#define DISPLAY_MEMORY_PIN 16
|
||||
|
||||
#define CMD(X) (*((__IO uint8_t *)((uint32_t)(DISPLAY_MEMORY_BASE))) = (X))
|
||||
#define DATA(X) (*((__IO uint8_t *)((uint32_t)(DISPLAY_MEMORY_BASE | (1 << DISPLAY_MEMORY_PIN)))) = (X))
|
||||
#define CMD(X) (*((__IO uint8_t *)((uint32_t)(DISPLAY_MEMORY_BASE))) = (X))
|
||||
#define DATA(X) (*((__IO uint8_t *)((uint32_t)(DISPLAY_MEMORY_BASE | (1 << DISPLAY_MEMORY_PIN)))) = (X))
|
||||
#define PIXELDATA(X) DATA((X) >> 8); DATA((X) & 0xFF)
|
||||
|
||||
#define LED_PWM_TIM_PERIOD (10000)
|
||||
|
||||
|
@ -42,15 +55,15 @@ static void display_unsleep(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static uint16_t BUFFER_OFFSET_X = 0, BUFFER_OFFSET_Y = 0;
|
||||
static struct {
|
||||
uint16_t x, y;
|
||||
} BUFFER_OFFSET;
|
||||
|
||||
static void display_set_window(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
|
||||
{
|
||||
x0 += BUFFER_OFFSET.x; x1 += BUFFER_OFFSET.x;
|
||||
y0 += BUFFER_OFFSET.y; y1 += BUFFER_OFFSET.y;
|
||||
#if DISPLAY_ILI9341V || DISPLAY_ST7789V
|
||||
x0 += BUFFER_OFFSET_X;
|
||||
x1 += BUFFER_OFFSET_X;
|
||||
y0 += BUFFER_OFFSET_Y;
|
||||
y1 += BUFFER_OFFSET_Y;
|
||||
CMD(0x2A); DATA(x0 >> 8); DATA(x0 & 0xFF); DATA(x1 >> 8); DATA(x1 & 0xFF); // column addr set
|
||||
CMD(0x2B); DATA(y0 >> 8); DATA(y0 & 0xFF); DATA(y1 >> 8); DATA(y1 & 0xFF); // row addr set
|
||||
CMD(0x2C);
|
||||
|
@ -65,8 +78,8 @@ void display_set_orientation(int degrees)
|
|||
#define MY (1 << 7)
|
||||
// MADCTL: Memory Data Access Control
|
||||
// reference section 9.3 in the ILI9341 manual; 8.12 in the ST7789V manual
|
||||
BUFFER_OFFSET_X = 0;
|
||||
BUFFER_OFFSET_Y = 0;
|
||||
BUFFER_OFFSET.x = 0;
|
||||
BUFFER_OFFSET.y = 0;
|
||||
uint8_t display_command_parameter = 0;
|
||||
switch (degrees) {
|
||||
case 0:
|
||||
|
@ -77,11 +90,11 @@ void display_set_orientation(int degrees)
|
|||
break;
|
||||
case 180:
|
||||
display_command_parameter = MX | MY;
|
||||
BUFFER_OFFSET_Y = MAX_DISPLAY_RESY - DISPLAY_RESY;
|
||||
BUFFER_OFFSET.y = MAX_DISPLAY_RESY - DISPLAY_RESY;
|
||||
break;
|
||||
case 270:
|
||||
display_command_parameter = MV | MY;
|
||||
BUFFER_OFFSET_X = MAX_DISPLAY_RESY - DISPLAY_RESX;
|
||||
BUFFER_OFFSET.x = MAX_DISPLAY_RESY - DISPLAY_RESX;
|
||||
break;
|
||||
}
|
||||
CMD(0x36); DATA(display_command_parameter);
|
||||
|
@ -258,6 +271,6 @@ void display_refresh(void)
|
|||
while (GPIO_PIN_SET == HAL_GPIO_ReadPin(GPIOD, GPIO_PIN_12)) { }
|
||||
}
|
||||
|
||||
void display_save(const char *filename)
|
||||
void display_save(const char *prefix)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -10,32 +22,48 @@
|
|||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
|
||||
#define DISPLAY_BORDER 16
|
||||
#define DISPLAY_EMULATOR_BORDER 16
|
||||
|
||||
#define DISPLAY_TOUCH_OFFSET_X 180
|
||||
#define DISPLAY_TOUCH_OFFSET_Y 120
|
||||
|
||||
#define WINDOW_WIDTH 600
|
||||
#define WINDOW_HEIGHT 800
|
||||
|
||||
static SDL_Renderer *RENDERER;
|
||||
static SDL_Surface *BUFFER;
|
||||
static SDL_Texture *TEXTURE;
|
||||
static int DATAODD;
|
||||
static int POSX, POSY, SX, SY, EX, EY;
|
||||
static SDL_Texture *TEXTURE, *BACKGROUND;
|
||||
|
||||
void DATA(uint8_t x) {
|
||||
int sdl_display_res_x = DISPLAY_RESX, sdl_display_res_y = DISPLAY_RESX;
|
||||
int sdl_touch_offset_x, sdl_touch_offset_y;
|
||||
|
||||
static struct {
|
||||
struct {
|
||||
uint16_t x, y;
|
||||
} start;
|
||||
struct {
|
||||
uint16_t x, y;
|
||||
} end;
|
||||
struct {
|
||||
uint16_t x, y;
|
||||
} pos;
|
||||
} PIXELWINDOW;
|
||||
|
||||
void PIXELDATA(uint16_t c) {
|
||||
if (!RENDERER) {
|
||||
display_init();
|
||||
}
|
||||
if (POSX <= EX && POSY <= EY) {
|
||||
((uint8_t *)BUFFER->pixels)[POSX * 2 + POSY * BUFFER->pitch + (DATAODD ^ 1)] = x;
|
||||
if (PIXELWINDOW.pos.x <= PIXELWINDOW.end.x && PIXELWINDOW.pos.y <= PIXELWINDOW.end.y) {
|
||||
((uint16_t *)BUFFER->pixels)[PIXELWINDOW.pos.x + PIXELWINDOW.pos.y * BUFFER->pitch / sizeof(uint16_t)] = c;
|
||||
}
|
||||
DATAODD = !DATAODD;
|
||||
if (DATAODD == 0) {
|
||||
POSX++;
|
||||
if (POSX > EX) {
|
||||
POSX = SX;
|
||||
POSY++;
|
||||
}
|
||||
PIXELWINDOW.pos.x++;
|
||||
if (PIXELWINDOW.pos.x > PIXELWINDOW.end.x) {
|
||||
PIXELWINDOW.pos.x = PIXELWINDOW.start.x;
|
||||
PIXELWINDOW.pos.y++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define DATA(X) (void)(X);
|
||||
#define PIXELDATA(X) (void)(X)
|
||||
#endif
|
||||
|
||||
void display_init(void)
|
||||
|
@ -46,7 +74,7 @@ void display_init(void)
|
|||
ensure(secfalse, "SDL_Init error");
|
||||
}
|
||||
atexit(SDL_Quit);
|
||||
SDL_Window *win = SDL_CreateWindow("TREZOR", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, DISPLAY_RESX + 2 * DISPLAY_BORDER, DISPLAY_RESY + 2 * DISPLAY_BORDER, SDL_WINDOW_SHOWN);
|
||||
SDL_Window *win = SDL_CreateWindow("TREZOR Emulator", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN);
|
||||
if (!win) {
|
||||
printf("%s\n", SDL_GetError());
|
||||
ensure(secfalse, "SDL_CreateWindow error");
|
||||
|
@ -57,13 +85,22 @@ void display_init(void)
|
|||
SDL_DestroyWindow(win);
|
||||
ensure(secfalse, "SDL_CreateRenderer error");
|
||||
}
|
||||
SDL_SetRenderDrawColor(RENDERER, DISPLAY_BACKLIGHT, DISPLAY_BACKLIGHT, DISPLAY_BACKLIGHT, 255);
|
||||
SDL_SetRenderDrawColor(RENDERER, 0, 0, 0, 255);
|
||||
SDL_RenderClear(RENDERER);
|
||||
BUFFER = SDL_CreateRGBSurface(0, MAX_DISPLAY_RESX, MAX_DISPLAY_RESY, 16, 0xF800, 0x07E0, 0x001F, 0x0000);
|
||||
TEXTURE = SDL_CreateTexture(RENDERER, SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STREAMING, DISPLAY_RESX, DISPLAY_RESY);
|
||||
SDL_SetTextureBlendMode(TEXTURE, SDL_BLENDMODE_NONE);
|
||||
SDL_SetTextureAlphaMod(TEXTURE, 0);
|
||||
|
||||
SDL_SetTextureBlendMode(TEXTURE, SDL_BLENDMODE_BLEND);
|
||||
// TODO: find better way how to embed/distribute background image
|
||||
BACKGROUND = IMG_LoadTexture(RENDERER, "../embed/unix/background.jpg");
|
||||
if (BACKGROUND) {
|
||||
SDL_SetTextureBlendMode(BACKGROUND, SDL_BLENDMODE_NONE);
|
||||
sdl_touch_offset_x = DISPLAY_TOUCH_OFFSET_X;
|
||||
sdl_touch_offset_y = DISPLAY_TOUCH_OFFSET_Y;
|
||||
} else {
|
||||
SDL_SetWindowSize(win, DISPLAY_RESX + 2 * DISPLAY_EMULATOR_BORDER, DISPLAY_RESY + 2 * DISPLAY_EMULATOR_BORDER);
|
||||
sdl_touch_offset_x = DISPLAY_EMULATOR_BORDER;
|
||||
sdl_touch_offset_y = DISPLAY_EMULATOR_BORDER;
|
||||
}
|
||||
DISPLAY_BACKLIGHT = 0;
|
||||
DISPLAY_ORIENTATION = 0;
|
||||
#endif
|
||||
|
@ -75,10 +112,9 @@ static void display_set_window(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y
|
|||
if (!RENDERER) {
|
||||
display_init();
|
||||
}
|
||||
SX = x0; SY = y0;
|
||||
EX = x1; EY = y1;
|
||||
POSX = SX; POSY = SY;
|
||||
DATAODD = 0;
|
||||
PIXELWINDOW.start.x = x0; PIXELWINDOW.start.y = y0;
|
||||
PIXELWINDOW.end.x = x1; PIXELWINDOW.end.y = y1;
|
||||
PIXELWINDOW.pos.x = x0; PIXELWINDOW.pos.y = y0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -88,34 +124,45 @@ void display_refresh(void)
|
|||
if (!RENDERER) {
|
||||
display_init();
|
||||
}
|
||||
SDL_RenderClear(RENDERER);
|
||||
if (BACKGROUND) {
|
||||
SDL_RenderCopy(RENDERER, BACKGROUND, NULL, NULL);
|
||||
} else {
|
||||
SDL_RenderClear(RENDERER);
|
||||
}
|
||||
SDL_UpdateTexture(TEXTURE, NULL, BUFFER->pixels, BUFFER->pitch);
|
||||
const SDL_Rect r = {DISPLAY_BORDER, DISPLAY_BORDER, DISPLAY_RESX, DISPLAY_RESY};
|
||||
SDL_RenderCopyEx(RENDERER, TEXTURE, NULL, &r, DISPLAY_ORIENTATION, NULL, 0);
|
||||
#define BACKLIGHT_NORMAL 150
|
||||
SDL_SetTextureAlphaMod(TEXTURE, MIN(255, 255 * DISPLAY_BACKLIGHT / BACKLIGHT_NORMAL));
|
||||
if (BACKGROUND) {
|
||||
const SDL_Rect r = {DISPLAY_TOUCH_OFFSET_X, DISPLAY_TOUCH_OFFSET_Y, DISPLAY_RESX, DISPLAY_RESY};
|
||||
SDL_RenderCopyEx(RENDERER, TEXTURE, NULL, &r, DISPLAY_ORIENTATION, NULL, 0);
|
||||
} else {
|
||||
const SDL_Rect r = {DISPLAY_EMULATOR_BORDER, DISPLAY_EMULATOR_BORDER, DISPLAY_RESX, DISPLAY_RESY};
|
||||
SDL_RenderCopyEx(RENDERER, TEXTURE, NULL, &r, DISPLAY_ORIENTATION, NULL, 0);
|
||||
}
|
||||
SDL_RenderPresent(RENDERER);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void display_set_orientation(int degrees)
|
||||
{
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
static void display_set_backlight(int val)
|
||||
{
|
||||
#ifndef TREZOR_NOUI
|
||||
if (!RENDERER) {
|
||||
display_init();
|
||||
}
|
||||
SDL_SetRenderDrawColor(RENDERER, val, val, val, 255);
|
||||
#endif
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
void display_save(const char *filename)
|
||||
void display_save(const char *prefix)
|
||||
{
|
||||
#ifndef TREZOR_NOUI
|
||||
if (!RENDERER) {
|
||||
display_init();
|
||||
}
|
||||
IMG_SavePNG(BUFFER, filename);
|
||||
static uint32_t cnt = 0;
|
||||
char fname[256];
|
||||
snprintf(fname, sizeof(fname), "%s%08d.png", prefix, cnt);
|
||||
IMG_SavePNG(BUFFER, fname);
|
||||
cnt++;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "inflate.h"
|
||||
|
@ -27,11 +39,14 @@
|
|||
|
||||
static int DISPLAY_BACKLIGHT = -1;
|
||||
static int DISPLAY_ORIENTATION = -1;
|
||||
static int DISPLAY_OFFSET[2] = {0, 0};
|
||||
|
||||
#if defined TREZOR_STM32
|
||||
static struct {
|
||||
int x, y;
|
||||
} DISPLAY_OFFSET;
|
||||
|
||||
#if defined TREZOR_MODEL_T
|
||||
#include "display-stm32.h"
|
||||
#elif defined TREZOR_UNIX
|
||||
#elif defined TREZOR_MODEL_EMU
|
||||
#include "display-unix.h"
|
||||
#else
|
||||
#error Unsupported TREZOR port. Only STM32 and UNIX ports are supported.
|
||||
|
@ -57,8 +72,6 @@ static inline void set_color_table(uint16_t colortable[16], uint16_t fgcolor, ui
|
|||
|
||||
static inline void clamp_coords(int x, int y, int w, int h, int *x0, int *y0, int *x1, int *y1)
|
||||
{
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
*x0 = MAX(x, 0);
|
||||
*y0 = MAX(y, 0);
|
||||
*x1 = MIN(x + w - 1, DISPLAY_RESX - 1);
|
||||
|
@ -71,7 +84,7 @@ void display_clear(void)
|
|||
display_orientation(0); // set MADCTL first so that we can set the window correctly next
|
||||
display_set_window(0, 0, MAX_DISPLAY_RESX - 1, MAX_DISPLAY_RESY - 1); // address the complete frame memory
|
||||
for (uint32_t i = 0; i < MAX_DISPLAY_RESX * MAX_DISPLAY_RESY; i++) {
|
||||
DATA(0x00); DATA(0x00); // 2 bytes per pixel because we're using RGB 5-6-5 format
|
||||
PIXELDATA(0x0000); // 2 bytes per pixel because we're using RGB 5-6-5 format
|
||||
}
|
||||
display_set_window(0, 0, DISPLAY_RESX - 1, DISPLAY_RESY - 1); // go back to restricted window
|
||||
display_orientation(saved_orientation); // if valid, go back to the saved orientation
|
||||
|
@ -79,14 +92,13 @@ void display_clear(void)
|
|||
|
||||
void display_bar(int x, int y, int w, int h, uint16_t c)
|
||||
{
|
||||
x += DISPLAY_OFFSET[0];
|
||||
y += DISPLAY_OFFSET[1];
|
||||
x += DISPLAY_OFFSET.x;
|
||||
y += DISPLAY_OFFSET.y;
|
||||
int x0, y0, x1, y1;
|
||||
clamp_coords(x, y, w, h, &x0, &y0, &x1, &y1);
|
||||
display_set_window(x0, y0, x1, y1);
|
||||
for (int i = 0; i < (x1 - x0 + 1) * (y1 - y0 + 1); i++) {
|
||||
DATA(c >> 8);
|
||||
DATA(c & 0xFF);
|
||||
PIXELDATA(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,8 +132,8 @@ void display_bar_radius(int x, int y, int w, int h, uint16_t c, uint16_t b, uint
|
|||
}
|
||||
uint16_t colortable[16];
|
||||
set_color_table(colortable, c, b);
|
||||
x += DISPLAY_OFFSET[0];
|
||||
y += DISPLAY_OFFSET[1];
|
||||
x += DISPLAY_OFFSET.x;
|
||||
y += DISPLAY_OFFSET.y;
|
||||
int x0, y0, x1, y1;
|
||||
clamp_coords(x, y, w, h, &x0, &y0, &x1, &y1);
|
||||
display_set_window(x0, y0, x1, y1);
|
||||
|
@ -131,26 +143,21 @@ void display_bar_radius(int x, int y, int w, int h, uint16_t c, uint16_t b, uint
|
|||
int ry = j - y;
|
||||
if (rx < CORNER_RADIUS / r && ry < CORNER_RADIUS / r) {
|
||||
uint8_t c = cornertable[rx * r + ry * r * CORNER_RADIUS];
|
||||
DATA(colortable[c] >> 8);
|
||||
DATA(colortable[c] & 0xFF);
|
||||
PIXELDATA(colortable[c]);
|
||||
} else
|
||||
if (rx < CORNER_RADIUS / r && ry >= h - CORNER_RADIUS / r) {
|
||||
uint8_t c = cornertable[rx * r + (h - 1 - ry) * r * CORNER_RADIUS];
|
||||
DATA(colortable[c] >> 8);
|
||||
DATA(colortable[c] & 0xFF);
|
||||
PIXELDATA(colortable[c]);
|
||||
} else
|
||||
if (rx >= w - CORNER_RADIUS / r && ry < CORNER_RADIUS / r) {
|
||||
uint8_t c = cornertable[(w - 1 - rx) * r + ry * r * CORNER_RADIUS];
|
||||
DATA(colortable[c] >> 8);
|
||||
DATA(colortable[c] & 0xFF);
|
||||
PIXELDATA(colortable[c]);
|
||||
} else
|
||||
if (rx >= w - CORNER_RADIUS / r && ry >= h - CORNER_RADIUS / r) {
|
||||
uint8_t c = cornertable[(w - 1 - rx) * r + (h - 1 - ry) * r * CORNER_RADIUS];
|
||||
DATA(colortable[c] >> 8);
|
||||
DATA(colortable[c] & 0xFF);
|
||||
PIXELDATA(colortable[c]);
|
||||
} else {
|
||||
DATA(c >> 8);
|
||||
DATA(c & 0xFF);
|
||||
PIXELDATA(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,15 +178,14 @@ static void inflate_callback_image(uint8_t byte1, uint32_t pos, void *userdata)
|
|||
const int px = (pos / 2) % w;
|
||||
const int py = (pos / 2) / w;
|
||||
if (px >= x0 && px <= x1 && py >= y0 && py <= y1) {
|
||||
DATA(byte0);
|
||||
DATA(byte1);
|
||||
PIXELDATA((byte0 << 8) | byte1);
|
||||
}
|
||||
}
|
||||
|
||||
void display_image(int x, int y, int w, int h, const void *data, int datalen)
|
||||
{
|
||||
x += DISPLAY_OFFSET[0];
|
||||
y += DISPLAY_OFFSET[1];
|
||||
x += DISPLAY_OFFSET.x;
|
||||
y += DISPLAY_OFFSET.y;
|
||||
int x0, y0, x1, y1;
|
||||
clamp_coords(x, y, w, h, &x0, &y0, &x1, &y1);
|
||||
display_set_window(x0, y0, x1, y1);
|
||||
|
@ -211,13 +217,11 @@ static void inflate_callback_avatar(uint8_t byte1, uint32_t pos, void *userdata)
|
|||
int d = (px - w / 2) * (px - w / 2) + (py - w / 2) * (py - w / 2);
|
||||
// inside border area
|
||||
if (d < AVATAR_BORDER_LOW) {
|
||||
DATA(byte0);
|
||||
DATA(byte1);
|
||||
PIXELDATA((byte0 << 8) | byte1);
|
||||
} else
|
||||
// outside border area
|
||||
if (d > AVATAR_BORDER_HIGH) {
|
||||
DATA(bgcolor >> 8);
|
||||
DATA(bgcolor & 0xFF);
|
||||
PIXELDATA(bgcolor);
|
||||
// border area
|
||||
} else {
|
||||
#if AVATAR_ANTIALIAS
|
||||
|
@ -228,11 +232,9 @@ static void inflate_callback_avatar(uint8_t byte1, uint32_t pos, void *userdata)
|
|||
} else {
|
||||
c = interpolate_color(fgcolor, (byte0 << 8) | byte1 , d);
|
||||
}
|
||||
DATA(c >> 8);
|
||||
DATA(c & 0xFF);
|
||||
PIXELDATA(c);
|
||||
#else
|
||||
DATA(fgcolor >> 8);
|
||||
DATA(fgcolor & 0xFF);
|
||||
PIXELDATA(fgcolor);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -240,8 +242,8 @@ static void inflate_callback_avatar(uint8_t byte1, uint32_t pos, void *userdata)
|
|||
|
||||
void display_avatar(int x, int y, const void *data, int datalen, uint16_t fgcolor, uint16_t bgcolor)
|
||||
{
|
||||
x += DISPLAY_OFFSET[0];
|
||||
y += DISPLAY_OFFSET[1];
|
||||
x += DISPLAY_OFFSET.x;
|
||||
y += DISPLAY_OFFSET.y;
|
||||
int x0, y0, x1, y1;
|
||||
clamp_coords(x, y, AVATAR_IMAGE_SIZE, AVATAR_IMAGE_SIZE, &x0, &y0, &x1, &y1);
|
||||
display_set_window(x0, y0, x1, y1);
|
||||
|
@ -260,17 +262,15 @@ static void inflate_callback_icon(uint8_t byte, uint32_t pos, void *userdata)
|
|||
const int px = (pos * 2) % w;
|
||||
const int py = (pos * 2) / w;
|
||||
if (px >= x0 && px <= x1 && py >= y0 && py <= y1) {
|
||||
DATA(colortable[byte >> 4] >> 8);
|
||||
DATA(colortable[byte >> 4] & 0xFF);
|
||||
DATA(colortable[byte & 0x0F] >> 8);
|
||||
DATA(colortable[byte & 0x0F] & 0xFF);
|
||||
PIXELDATA(colortable[byte >> 4]);
|
||||
PIXELDATA(colortable[byte & 0x0F]);
|
||||
}
|
||||
}
|
||||
|
||||
void display_icon(int x, int y, int w, int h, const void *data, int datalen, uint16_t fgcolor, uint16_t bgcolor)
|
||||
{
|
||||
x += DISPLAY_OFFSET[0];
|
||||
y += DISPLAY_OFFSET[1];
|
||||
x += DISPLAY_OFFSET.x;
|
||||
y += DISPLAY_OFFSET.y;
|
||||
x &= ~1; // cannot draw at odd coordinate
|
||||
int x0, y0, x1, y1;
|
||||
clamp_coords(x, y, w, h, &x0, &y0, &x1, &y1);
|
||||
|
@ -377,17 +377,15 @@ void display_print(const char *text, int textlen)
|
|||
if (c < ' ') c = ' ';
|
||||
const uint8_t *g = Font_Bitmap + (5 * (c - ' '));
|
||||
if (k < 5 && (g[k] & (1 << j))) {
|
||||
DATA(display_print_fgcolor >> 8);
|
||||
DATA(display_print_fgcolor & 0xFF);
|
||||
PIXELDATA(display_print_fgcolor);
|
||||
} else {
|
||||
DATA(display_print_bgcolor >> 8);
|
||||
DATA(display_print_bgcolor & 0xFF);
|
||||
PIXELDATA(display_print_bgcolor);
|
||||
}
|
||||
}
|
||||
display_refresh();
|
||||
}
|
||||
|
||||
#ifdef TREZOR_UNIX
|
||||
#ifdef TREZOR_MODEL_EMU
|
||||
#define mini_vsnprintf vsnprintf
|
||||
#include <stdio.h>
|
||||
#else
|
||||
|
@ -425,11 +423,11 @@ static void display_text_render(int x, int y, const char *text, int textlen, uin
|
|||
for (int i = 0; i < textlen; i++) {
|
||||
const uint8_t *g = get_glyph(font, (uint8_t)text[i]);
|
||||
if (!g) continue;
|
||||
const int8_t w = g[0]; // width
|
||||
const int8_t h = g[1]; // height
|
||||
const int8_t adv = g[2]; // advance
|
||||
const int8_t bearX = g[3]; // bearingX
|
||||
const int8_t bearY = g[4]; // bearingY
|
||||
const uint8_t w = g[0]; // width
|
||||
const uint8_t h = g[1]; // height
|
||||
const uint8_t adv = g[2]; // advance
|
||||
const uint8_t bearX = g[3]; // bearingX
|
||||
const uint8_t bearY = g[4]; // bearingY
|
||||
if (w && h) {
|
||||
const int sx = x + bearX;
|
||||
const int sy = y - bearY;
|
||||
|
@ -448,8 +446,7 @@ static void display_text_render(int x, int y, const char *text, int textlen, uin
|
|||
#else
|
||||
#error Unsupported FONT_BPP value
|
||||
#endif
|
||||
DATA(colortable[c] >> 8);
|
||||
DATA(colortable[c] & 0xFF);
|
||||
PIXELDATA(colortable[c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -457,48 +454,33 @@ static void display_text_render(int x, int y, const char *text, int textlen, uin
|
|||
}
|
||||
}
|
||||
|
||||
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
|
||||
void display_text(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor, int minwidth)
|
||||
void display_text(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor)
|
||||
{
|
||||
x += DISPLAY_OFFSET[0];
|
||||
y += DISPLAY_OFFSET[1];
|
||||
#if TREZOR_FONT_PREFILL
|
||||
int w = display_text_width(text, textlen, font);
|
||||
int barwidth = max(w, minwidth);
|
||||
display_bar(x - 1, y - 18, barwidth + 2, 23, bgcolor);
|
||||
#endif
|
||||
x += DISPLAY_OFFSET.x;
|
||||
y += DISPLAY_OFFSET.y;
|
||||
display_text_render(x, y, text, textlen, font, fgcolor, bgcolor);
|
||||
}
|
||||
|
||||
void display_text_center(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor, int minwidth)
|
||||
void display_text_center(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor)
|
||||
{
|
||||
x += DISPLAY_OFFSET[0];
|
||||
y += DISPLAY_OFFSET[1];
|
||||
x += DISPLAY_OFFSET.x;
|
||||
y += DISPLAY_OFFSET.y;
|
||||
int w = display_text_width(text, textlen, font);
|
||||
#if TREZOR_FONT_PREFILL
|
||||
int barwidth = max(w, minwidth);
|
||||
display_bar(x - barwidth / 2 - 1, y - 18, barwidth + 2, 23, bgcolor);
|
||||
#endif
|
||||
display_text_render(x - w / 2, y, text, textlen, font, fgcolor, bgcolor);
|
||||
}
|
||||
|
||||
void display_text_right(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor, int minwidth)
|
||||
void display_text_right(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor)
|
||||
{
|
||||
x += DISPLAY_OFFSET[0];
|
||||
y += DISPLAY_OFFSET[1];
|
||||
x += DISPLAY_OFFSET.x;
|
||||
y += DISPLAY_OFFSET.y;
|
||||
int w = display_text_width(text, textlen, font);
|
||||
#if TREZOR_FONT_PREFILL
|
||||
int barwidth = max(w, minwidth);
|
||||
display_bar(x - barwidth - 1, y - 18, barwidth + 2, 23, bgcolor);
|
||||
#endif
|
||||
display_text_render(x - w, y, text, textlen, font, fgcolor, bgcolor);
|
||||
}
|
||||
|
||||
// compute the width of the text (in pixels)
|
||||
int display_text_width(const char *text, int textlen, uint8_t font)
|
||||
{
|
||||
int w = 0;
|
||||
int width = 0;
|
||||
// determine text length if not provided
|
||||
if (textlen < 0) {
|
||||
textlen = strlen(text);
|
||||
|
@ -506,10 +488,20 @@ int display_text_width(const char *text, int textlen, uint8_t font)
|
|||
for (int i = 0; i < textlen; i++) {
|
||||
const uint8_t *g = get_glyph(font, (uint8_t)text[i]);
|
||||
if (!g) continue;
|
||||
const int8_t adv = g[2]; // advance
|
||||
w += adv;
|
||||
const uint8_t adv = g[2]; // advance
|
||||
width += adv;
|
||||
/*
|
||||
if (i != textlen - 1) {
|
||||
const uint8_t adv = g[2]; // advance
|
||||
width += adv;
|
||||
} else { // last character
|
||||
const uint8_t w = g[0]; // width
|
||||
const uint8_t bearX = g[3]; // bearingX
|
||||
width += (bearX + w);
|
||||
}
|
||||
*/
|
||||
}
|
||||
return w;
|
||||
return width;
|
||||
}
|
||||
|
||||
void display_qrcode(int x, int y, const char *data, int datalen, uint8_t scale)
|
||||
|
@ -517,8 +509,8 @@ void display_qrcode(int x, int y, const char *data, int datalen, uint8_t scale)
|
|||
if (scale < 1 || scale > 10) return;
|
||||
uint8_t bitdata[QR_MAX_BITDATA];
|
||||
int side = qr_encode(QR_LEVEL_M, 0, data, datalen, bitdata);
|
||||
x += DISPLAY_OFFSET[0] - (side + 2) * scale / 2;
|
||||
y += DISPLAY_OFFSET[1] - (side + 2) * scale / 2;
|
||||
x += DISPLAY_OFFSET.x - (side + 2) * scale / 2;
|
||||
y += DISPLAY_OFFSET.y - (side + 2) * scale / 2;
|
||||
int x0, y0, x1, y1;
|
||||
clamp_coords(x, y, (side + 2) * scale, (side + 2) * scale, &x0, &y0, &x1, &y1);
|
||||
display_set_window(x0, y0, x1, y1);
|
||||
|
@ -528,14 +520,14 @@ void display_qrcode(int x, int y, const char *data, int datalen, uint8_t scale)
|
|||
int ry = (j - y) / scale - 1;
|
||||
// 1px border
|
||||
if (rx < 0 || ry < 0 || rx >= side || ry >= side) {
|
||||
DATA(0xFF); DATA(0xFF);
|
||||
PIXELDATA(0xFFFF);
|
||||
continue;
|
||||
}
|
||||
int a = rx * side + ry;
|
||||
if (bitdata[a / 8] & (1 << (7 - a % 8))) {
|
||||
DATA(0x00); DATA(0x00);
|
||||
PIXELDATA(0x0000);
|
||||
} else {
|
||||
DATA(0xFF); DATA(0xFF);
|
||||
PIXELDATA(0xFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -597,8 +589,7 @@ void display_loader(uint16_t progress, int yoffset, uint16_t fgcolor, uint16_t b
|
|||
} else {
|
||||
c = (icon[i / 2] & 0xF0) >> 4;
|
||||
}
|
||||
DATA(iconcolortable[c] >> 8);
|
||||
DATA(iconcolortable[c] & 0xFF);
|
||||
PIXELDATA(iconcolortable[c]);
|
||||
} else {
|
||||
uint8_t c;
|
||||
if (progress > a) {
|
||||
|
@ -606,20 +597,20 @@ void display_loader(uint16_t progress, int yoffset, uint16_t fgcolor, uint16_t b
|
|||
} else {
|
||||
c = img_loader[my][mx] & 0x000F;
|
||||
}
|
||||
DATA(colortable[c] >> 8);
|
||||
DATA(colortable[c] & 0xFF);
|
||||
PIXELDATA(colortable[c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int *display_offset(int xy[2])
|
||||
void display_offset(int set_xy[2], int *get_x, int *get_y)
|
||||
{
|
||||
if (xy) {
|
||||
DISPLAY_OFFSET[0] = xy[0];
|
||||
DISPLAY_OFFSET[1] = xy[1];
|
||||
if (set_xy) {
|
||||
DISPLAY_OFFSET.x = set_xy[0];
|
||||
DISPLAY_OFFSET.y = set_xy[1];
|
||||
}
|
||||
return DISPLAY_OFFSET;
|
||||
*get_x = DISPLAY_OFFSET.x;
|
||||
*get_y = DISPLAY_OFFSET.y;
|
||||
}
|
||||
|
||||
int display_orientation(int degrees)
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Licensed under TREZOR License
|
||||
* see LICENSE file for details
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __DISPLAY_H__
|
||||
|
@ -29,9 +41,6 @@
|
|||
#ifdef TREZOR_FONT_BOLD_ENABLE
|
||||
#define FONT_BOLD 2
|
||||
#endif
|
||||
#ifndef TREZOR_FONT_PREFILL
|
||||
#define TREZOR_FONT_PREFILL 1
|
||||
#endif
|
||||
|
||||
#define AVATAR_IMAGE_SIZE 144
|
||||
#define LOADER_ICON_SIZE 64
|
||||
|
@ -45,7 +54,7 @@
|
|||
|
||||
void display_init(void);
|
||||
void display_refresh(void);
|
||||
void display_save(const char *filename);
|
||||
void display_save(const char *prefix);
|
||||
|
||||
// provided by common
|
||||
|
||||
|
@ -64,15 +73,15 @@ void display_print(const char *text, int textlen);
|
|||
void display_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
#endif
|
||||
|
||||
void display_text(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor, int minwidth);
|
||||
void display_text_center(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor, int minwidth);
|
||||
void display_text_right(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor, int minwidth);
|
||||
void display_text(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor);
|
||||
void display_text_center(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor);
|
||||
void display_text_right(int x, int y, const char *text, int textlen, uint8_t font, uint16_t fgcolor, uint16_t bgcolor);
|
||||
int display_text_width(const char *text, int textlen, uint8_t font);
|
||||
|
||||
void display_qrcode(int x, int y, const char *data, int datalen, uint8_t scale);
|
||||
void display_loader(uint16_t progress, int yoffset, uint16_t fgcolor, uint16_t bgcolor, const uint8_t *icon, uint32_t iconlen, uint16_t iconfgcolor);
|
||||
|
||||
int *display_offset(int xy[2]);
|
||||
void display_offset(int set_xy[2], int *get_x, int *get_y);
|
||||
int display_orientation(int degrees);
|
||||
int display_backlight(int val);
|
||||
void display_fade(int start, int end, int delay);
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
/* & */ static const uint8_t Font_Roboto_Bold_20_glyph_38[] = { 13, 15, 14, 1, 15, 0, 59, 255, 196, 0, 0, 0, 63, 255, 255, 244, 0, 0, 11, 255, 136, 255, 208, 0, 0, 255, 224, 14, 255, 0, 0, 15, 255, 1, 255, 208, 0, 0, 175, 247, 207, 244, 0, 0, 2, 255, 255, 245, 0, 0, 0, 11, 255, 242, 0, 0, 0, 11, 255, 255, 160, 15, 252, 9, 255, 106, 255, 163, 255, 160, 239, 224, 12, 255, 239, 246, 15, 255, 0, 29, 255, 253, 0, 191, 252, 103, 223, 255, 144, 2, 239, 255, 255, 255, 255, 96, 1, 158, 255, 198, 79, 255, 64 };
|
||||
/* ' */ static const uint8_t Font_Roboto_Bold_20_glyph_39[] = { 3, 5, 4, 1, 15, 255, 31, 240, 255, 15, 224, 253, 0 };
|
||||
/* ( */ static const uint8_t Font_Roboto_Bold_20_glyph_40[] = { 6, 22, 7, 1, 17, 0, 0, 0, 0, 0, 168, 0, 28, 250, 0, 191, 208, 5, 255, 48, 13, 251, 0, 79, 246, 0, 143, 242, 0, 207, 240, 0, 239, 224, 0, 255, 208, 0, 255, 208, 0, 239, 208, 0, 223, 224, 0, 175, 240, 0, 111, 244, 0, 31, 249, 0, 9, 254, 0, 1, 239, 128, 0, 79, 245, 0, 4, 250, 0, 0, 19 };
|
||||
/* ) */ static const uint8_t Font_Roboto_Bold_20_glyph_41[] = { 7, 22, 7, -1, 17, 0, 0, 0, 0, 184, 0, 0, 13, 250, 0, 0, 30, 247, 0, 0, 111, 242, 0, 0, 239, 160, 0, 9, 255, 16, 0, 95, 245, 0, 2, 255, 144, 0, 15, 251, 0, 0, 255, 192, 0, 15, 252, 0, 0, 255, 176, 0, 31, 250, 0, 3, 255, 112, 0, 127, 242, 0, 12, 253, 0, 2, 255, 80, 0, 191, 192, 0, 143, 225, 0, 13, 226, 0, 0, 64, 0, 0 };
|
||||
/* ) */ static const uint8_t Font_Roboto_Bold_20_glyph_41[] = { 7, 22, 8, 0, 17, 0, 0, 0, 0, 184, 0, 0, 13, 250, 0, 0, 30, 247, 0, 0, 111, 242, 0, 0, 239, 160, 0, 9, 255, 16, 0, 95, 245, 0, 2, 255, 144, 0, 15, 251, 0, 0, 255, 192, 0, 15, 252, 0, 0, 255, 176, 0, 31, 250, 0, 3, 255, 112, 0, 127, 242, 0, 12, 253, 0, 2, 255, 80, 0, 191, 192, 0, 143, 225, 0, 13, 226, 0, 0, 64, 0, 0 };
|
||||
/* * */ static const uint8_t Font_Roboto_Bold_20_glyph_42[] = { 10, 9, 9, 0, 15, 0, 0, 253, 0, 0, 0, 0, 253, 0, 0, 9, 32, 253, 2, 112, 95, 251, 254, 191, 241, 5, 158, 255, 250, 96, 0, 13, 255, 128, 0, 0, 175, 124, 244, 0, 4, 252, 3, 254, 0, 0, 98, 0, 115, 0 };
|
||||
/* + */ static const uint8_t Font_Roboto_Bold_20_glyph_43[] = { 10, 11, 12, 1, 12, 0, 13, 255, 0, 0, 0, 13, 255, 0, 0, 0, 13, 255, 0, 0, 0, 13, 255, 0, 0, 85, 94, 255, 85, 85, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 13, 255, 0, 0, 0, 13, 255, 0, 0, 0, 13, 255, 0, 0, 0, 13, 255, 0, 0 };
|
||||
/* , */ static const uint8_t Font_Roboto_Bold_20_glyph_44[] = { 5, 7, 5, -1, 2, 0, 255, 208, 15, 253, 0, 255, 192, 63, 247, 9, 254, 16, 142, 48, 0, 0, 0 };
|
||||
/* , */ static const uint8_t Font_Roboto_Bold_20_glyph_44[] = { 5, 7, 6, 0, 2, 0, 255, 208, 15, 253, 0, 255, 192, 63, 247, 9, 254, 16, 142, 48, 0, 0, 0 };
|
||||
/* - */ static const uint8_t Font_Roboto_Bold_20_glyph_45[] = { 6, 3, 8, 1, 8, 85, 85, 85, 255, 255, 255, 255, 255, 255 };
|
||||
/* . */ static const uint8_t Font_Roboto_Bold_20_glyph_46[] = { 3, 3, 5, 1, 3, 159, 111, 252, 159, 96 };
|
||||
/* / */ static const uint8_t Font_Roboto_Bold_20_glyph_47[] = { 9, 16, 7, -1, 15, 0, 0, 1, 255, 0, 0, 0, 111, 176, 0, 0, 11, 246, 0, 0, 0, 255, 16, 0, 0, 95, 176, 0, 0, 11, 246, 0, 0, 0, 255, 16, 0, 0, 95, 176, 0, 0, 10, 246, 0, 0, 0, 255, 16, 0, 0, 95, 192, 0, 0, 10, 247, 0, 0, 0, 255, 16, 0, 0, 79, 192, 0, 0, 10, 247, 0, 0, 0, 255, 32, 0, 0 };
|
||||
/* / */ static const uint8_t Font_Roboto_Bold_20_glyph_47[] = { 9, 16, 8, 0, 15, 0, 0, 1, 255, 0, 0, 0, 111, 176, 0, 0, 11, 246, 0, 0, 0, 255, 16, 0, 0, 95, 176, 0, 0, 11, 246, 0, 0, 0, 255, 16, 0, 0, 95, 176, 0, 0, 10, 246, 0, 0, 0, 255, 16, 0, 0, 95, 192, 0, 0, 10, 247, 0, 0, 0, 255, 16, 0, 0, 79, 192, 0, 0, 10, 247, 0, 0, 0, 255, 32, 0, 0 };
|
||||
/* 0 */ static const uint8_t Font_Roboto_Bold_20_glyph_48[] = { 10, 15, 12, 1, 15, 0, 108, 255, 180, 0, 10, 255, 255, 255, 112, 79, 254, 103, 255, 242, 175, 243, 0, 95, 247, 239, 224, 0, 31, 251, 255, 208, 0, 15, 252, 255, 208, 0, 15, 253, 255, 208, 0, 15, 253, 255, 208, 0, 15, 253, 255, 208, 0, 15, 252, 223, 224, 0, 31, 251, 175, 243, 0, 95, 247, 79, 254, 103, 255, 242, 9, 255, 255, 255, 112, 0, 108, 255, 196, 0 };
|
||||
/* 1 */ static const uint8_t Font_Roboto_Bold_20_glyph_49[] = { 7, 15, 11, 1, 15, 0, 0, 73, 192, 40, 239, 253, 111, 255, 255, 216, 255, 191, 253, 69, 0, 255, 208, 0, 15, 253, 0, 0, 255, 208, 0, 15, 253, 0, 0, 255, 208, 0, 15, 253, 0, 0, 255, 208, 0, 15, 253, 0, 0, 255, 208, 0, 15, 253, 0, 0, 255, 208 };
|
||||
/* 2 */ static const uint8_t Font_Roboto_Bold_20_glyph_50[] = { 10, 15, 12, 1, 15, 0, 108, 255, 216, 16, 10, 255, 255, 255, 209, 111, 254, 102, 223, 248, 207, 242, 0, 63, 252, 221, 176, 0, 15, 252, 0, 0, 0, 79, 249, 0, 0, 0, 223, 243, 0, 0, 10, 255, 144, 0, 0, 159, 252, 0, 0, 9, 255, 209, 0, 0, 143, 254, 32, 0, 8, 255, 226, 0, 0, 143, 255, 133, 85, 85, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
|
||||
|
@ -78,7 +78,7 @@
|
|||
/* g */ static const uint8_t Font_Roboto_Bold_20_glyph_103[] = { 10, 15, 12, 1, 11, 0, 142, 253, 92, 253, 12, 255, 255, 255, 253, 111, 254, 118, 207, 253, 207, 244, 0, 15, 253, 255, 240, 0, 15, 253, 255, 208, 0, 15, 253, 255, 224, 0, 15, 253, 207, 244, 0, 15, 253, 111, 254, 118, 207, 253, 12, 255, 255, 255, 253, 0, 142, 253, 95, 252, 1, 16, 0, 79, 251, 12, 231, 87, 239, 245, 46, 255, 255, 255, 160, 1, 141, 255, 197, 0 };
|
||||
/* h */ static const uint8_t Font_Roboto_Bold_20_glyph_104[] = { 9, 15, 11, 1, 15, 255, 208, 0, 0, 15, 253, 0, 0, 0, 255, 208, 0, 0, 15, 253, 0, 0, 0, 255, 212, 207, 214, 15, 255, 255, 255, 246, 255, 250, 105, 255, 207, 253, 0, 14, 255, 255, 208, 0, 223, 255, 253, 0, 13, 255, 255, 208, 0, 223, 255, 253, 0, 13, 255, 255, 208, 0, 223, 255, 253, 0, 13, 255, 255, 208, 0, 223, 240 };
|
||||
/* i */ static const uint8_t Font_Roboto_Bold_20_glyph_105[] = { 3, 15, 5, 1, 15, 159, 111, 252, 159, 96, 0, 255, 223, 253, 255, 223, 253, 255, 223, 253, 255, 223, 253, 255, 223, 253, 255, 208 };
|
||||
/* j */ static const uint8_t Font_Roboto_Bold_20_glyph_106[] = { 5, 19, 5, -1, 15, 0, 159, 96, 15, 252, 0, 159, 96, 0, 0, 0, 255, 208, 15, 253, 0, 255, 208, 15, 253, 0, 255, 208, 15, 253, 0, 255, 208, 15, 253, 0, 255, 208, 15, 253, 0, 255, 208, 15, 252, 106, 255, 175, 255, 243, 239, 197, 0 };
|
||||
/* j */ static const uint8_t Font_Roboto_Bold_20_glyph_106[] = { 5, 19, 6, 0, 15, 0, 159, 96, 15, 252, 0, 159, 96, 0, 0, 0, 255, 208, 15, 253, 0, 255, 208, 15, 253, 0, 255, 208, 15, 253, 0, 255, 208, 15, 253, 0, 255, 208, 15, 253, 0, 255, 208, 15, 252, 106, 255, 175, 255, 243, 239, 197, 0 };
|
||||
/* k */ static const uint8_t Font_Roboto_Bold_20_glyph_107[] = { 10, 15, 11, 1, 15, 255, 208, 0, 0, 0, 255, 208, 0, 0, 0, 255, 208, 0, 0, 0, 255, 208, 0, 0, 0, 255, 208, 5, 255, 225, 255, 208, 63, 255, 48, 255, 209, 239, 245, 0, 255, 220, 255, 128, 0, 255, 255, 253, 0, 0, 255, 255, 255, 48, 0, 255, 254, 255, 208, 0, 255, 225, 159, 248, 0, 255, 208, 30, 255, 48, 255, 208, 6, 255, 192, 255, 208, 0, 207, 247 };
|
||||
/* l */ static const uint8_t Font_Roboto_Bold_20_glyph_108[] = { 3, 15, 5, 1, 15, 255, 223, 253, 255, 223, 253, 255, 223, 253, 255, 223, 253, 255, 223, 253, 255, 223, 253, 255, 223, 253, 255, 208 };
|
||||
/* m */ static const uint8_t Font_Roboto_Bold_20_glyph_109[] = { 16, 11, 17, 1, 11, 255, 181, 207, 232, 4, 207, 216, 0, 255, 255, 255, 255, 191, 255, 255, 144, 255, 250, 89, 255, 252, 103, 255, 240, 255, 208, 0, 239, 241, 0, 191, 242, 255, 208, 0, 223, 240, 0, 175, 242, 255, 208, 0, 223, 240, 0, 175, 242, 255, 208, 0, 223, 240, 0, 175, 242, 255, 208, 0, 223, 240, 0, 175, 242, 255, 208, 0, 223, 240, 0, 175, 242, 255, 208, 0, 223, 240, 0, 175, 242, 255, 208, 0, 223, 240, 0, 175, 242 };
|
||||
|
@ -93,7 +93,7 @@
|
|||
/* v */ static const uint8_t Font_Roboto_Bold_20_glyph_118[] = { 10, 11, 10, 0, 11, 191, 243, 0, 47, 252, 111, 247, 0, 111, 247, 31, 252, 0, 175, 242, 11, 255, 0, 239, 208, 6, 255, 67, 255, 112, 1, 255, 135, 255, 32, 0, 207, 203, 253, 0, 0, 127, 255, 248, 0, 0, 31, 255, 243, 0, 0, 12, 255, 208, 0, 0, 7, 255, 128, 0 };
|
||||
/* w */ static const uint8_t Font_Roboto_Bold_20_glyph_119[] = { 15, 11, 15, 0, 11, 159, 241, 0, 223, 112, 7, 255, 69, 255, 64, 31, 252, 0, 175, 240, 31, 247, 6, 255, 240, 13, 252, 0, 223, 176, 175, 255, 80, 255, 128, 9, 254, 14, 252, 249, 63, 244, 0, 111, 244, 254, 79, 214, 255, 0, 2, 255, 207, 160, 255, 207, 192, 0, 14, 255, 245, 10, 255, 248, 0, 0, 175, 255, 16, 111, 255, 80, 0, 6, 255, 192, 1, 255, 241, 0, 0, 47, 247, 0, 12, 253, 0, 0 };
|
||||
/* x */ static const uint8_t Font_Roboto_Bold_20_glyph_120[] = { 11, 11, 10, 0, 11, 111, 250, 0, 111, 249, 0, 223, 242, 14, 255, 16, 4, 255, 183, 255, 128, 0, 11, 255, 255, 224, 0, 0, 47, 255, 246, 0, 0, 0, 207, 255, 0, 0, 0, 79, 255, 248, 0, 0, 13, 255, 239, 241, 0, 6, 255, 149, 255, 160, 0, 239, 241, 12, 255, 48, 143, 248, 0, 79, 252, 0 };
|
||||
/* y */ static const uint8_t Font_Roboto_Bold_20_glyph_121[] = { 11, 15, 10, -1, 11, 14, 255, 16, 4, 255, 160, 159, 245, 0, 159, 245, 4, 255, 160, 14, 255, 0, 14, 255, 3, 255, 160, 0, 143, 244, 127, 244, 0, 3, 255, 140, 254, 0, 0, 13, 254, 255, 144, 0, 0, 143, 255, 244, 0, 0, 2, 255, 254, 0, 0, 0, 13, 255, 144, 0, 0, 0, 143, 243, 0, 0, 0, 11, 254, 0, 0, 0, 89, 255, 128, 0, 0, 15, 255, 225, 0, 0, 0, 239, 195, 0, 0, 0 };
|
||||
/* y */ static const uint8_t Font_Roboto_Bold_20_glyph_121[] = { 11, 15, 11, 0, 11, 14, 255, 16, 4, 255, 160, 159, 245, 0, 159, 245, 4, 255, 160, 14, 255, 0, 14, 255, 3, 255, 160, 0, 143, 244, 127, 244, 0, 3, 255, 140, 254, 0, 0, 13, 254, 255, 144, 0, 0, 143, 255, 244, 0, 0, 2, 255, 254, 0, 0, 0, 13, 255, 144, 0, 0, 0, 143, 243, 0, 0, 0, 11, 254, 0, 0, 0, 89, 255, 128, 0, 0, 15, 255, 225, 0, 0, 0, 239, 195, 0, 0, 0 };
|
||||
/* z */ static const uint8_t Font_Roboto_Bold_20_glyph_122[] = { 8, 11, 10, 1, 11, 255, 255, 255, 255, 255, 255, 255, 255, 85, 85, 207, 247, 0, 3, 255, 192, 0, 13, 255, 32, 0, 143, 246, 0, 3, 255, 176, 0, 13, 255, 16, 0, 143, 250, 85, 85, 255, 255, 255, 255, 255, 255, 255, 255 };
|
||||
/* { */ static const uint8_t Font_Roboto_Bold_20_glyph_123[] = { 7, 21, 7, 0, 17, 0, 0, 0, 0, 0, 25, 224, 0, 29, 255, 32, 8, 255, 64, 0, 223, 240, 0, 15, 253, 0, 0, 255, 208, 0, 15, 253, 0, 2, 255, 176, 3, 207, 245, 0, 143, 246, 0, 8, 255, 176, 0, 8, 255, 128, 0, 31, 252, 0, 0, 255, 208, 0, 15, 253, 0, 0, 255, 208, 0, 12, 255, 0, 0, 95, 248, 0, 0, 159, 243, 0, 0, 73, 0 };
|
||||
/* | */ static const uint8_t Font_Roboto_Bold_20_glyph_124[] = { 2, 17, 6, 2, 15, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253 };
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
/* g */ static const uint8_t Font_Roboto_Regular_20_glyph_103[] = { 9, 15, 11, 1, 11, 1, 158, 252, 90, 240, 223, 200, 175, 239, 127, 160, 0, 79, 252, 242, 0, 0, 223, 254, 0, 0, 13, 255, 208, 0, 0, 223, 254, 0, 0, 13, 252, 242, 0, 0, 223, 111, 160, 0, 95, 240, 207, 200, 175, 255, 1, 158, 252, 93, 240, 0, 0, 0, 254, 26, 16, 0, 111, 146, 239, 168, 191, 225, 1, 157, 254, 145, 0 };
|
||||
/* h */ static const uint8_t Font_Roboto_Regular_20_glyph_104[] = { 8, 15, 10, 1, 15, 253, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 60, 253, 128, 254, 250, 158, 248, 255, 80, 1, 253, 253, 0, 0, 223, 253, 0, 0, 223, 253, 0, 0, 223, 253, 0, 0, 223, 253, 0, 0, 223, 253, 0, 0, 223, 253, 0, 0, 223, 253, 0, 0, 223 };
|
||||
/* i */ static const uint8_t Font_Roboto_Regular_20_glyph_105[] = { 2, 15, 4, 1, 15, 201, 83, 0, 0, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253 };
|
||||
/* j */ static const uint8_t Font_Roboto_Regular_20_glyph_106[] = { 4, 19, 4, -1, 15, 0, 201, 0, 83, 0, 0, 0, 0, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 252, 1, 251, 156, 248, 238, 160 };
|
||||
/* j */ static const uint8_t Font_Roboto_Regular_20_glyph_106[] = { 4, 19, 5, 0, 15, 0, 201, 0, 83, 0, 0, 0, 0, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 253, 0, 252, 1, 251, 156, 248, 238, 160 };
|
||||
/* k */ static const uint8_t Font_Roboto_Regular_20_glyph_107[] = { 9, 15, 10, 1, 15, 253, 0, 0, 0, 15, 208, 0, 0, 0, 253, 0, 0, 0, 15, 208, 0, 0, 0, 253, 0, 6, 252, 15, 208, 5, 253, 16, 253, 3, 254, 32, 15, 210, 255, 32, 0, 253, 223, 80, 0, 15, 255, 252, 0, 0, 255, 105, 248, 0, 15, 208, 13, 244, 0, 253, 0, 63, 225, 15, 208, 0, 127, 160, 253, 0, 0, 191, 96 };
|
||||
/* l */ static const uint8_t Font_Roboto_Regular_20_glyph_108[] = { 2, 15, 5, 2, 15, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253 };
|
||||
/* m */ static const uint8_t Font_Roboto_Regular_20_glyph_109[] = { 15, 11, 17, 1, 11, 251, 92, 254, 128, 60, 254, 144, 15, 255, 153, 239, 175, 184, 223, 160, 255, 32, 2, 255, 112, 0, 239, 15, 208, 0, 13, 241, 0, 10, 242, 253, 0, 0, 223, 0, 0, 175, 63, 208, 0, 13, 240, 0, 10, 243, 253, 0, 0, 223, 0, 0, 175, 63, 208, 0, 13, 240, 0, 10, 243, 253, 0, 0, 223, 0, 0, 175, 63, 208, 0, 13, 240, 0, 10, 243, 253, 0, 0, 223, 0, 0, 175, 48 };
|
||||
|
@ -97,7 +97,7 @@
|
|||
/* z */ static const uint8_t Font_Roboto_Regular_20_glyph_122[] = { 8, 11, 10, 1, 11, 255, 255, 255, 255, 136, 136, 139, 253, 0, 0, 30, 242, 0, 0, 175, 96, 0, 5, 251, 0, 0, 47, 225, 0, 0, 207, 64, 0, 7, 248, 0, 0, 63, 208, 0, 0, 223, 168, 136, 136, 255, 255, 255, 255 };
|
||||
/* { */ static const uint8_t Font_Roboto_Regular_20_glyph_123[] = { 6, 21, 7, 1, 16, 0, 0, 52, 0, 9, 249, 0, 95, 128, 0, 207, 16, 0, 237, 0, 0, 253, 0, 0, 253, 0, 0, 252, 0, 5, 249, 0, 159, 225, 0, 255, 144, 0, 27, 245, 0, 2, 251, 0, 0, 252, 0, 0, 253, 0, 0, 253, 0, 0, 222, 0, 0, 159, 48, 0, 46, 211, 0, 2, 186, 0, 0, 0 };
|
||||
/* | */ static const uint8_t Font_Roboto_Regular_20_glyph_124[] = { 2, 17, 6, 2, 15, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253 };
|
||||
/* } */ static const uint8_t Font_Roboto_Regular_20_glyph_125[] = { 7, 21, 7, -1, 16, 5, 32, 0, 0, 207, 96, 0, 0, 191, 32, 0, 3, 249, 0, 0, 15, 176, 0, 0, 252, 0, 0, 15, 208, 0, 0, 253, 0, 0, 12, 242, 0, 0, 63, 233, 0, 0, 175, 240, 0, 143, 129, 0, 14, 224, 0, 0, 253, 0, 0, 15, 208, 0, 0, 252, 0, 0, 47, 160, 0, 7, 246, 0, 5, 253, 0, 0, 201, 16, 0, 0, 0, 0, 0 };
|
||||
/* } */ static const uint8_t Font_Roboto_Regular_20_glyph_125[] = { 7, 21, 8, 0, 16, 5, 32, 0, 0, 207, 96, 0, 0, 191, 32, 0, 3, 249, 0, 0, 15, 176, 0, 0, 252, 0, 0, 15, 208, 0, 0, 253, 0, 0, 12, 242, 0, 0, 63, 233, 0, 0, 175, 240, 0, 143, 129, 0, 14, 224, 0, 0, 253, 0, 0, 15, 208, 0, 0, 252, 0, 0, 47, 160, 0, 7, 246, 0, 5, 253, 0, 0, 201, 16, 0, 0, 0, 0, 0 };
|
||||
/* ~ */ static const uint8_t Font_Roboto_Regular_20_glyph_126[] = { 11, 4, 13, 1, 8, 8, 238, 144, 0, 10, 182, 253, 158, 193, 1, 252, 223, 16, 29, 233, 223, 90, 144, 0, 9, 254, 112 };
|
||||
|
||||
const uint8_t * const Font_Roboto_Regular_20[126 + 1 - 32] = {
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* stream_inflate - tiny inflate library with output streaming
|
||||
*
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
* This file is part of the TREZOR project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __INFLATE_H__
|
||||
#define __INFLATE_H__
|
||||
|
||||
|
|