mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-19 21:08:07 +00:00
482b4569f5
Squashed commit of the following: commit 84d3486f59bda063f06521c8b695ea4b07781ec6 Author: matejcik <ja@matejcik.cz> Date: Fri May 17 14:17:15 2019 +0200 mocks: complete commit d538133a6d0fb4af06c7c81f80b8675869fb5908 Author: matejcik <ja@matejcik.cz> Date: Fri May 17 14:12:26 2019 +0200 mocks part 3 commit 9f0b868d41dafaf487df6fc844db7f3368eabe1b Author: matejcik <ja@matejcik.cz> Date: Fri May 17 14:09:20 2019 +0200 mocks: update generated mocks commit 5d80c18a7824ed16fc11cde4cdb8ebca7ed33400 Author: matejcik <ja@matejcik.cz> Date: Thu May 16 15:49:40 2019 +0200 mocks wip 2 commit 4b576eb796136a61eb88cb0d281fa4e21eadada8 Author: matejcik <ja@matejcik.cz> Date: Tue May 7 17:02:51 2019 +0200 WIP mocks part 1 commit cf3f0d4471ab74b478d2970b0bb178feae7c86a3 Author: matejcik <ja@matejcik.cz> Date: Fri May 3 17:07:53 2019 +0200 core: add package to secp256k1_zkp for mocking commit 8a12f26c8c0d99363c8df96012426abbbb3ff6cb Author: matejcik <ja@matejcik.cz> Date: Fri May 3 17:04:05 2019 +0200 core: blackify extmod docstring quotes commit b6f239676dde8b60b001fcae4e5de80a71dbacf2 Author: matejcik <ja@matejcik.cz> Date: Fri May 3 16:52:27 2019 +0200 core: make build_mocks directory agnostic mocks: detect bad packages mocks: revert noqa in favor of setup.cfg mocks: fix broken comment formatting
37 lines
930 B
Python
37 lines
930 B
Python
from typing import *
|
|
|
|
|
|
# extmod/modtrezorutils/modtrezorutils.c
|
|
def consteq(sec: bytes, pub: bytes) -> bool:
|
|
"""
|
|
Compares the private information in `sec` with public, user-provided
|
|
information in `pub`. Runs in constant time, corresponding to a length
|
|
of `pub`. Can access memory behind valid length of `sec`, caller is
|
|
expected to avoid any invalid memory access.
|
|
"""
|
|
|
|
|
|
# extmod/modtrezorutils/modtrezorutils.c
|
|
def memcpy(
|
|
dst: bytearray, dst_ofs: int, src: bytearray, src_ofs: int, n: int
|
|
) -> int:
|
|
"""
|
|
Copies at most `n` bytes from `src` at offset `src_ofs` to
|
|
`dst` at offset `dst_ofs`. Returns the number of actually
|
|
copied bytes.
|
|
"""
|
|
|
|
|
|
# extmod/modtrezorutils/modtrezorutils.c
|
|
def halt(msg: str = None) -> None:
|
|
"""
|
|
Halts execution.
|
|
"""
|
|
|
|
|
|
# extmod/modtrezorutils/modtrezorutils.c
|
|
def set_mode_unprivileged() -> None:
|
|
"""
|
|
Set unprivileged mode.
|
|
"""
|