You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ibz/20240423-repeated-backup
mmilata/ui-t3t1-send
tychovrahe/ui-t3t1/htc-anim
mmilata/ui-t3t1-words-animation
mmilata/ui-t3t1-buttonrequest
obrusvit/ui-t3t1-icons-reexport
M1nd3r/thp8
matejcik/repeated-backup-tmp
andrewkozlik/slip39
tychovrahe/refactor/emu_boards
main
mmilata/br-rs
tychovrahe/ui-t3t1/status_anim
tychovrahe/ui-t3t1/confirm_action
obrusvit/ui-t3t1-passphrase
tychovrahe/ui-t3t1/haptic_setting
tychovrahe/ui-t3t1/brightness
cepetr/drawlib-demo
cepetr/drawlib-anim
cepetr/drawlib-overlays
ui-t3t1
matejcik/lifetimehell
feat/cardano/conway/stake-certs
mmilata/ui-t3t1-preview
ibz/20240423-repeated-backup-rebased-2
mmilata/tmp
M1nd3r/thp7
ibz/20240423-repeated-backup-rebased
ibz/20240510-t3t1-support
tychovrahe/u5/bootloader_unlock
onvej-sl/elligator2-squashed-rebased
onvej-sl/initialize-variables-squashed-rebased
buildgen-update
M1nd3r/thp6
onvej-sl/elligator2_test
mmilata/nixpkgs-bump
cepetr/gfx-alpha
tychovrahe/brightness/setting
dependabot/pip/jinja2-3.1.4
mmilata/ui-t3t1-internal-transitions
mmilata/ui-t3t1-verticalmenu
mmilata/ui-test-missing-screens
cepetr/haptic-loader
M1nd3r/thp5
M1nd3r/thp2
cepetr/drawlib-drivers
tychovrahe/t3b1/hw_support
mmilata/ui-t3t1-reset-device-apple-fix
obrusvit/ui-t3t1-reset-device-apple-hotfix
onvej-sl/optiga-debug
tychovrahe/T3W1/devkit1_with_zephyr
cepetr/haptic-test
onvej-sl/initialize-variables-test
obrusvit/3600-unicode-font-uppercasing-issues-by-generating
andrewkozlik/optiga-debug
tychovrahe/bootloader/confirmation
matejcik/queue-overflow
matejcik/global-layout-only3
mmilata/ui-t3t1-swipe
ibz/20240207-format-progress
matejcik/button-fixes
mmilata/feat/solana
cepetr/ui-t3t1/apple-fix
cepetr/drawlib-integration
mmilata/color
onvej-sl/remove-unused-crypto
tychovrahe/tstring/labelbutton
matejcik/ui-test-spam
matejcik/sleep-1000
tychovrahe/u5/basic_support_prepare2
matejcik/flash-area
mmilata/non-mut-paint
tychovrahe/storage/streaming
tychovrahe/u5/basic_support_revE_200ksprod_whitescreen
tychovrahe/u5/basic_support_revE_200ksprod_bluescreen
matejcik/global-layout-only2
tychovrahe/u5/basic_support_revE_200ksprod
release/24.03
grdddj/t3t1_keyboards
mmilata/update-monero-tests
tychovrahe/u5/basic_support_revE_bhk
obrusvit/remove-misc-crypto-func-from-btc-only
mmilata/pubkey-descriptor-legacy
obrusvit/remove-cosi-from-trezorctl
cepetr/new-drawing-api
tychovrahe/sdcard/testing
mmilata/blob-doc
obrusvit/erc20-func-support
hello-world
cepetr/lto-experiment
obrusvit/sd-card-backup
mmilata/ble-rebased
mmilata/ble
tychovrahe/boot_sequence/rust
cepetr/display-if-refactor
andrewkozlik/optiga
matejcik/trezorctl-cert
matejcik/prodtest3
release/23.12
vacuum/feat/solana
grdddj/solana_summary_layout
tychovrahe/T3W1/devkit1_with_ble_crypto3
matejcik/global-layout-only
cepetr/u5/tz-poc
mmilata/tt-ui-properties-same-screen
hw/mmilata/usb
release/23.11
tychovrahe/T3W1/devkit1_with_ble_crypto2
tychovrahe/T3W1/devkit1_with_ble_crypto2b
tychovrahe/fw_translations/mpu
tychovrahe/u5/master
tychovrahe/T3W1/devkit1_with_ble2
vacuum_feat_solana
grdddj/master_to_main_changes
tychovrahe/btconly/cli
cepetr/cmake-experiment
cepetr/saes-experiment
cepetr/u5/tamper-experiment
matejcik/prodtest-23-10
cepetr/cordic-experiment
temp_ci_master
release/23.09
tychovrahe/T3W1/devkit1_with_ble_crypto5
tychovrahe/trdisplay/qr
rust-build-protos
tmp
mmilata/default_homescreen_preview
matejcik/prodtest-no-echo
matejcik/prodtest-nolock
grdddj/mono_font_m_w_width
mmilata/optiga-serial
tychovrahe/T3T1/haptic_test
grdddj/tr_content_centering
grdddj/internal_model_tests
tychovrahe/T3W1/devkit1_with_ble
matejcik/prodtest-tr
mmilata/block-justify
fix-shares-info-btn
solana-poc
grdddj/ruff_linter
andrewkozlik/sha384
issue_69
issue_2923
tychovrahe/u5/flash_qw
mmilata/bluetooth/dbus-next
grdddj/tt_success_screen_redesign
mmilata/set-interruptable-true
mmilata/u5/flash
tychovrahe/core/priviledged3
grdddj/tr_wallet_creation
grdddj/tr_recovery
matejcik/test-greenlets
grdddj/tr_pin
grdddj/tr_coinjoin_design
grdddj/tr_passphrase
matejcik/build-mocks-draft
hw/tmp
matejcik/global-layout-new
grdddj/ci_report_resolver
tychovrahe/T3W1/devkit1_with_ble_sq3
grdddj/tr_pin_entry_4_digits_enter
grdddj/tr_rebase
tychovrahe/trbootloader/main_before
tychovrahe/centering/test
hw/mmilata/ci-fixes
hw/mmilata/tmp
tychovrahe/bluetooth/master
tychovrahe/bluetooth/unification2
grdddj/debuglink_improvements
release/23.04
tychovrahe/bluetooth/cleaner_disc2
grdddj/tr_homescreen_game
display-gamma-wip
mmilata/merge-release-23.03-gitlab-pls
grdddj/different_colors_for_old_display
release/23.03
andrewkozlik/coinjoin
mmilata/touch-test
andrewkozlik/safari
Hannsek-patch-1
hw/mmilata/upy-1.19.1
andrewkozlik/apple3
andrewkozlik/apple2
tychovrahe/rust_bootloader_/tr
grdddj/R_debug_font_screen
mmilata/homescreen/bg_jpg
andrewkozlik/account-naming3
andrewkozlik/account-naming2
tychovrahe/homescreen/bg_jpg_rust3a
tychovrahe/homescreen/bg_jpg_rust2a
zcash-orchard
tychovrahe/homescreen/bg_jpg_rust
tychovrahe/tests/reportfix
mmilata/global-layout-rebased
marnova/ethereum_defs_from_host-tmp
vd/try-new-tenv-image
tychovrahe/jpeg/basic
tychovrahe/homescreen/bg
mmilata/homescreen/bg
mroz/experiments
zcash-rust-primitives
tychovrahe/rust_bootloader_/model_r_b
mmilata/zeroize
tychovrahe/power/pwm
release/22.11
tychovrahe/cpufreq/18mhz
andrewkozlik/coinjoin-request
onvej-sl/coinjoin-speed-step-3
omikle/t1_signatures_from_tt_computation
andrewkozlik/coinjoin-slip25
tychovrahe/chip/test
grdddj/trezor_r_passphrase_input
matejcik/auto-paginate-ttv1
tychovrahe/boot_sequence/test
tychovrahe/trezor_r_passphrase_input
matejcik/iter-renderer
mmilata/text-theme-ref
mroz/fix-connect-tests
tychovrahe/dma2d/experiments2
release/22.08
vd/build-1.11.2
vd/build-2.5.2
mmilata/global-layout-notify-after-br
zcash-unified-addresses
andrewkozlik/1864b
tychovrahe/model_r_anim
onvej-sl/fix-base58-monero
andrewkozlik/fw-hash-fail
tychovrahe/double_btn
mmilata/bitcoin-only-cloudflare
tychovrahe/hold_to_confirm
marnova/coin_def_from_host
tychovrahe/succes_animation_bld
tychovrahe/hold_to_confirm_bld_c5
andrewkozlik/slip25b
lnswap
andrewkozlik/account-naming
vd/core-build-for-tenv
tychovrahe/r_pin_figma_embed
onvej-sl/poetry2nix
matejcik/rust-cache
release/22.05
andrewkozlik/fw-hash2
grdddj/storage_rust
mmilata/rtb
mmilata/monero-drop-python-test
mmilata/monero-test
matejcik/trezorhal-rs
zcash-v5
andrewkozlik/test_sig_verify
grdddj/storage_recovery_rust_rewrite
grdddj/storage_device_rust_rewrite
vdovhanych/arm-emu-deploy
rust_cache
rust_io
mmilata/dynamic_place
mmilata/nix_shell_rust_vscode_support
grdddj/secure_input
matejcik/buttonrequests
grdddj/tt_enable_usb_by_default
mmilata/update-deps-nodejs14
mmilata/tt-pin-keyboard
mmilata/hwi-test
mmilata/tt-confirm-action-spacing
matejcik/one-of
onvej-sl/fix-rfc6979
macro_obj_module
release/22.01
onvej-sl/trezor_crypto_libfuzzer
mmilata/sanitizer
matejcik/monero-typing
mmilata/blind-eip712
omikle/double_reset_dialog
mmilata/layouts-t1
rust-ui-improvements
release/21.12
rust-codec
python/0.12.x
onvej-sl/gcc-11-legacy-fix
release/21.09
display-nv3030a
grdddj/suite-e2e-tests-in-ci
release/21.07
omikle/intermediate_fw_confirmation_fix_3
vdovhanych/ci-automate-common-deploy
omikle/intermediate_fw_confirmation_fix
display-refactor
release/21.06
release/21.05-inter
andrewkozlik/storage-init-refactor
release/21.05
update-support
snake
rust-extmod
onvej-sl/drbg_rework
ecdh-pubkey
omikle/redesign_bootloader
release/21.02
omikle/tt_stay_in_bootloader
actions
andrewkozlik/fido2-credmgmt
andrewkozlik/t1-keyboard-cyclic
andrewkozlik/t1-keyboard
poc/andrew-t1-keyboard
release/2020-10
release/2020-09
release/2020-08
decode_bytes
profile-memory
slots
release/2020-06
i18n-block
poc/t1-passphrase-on-device
secbytes
matejcik/eventloop
release/2020-04
release/2020-03
ontology
trezorhal-usb
release/2020-01
poc/dualbuttonime
storage-get-nocopy
release/2019-10
memory-fix
release/2019-09
ripple-full
release/2019-08
release/2019-08-t1
andrewkozlik/touchpanel-test
release/2019-07
release/2019-06
release/2019-05
core/v2.7.0
core/v2.6.4
core/v2.6.3
core/v2.6.0
legacy/v1.12.1
v0-working3
v0-broken2
v0-broken1
v0-working2
v0-working1
v0-broken0
v0-working
core/bl2.0.0
core/bl2.0.1
core/bl2.0.2
core/bl2.0.3
core/bl2.1.0
core/bl2.1.1
core/bl2.1.2
core/bl2.1.3
core/bl2.1.4
core/bl2.1.5
core/bl2.1.6
core/boardloader/v2.1.0
core/boardloader/v2.1.1
core/boardloader/v2.1.2
core/br2.0.0
core/br2.0.1
core/v2.0.10
core/v2.0.5
core/v2.0.6
core/v2.0.7
core/v2.0.8
core/v2.0.9
core/v2.1.0
core/v2.1.1
core/v2.1.2
core/v2.1.3
core/v2.1.4
core/v2.1.5
core/v2.1.6
core/v2.1.7
core/v2.1.8
core/v2.2.0
core/v2.3.0
core/v2.3.1
core/v2.3.2
core/v2.3.3
core/v2.3.4
core/v2.3.5
core/v2.3.6
core/v2.4.0
core/v2.4.1
core/v2.4.2
core/v2.4.3
core/v2.5.1
core/v2.5.2
core/v2.5.3
core/v2.6.2
legacy/bl1.11.0
legacy/bl1.12.0
legacy/bl1.12.1
legacy/bl1.3.0
legacy/bl1.3.1
legacy/bl1.3.2
legacy/bl1.3.3
legacy/bl1.4.0
legacy/bl1.5.0
legacy/bl1.5.1
legacy/bl1.6.0
legacy/bl1.6.1
legacy/bl1.8.0
legacy/v1.0.0
legacy/v1.1.0
legacy/v1.10.0
legacy/v1.10.1
legacy/v1.10.2
legacy/v1.10.3
legacy/v1.10.4
legacy/v1.10.5
legacy/v1.11.1
legacy/v1.11.2
legacy/v1.12.0
legacy/v1.2.0
legacy/v1.2.1
legacy/v1.3.0
legacy/v1.3.1
legacy/v1.3.2
legacy/v1.3.3
legacy/v1.3.4
legacy/v1.3.5
legacy/v1.3.6
legacy/v1.4.0
legacy/v1.4.1
legacy/v1.4.2
legacy/v1.5.0
legacy/v1.5.1
legacy/v1.5.2
legacy/v1.6.0
legacy/v1.6.1
legacy/v1.6.2
legacy/v1.6.3
legacy/v1.7.0
legacy/v1.7.1
legacy/v1.7.2
legacy/v1.7.3
legacy/v1.8.0
legacy/v1.8.1
legacy/v1.8.2
legacy/v1.8.3
legacy/v1.9.0
legacy/v1.9.1
legacy/v1.9.2
legacy/v1.9.3
legacy/v1.9.4
prodtest/23-08-07
prodtest/23-08-10
prodtest/23-08-14
prodtest/23-08-31
prodtest/23-10-06
prodtest/23-12-18
prodtest/v0.2.5
prodtest/v0.2.6
prodtest/v23.04
python/v0.10.0
python/v0.10.1
python/v0.10.2
python/v0.11.0
python/v0.11.1
python/v0.11.2
python/v0.11.3
python/v0.11.4
python/v0.11.5
python/v0.11.6
python/v0.12.0
python/v0.12.1
python/v0.12.2
python/v0.12.3
python/v0.12.4
python/v0.13.0
python/v0.13.1
python/v0.13.2
python/v0.13.3
python/v0.13.4
python/v0.13.5
python/v0.13.6
python/v0.13.7
python/v0.13.8
python/v0.5.0
python/v0.5.1
python/v0.5.2
python/v0.5.3
python/v0.5.4
python/v0.6.0
python/v0.6.1
python/v0.6.10
python/v0.6.11
python/v0.6.12
python/v0.6.13
python/v0.6.2
python/v0.6.3
python/v0.6.4
python/v0.6.5
python/v0.6.6
python/v0.6.7
python/v0.6.8
python/v0.6.9
python/v0.7.0
python/v0.7.1
python/v0.7.10
python/v0.7.11
python/v0.7.12
python/v0.7.13
python/v0.7.14
python/v0.7.15
python/v0.7.16
python/v0.7.2
python/v0.7.3
python/v0.7.4
python/v0.7.5
python/v0.7.6
python/v0.7.7
python/v0.7.8
python/v0.7.9
python/v0.7.9.post1
python/v0.9.0
python/v0.9.1
rust/trezor-client/v0.1.1
rust/trezor-client/v0.1.2
rust/trezor-client/v0.1.3
tmp-testing-tag
${ noResults }
408 lines
8.7 KiB
408 lines
8.7 KiB
from typing import *
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
class Ge25519:
|
|||
"""
|
|||
EC point on ED25519
|
|||
"""
|
|||
|
def __init__(self, x: Optional[Union[Ge25519, bytes]] = None):
|
||
"""
|
|||
Constructor
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
class Sc25519:
|
|||
"""
|
|||
EC scalar on SC25519
|
|||
"""
|
|||
|
def __init__(self, x: Optional[Union[Sc25519, bytes, int]] = None):
|
||
"""
|
|||
Constructor
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
class Hasher:
|
|||
"""
|
|||
XMR hasher
|
|||
"""
|
|||
|
def __init__(self, x: Optional[bytes] = None):
|
||
"""
|
|||
Constructor
|
|||
"""
|
|||
|
def update(self, buffer: bytes) -> None:
|
||
"""
|
|||
Update hasher
|
|||
"""
|
|||
|
def digest(self) -> bytes:
|
||
"""
|
|||
Computes digest
|
|||
"""
|
|||
|
def copy(self) -> Hasher:
|
||
"""
|
|||
Creates copy of the hasher, preserving the state
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def init256_modm(
|
|||
dst: Optional[Sc25519], val: Union[int, bytes, Sc25519]
|
|||
) -> Sc25519:
|
|||
"""
|
|||
Initializes Sc25519 scalar
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
|
def check256_modm(val: Sc25519) -> None:
|
||
"""
|
|||
Throws exception if scalar is invalid
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def iszero256_modm(val: Sc25519) -> bool:
|
|||
"""
|
|||
Returns False if the scalar is zero
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def eq256_modm(a: Sc25519, b: Sc25519) -> int:
|
|||
"""
|
|||
Compares scalars, returns 1 on the same value
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def get256_modm(a: Sc25519) -> int:
|
|||
"""
|
|||
Extracts 64bit integer from the scalar. Raises exception if scalar is
|
|||
bigger than 2^64
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def add256_modm(r: Optional[Sc25519], a: Sc25519, b: Sc25519) -> Sc25519:
|
|||
"""
|
|||
Scalar addition
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def sub256_modm(r: Optional[Sc25519], a: Sc25519, b: Sc25519) -> Sc25519:
|
|||
"""
|
|||
Scalar subtraction
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def mul256_modm(r: Optional[Sc25519], a: Sc25519, b: Sc25519) -> Sc25519:
|
|||
"""
|
|||
Scalar multiplication
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def mulsub256_modm(
|
|||
r: Optional[Sc25519], a: Sc25519, b: Sc25519, c: Sc25519
|
|||
) -> Sc25519:
|
|||
"""
|
|||
c - a*b
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def muladd256_modm(
|
|||
r: Optional[Sc25519], a: Sc25519, b: Sc25519, c: Sc25519
|
|||
) -> Sc25519:
|
|||
"""
|
|||
c + a*b
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def inv256_modm(r: Optional[Sc25519], a: Sc25519) -> Sc25519:
|
|||
"""
|
|||
Scalar modular inversion
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def pack256_modm(
|
|||
r: Optional[bytes], a: Sc25519, offset: Optional[int] = 0
|
|||
) -> bytes:
|
|||
"""
|
|||
Scalar compression
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def unpack256_modm(
|
|||
r: Optional[Sc25519], a: bytes, offset: int = 0
|
|||
) -> Sc25519:
|
|||
"""
|
|||
Scalar decompression
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def unpack256_modm_noreduce(
|
|||
r: Optional[Sc25519], a: bytes, offset: int = 0
|
|||
) -> Sc25519:
|
|||
"""
|
|||
Scalar decompression, raw, without modular reduction
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_set_neutral(r: Optional[Ge25519]) -> Ge25519:
|
|||
"""
|
|||
Sets neutral point
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_set_xmr_h(r: Optional[Ge25519]) -> Ge25519:
|
|||
"""
|
|||
Sets H point
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
|
def ge25519_check(r: Ge25519) -> None:
|
||
"""
|
|||
Checks point, throws if not on curve
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_eq(a: Ge25519, b: Ge25519) -> bool:
|
|||
"""
|
|||
Compares EC points
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_add(r: Optional[Ge25519], a: Ge25519, b: Ge25519) -> Ge25519:
|
|||
"""
|
|||
Adds EC points
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_sub(r: Optional[Ge25519], a: Ge25519, b: Ge25519) -> Ge25519:
|
|||
"""
|
|||
Subtracts EC points
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_double(r: Optional[Ge25519], p: Ge25519) -> Ge25519:
|
|||
"""
|
|||
EC point doubling
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_mul8(r: Optional[Ge25519], p: Ge25519) -> Ge25519:
|
|||
"""
|
|||
EC point * 8
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_double_scalarmult_vartime(
|
|||
r: Optional[Ge25519], p1: Ge25519, s1: Sc25519, s2: Sc25519
|
|||
) -> Ge25519:
|
|||
"""
|
|||
s1 * G + s2 * p1
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_double_scalarmult_vartime2(
|
|||
r: Optional[Ge25519],
|
|||
p1: Ge25519,
|
|||
s1: Sc25519,
|
|||
p2: Ge25519,
|
|||
s2: Sc25519,
|
|||
) -> Ge25519:
|
|||
"""
|
|||
s1 * p1 + s2 * p2
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_scalarmult_base(
|
|||
r: Optional[Ge25519], s: Union[Sc25519, int]
|
|||
) -> Ge25519:
|
|||
"""
|
|||
s * G
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_scalarmult(
|
|||
r: Optional[Ge25519], p: Ge25519, s: Union[Sc25519, int]
|
|||
) -> Ge25519:
|
|||
"""
|
|||
s * p
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_pack(r: bytes, p: Ge25519, offset: int = 0) -> bytes:
|
|||
"""
|
|||
Point compression
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ge25519_unpack_vartime(
|
|||
r: Optional[Ge25519], buff: bytes, offset: int = 0
|
|||
) -> Ge25519:
|
|||
"""
|
|||
Point decompression
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def base58_addr_encode_check(tag: int, buff: bytes) -> bytes:
|
|||
"""
|
|||
Monero block base 58 encoding
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def base58_addr_decode_check(buff: bytes) -> Tuple[bytes, int]:
|
|||
"""
|
|||
Monero block base 58 decoding, returning (decoded, tag) or raising on
|
|||
error.
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_random_scalar(r: Optional[Sc25519] = None) -> Sc25519:
|
|||
"""
|
|||
Generates a random scalar
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_fast_hash(r: Optional[bytes], buff: bytes) -> bytes:
|
|||
"""
|
|||
XMR fast hash
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_hash_to_ec(r: Optional[Ge25519], buff: bytes) -> Ge25519:
|
|||
"""
|
|||
XMR hashing to EC point
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_hash_to_scalar(r: Optional[Sc25519], buff: bytes) -> Sc25519:
|
|||
"""
|
|||
XMR hashing to EC scalar
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_derivation_to_scalar(
|
|||
r: Optional[Sc25519], p: Ge25519, output_index: int
|
|||
) -> Sc25519:
|
|||
"""
|
|||
H_s(derivation || varint(output_index))
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_generate_key_derivation(
|
|||
r: Optional[Ge25519], A: Ge25519, b: Sc25519
|
|||
) -> Ge25519:
|
|||
"""
|
|||
8*(key2*key1)
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_derive_private_key(
|
|||
r: Optional[Sc25519], deriv: Ge25519, idx: int, base: Sc25519
|
|||
) -> Sc25519:
|
|||
"""
|
|||
base + H_s(derivation || varint(output_index))
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_derive_public_key(
|
|||
r: Optional[Ge25519], deriv: Ge25519, idx: int, base: Ge25519
|
|||
) -> Ge25519:
|
|||
"""
|
|||
H_s(derivation || varint(output_index))G + base
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_add_keys2(
|
|||
r: Optional[Ge25519], a: Sc25519, b: Sc25519, B: Ge25519
|
|||
) -> Ge25519:
|
|||
"""
|
|||
aG + bB, G is basepoint
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_add_keys2_vartime(
|
|||
r: Optional[Ge25519], a: Sc25519, b: Sc25519, B: Ge25519
|
|||
) -> Ge25519:
|
|||
"""
|
|||
aG + bB, G is basepoint
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_add_keys3(
|
|||
r: Optional[Ge25519], a: Sc25519, A: Ge25519, b: Sc25519, B: Ge25519
|
|||
) -> Ge25519:
|
|||
"""
|
|||
aA + bB
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_add_keys3_vartime(
|
|||
r: Optional[Ge25519], a: Sc25519, A: Ge25519, b: Sc25519, B: Ge25519
|
|||
) -> Ge25519:
|
|||
"""
|
|||
aA + bB
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_get_subaddress_secret_key(
|
|||
r: Optional[Sc25519], major: int, minor: int, m: Sc25519
|
|||
) -> Sc25519:
|
|||
"""
|
|||
Hs(SubAddr || a || index_major || index_minor)
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def xmr_gen_c(r: Optional[Ge25519], a: Sc25519, amount: int) -> Ge25519:
|
|||
"""
|
|||
aG + amount * H
|
|||
"""
|
|||
|
|||
|
|||
# extmod/modtrezorcrypto/modtrezorcrypto-monero.h
|
|||
def ct_equals(a: bytes, b: bytes) -> bool:
|
|||
"""
|
|||
Constant time buffer comparison
|
|||
"""
|