1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 12:28:09 +00:00

mocks: remove old generated mocks

This commit is contained in:
Jan Pochyla 2017-06-14 17:41:25 +02:00
parent 5a5c4f11b9
commit c0c5642bff
37 changed files with 0 additions and 640 deletions

View File

@ -1,19 +0,0 @@
# extmod/modtrezorconfig/modtrezorconfig.c
def get(app: int, key: int) -> bytes:
'''
Gets a value of given key for given app (or empty bytes if not set).
'''
# extmod/modtrezorconfig/modtrezorconfig.c
def set(app: int, key: int, value: bytes) -> None:
'''
Sets a value of given key for given app.
Returns True on success.
'''
# extmod/modtrezorconfig/modtrezorconfig.c
def wipe() -> None:
'''
Erases the whole config (use with caution!)
'''

View File

@ -1,6 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-pbkdf2.h
def pbkdf2(prf: str, password: bytes, salt: bytes, iterations: int=None) -> Pbkdf2:
'''
Create a PBKDF2 context
'''

View File

@ -1,72 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def derive(index: int) -> None:
'''
Derive a BIP0032 child node in place.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def derive_path(path: list) -> None:
'''
Go through a list of indexes and iteratively derive a child node in place.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def serialize_public(version: int) -> str:
'''
Serialize the public info from HD node to base58 string.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def serialize_private(version: int) -> str:
'''
Serialize the private info HD node to base58 string.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def clone() -> HDNode:
'''
Returns a copy of the HD node.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def depth() -> int:
'''
Returns a depth of the HD node.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def fingerprint() -> int:
'''
Returns a fingerprint of the HD node (hash of the parent public key).
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def child_num() -> int:
'''
Returns a child index of the HD node.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def chain_code() -> bytes:
'''
Returns a chain code of the HD node.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def private_key() -> bytes:
'''
Returns a private key of the HD node.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def public_key() -> bytes:
'''
Returns a public key of the HD node.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def address(version: int) -> str:
'''
Compute a base58-encoded address string from the HD node.
'''

View File

@ -1,6 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-aes.h
def update(self, data: bytes) -> bytes:
'''
Update AES context
'''

View File

@ -1,12 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def deserialize(value:str, version_public: int, version_private: int) -> HDNode:
'''
Construct a BIP0032 HD node from a base58-serialized value.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip32.h
def from_seed(seed: bytes, curve_name: str) -> HDNode:
'''
Construct a BIP0032 HD node from a BIP0039 seed value.
'''

View File

@ -1,37 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-bip39.h
def find_word(prefix: str) -> str:
'''
Return the first word from the wordlist starting with prefix
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip39.h
def complete_word(prefix: str) -> int:
'''
Return possible 1-letter suffixes for given word prefix
Result is a bitmask, with 'a' on the lowest bit, 'b' on the second lowest, etc.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip39.h
def generate(strength: int) -> str:
'''
Generate a mnemonic of given strength (128, 160, 192, 224 and 256 bits)
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip39.h
def from_data(data: bytes) -> str:
'''
Generate a mnemonic from given data (of 16, 20, 24, 28 and 32 bytes)
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip39.h
def check(mnemonic: str) -> bool:
'''
Check whether given mnemonic is valid
'''
# extmod/modtrezorcrypto/modtrezorcrypto-bip39.h
def seed(mnemonic: str, passphrase: str) -> bytes:
'''
Generate seed from mnemonic and passphrase
'''

View File

@ -1,19 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-curve25519.h
def generate_secret() -> bytes:
'''
Generate secret key.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-curve25519.h
def publickey(secret_key: bytes) -> bytes:
'''
Computes public key from secret key.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-curve25519.h
def multiply(secret_key: bytes, public_key: bytes) -> bytes:
'''
Multiplies point defined by public_key with scalar defined by secret_key
Useful for ECDH
'''

View File

@ -1,43 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
def generate_secret() -> bytes:
'''
Generate secret key.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
def publickey(secret_key: bytes) -> bytes:
'''
Computes public key from secret key.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
def sign(secret_key: bytes, message: bytes) -> bytes:
'''
Uses secret key to produce the signature of message.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
def verify(public_key: bytes, signature: bytes, message: bytes) -> bool:
'''
Uses public key to verify the signature of the message.
Returns True on success.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
def cosi_combine_publickeys(public_keys: list) -> bytes:
'''
Combines a list of public keys used in COSI cosigning scheme
'''
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
def cosi_combine_signatures(R: bytes, signatures: list) -> bytes:
'''
Combines a list of signatures used in COSI cosigning scheme
'''
# extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
def cosi_sign(secret_key: bytes, message: bytes, nonce: bytes, sigR: bytes, combined_pubkey: bytes) -> bytes:
'''
Produce signature of message using COSI cosigning scheme
'''

View File

@ -1,39 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-nist256p1.h
def generate_secret() -> bytes:
'''
Generate secret key.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-nist256p1.h
def publickey(secret_key: bytes, compressed: bool=True) -> bytes:
'''
Computes public key from secret key.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-nist256p1.h
def sign(secret_key: bytes, digest: bytes, compressed: bool=True) -> bytes:
'''
Uses secret key to produce the signature of the digest.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-nist256p1.h
def verify(public_key: bytes, signature: bytes, digest: bytes) -> bool:
'''
Uses public key to verify the signature of the digest.
Returns True on success.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-nist256p1.h
def verify_recover(signature: bytes, digest: bytes) -> bytes:
'''
Uses signature of the digest to verify the digest and recover the public key.
Returns public key on success, None on failure.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-nist256p1.h
def multiply(secret_key: bytes, public_key: bytes) -> bytes:
'''
Multiplies point defined by public_key with scalar defined by secret_key
Useful for ECDH
'''

View File

@ -1,39 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-secp256k1.h
def generate_secret() -> bytes:
'''
Generate secret key.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-secp256k1.h
def publickey(secret_key: bytes, compressed: bool=True) -> bytes:
'''
Computes public key from secret key.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-secp256k1.h
def sign(secret_key: bytes, digest: bytes, compressed: bool=True) -> bytes:
'''
Uses secret key to produce the signature of the digest.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-secp256k1.h
def verify(public_key: bytes, signature: bytes, digest: bytes) -> bool:
'''
Uses public key to verify the signature of the digest.
Returns True on success.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-secp256k1.h
def verify_recover(signature: bytes, digest: bytes) -> bytes:
'''
Uses signature of the digest to verify the digest and recover the public key.
Returns public key on success, None on failure.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-secp256k1.h
def multiply(secret_key: bytes, public_key: bytes) -> bytes:
'''
Multiplies point defined by public_key with scalar defined by secret_key
Useful for ECDH
'''

View File

@ -1,48 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-blake2b.h
def blake2b(data: bytes=None, key: bytes=None) -> Blake2b:
'''
Creates a hash context object.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-blake2s.h
def blake2s(data: bytes=None, key: bytes=None) -> Blake2s:
'''
Creates a hash context object.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-ripemd160.h
def ripemd160(data: bytes=None) -> Ripemd160:
'''
Creates a hash context object.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-sha1.h
def sha1(data: bytes=None) -> Sha1:
'''
Creates a hash context object.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-sha256.h
def sha256(data: bytes=None) -> Sha256:
'''
Creates a hash context object.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h
def sha3_256(data: bytes=None) -> Sha3_256:
'''
Creates a hash context object.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h
def sha3_512(data: bytes=None) -> Sha3_512:
'''
Creates a hash context object.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-sha512.h
def sha512(data: bytes=None) -> Sha512:
'''
Creates a hash context object.
'''

View File

@ -1,12 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-blake2b.h
def update(self, data: bytes) -> None:
'''
Update the hash context with hashed data.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-blake2b.h
def digest(self) -> bytes:
'''
Returns the digest of hashed data.
'''

View File

@ -1,12 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-blake2s.h
def update(self, data: bytes) -> None:
'''
Update the hash context with hashed data.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-blake2s.h
def digest(self) -> bytes:
'''
Returns the digest of hashed data.
'''

View File

@ -1,12 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-ripemd160.h
def update(self, data: bytes) -> None:
'''
Update the hash context with hashed data.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-ripemd160.h
def digest(self) -> bytes:
'''
Returns the digest of hashed data.
'''

View File

@ -1,12 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-sha1.h
def update(self, data: bytes) -> None:
'''
Update the hash context with hashed data.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-sha1.h
def digest(self) -> bytes:
'''
Returns the digest of hashed data.
'''

View File

@ -1,12 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-sha256.h
def update(self, data: bytes) -> None:
'''
Update the hash context with hashed data.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-sha256.h
def digest(self) -> bytes:
'''
Returns the digest of hashed data.
'''

View File

@ -1,12 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h
def update(self, data: bytes) -> None:
'''
Update the hash context with hashed data.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h
def digest(self, keccak: bool=False) -> bytes:
'''
Returns the digest of hashed data.
'''

View File

@ -1,12 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h
def update(self, data: bytes) -> None:
'''
Update the hash context with hashed data.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h
def digest(self, keccak: bool=False) -> bytes:
'''
Returns the digest of hashed data.
'''

View File

@ -1,12 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-sha512.h
def hash(self, data: bytes) -> None:
'''
Update the hash context with hashed data.
'''
# extmod/modtrezorcrypto/modtrezorcrypto-sha512.h
def digest(self) -> bytes:
'''
Returns the digest of hashed data.
'''

View File

@ -1,12 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-pbkdf2.h
def update(self, iterations: int) -> None:
'''
Update a PBKDF2 context
'''
# extmod/modtrezorcrypto/modtrezorcrypto-pbkdf2.h
def key(self) -> bytes:
'''
Retreive derived key
'''

View File

@ -1,18 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-random.h
def uniform(n: int) -> int:
'''
Compute uniform random number from interval 0 ... n - 1
'''
# extmod/modtrezorcrypto/modtrezorcrypto-random.h
def bytes(len: int) -> bytes:
'''
Generate random bytes sequence of length len
'''
# extmod/modtrezorcrypto/modtrezorcrypto-random.h
def shuffle(data: list) -> None:
'''
Shuffles items of given list (in-place)
'''

View File

@ -1,6 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-rfc6979.h
def next() -> bytes:
'''
Compute next 32-bytes of pseudorandom data
'''

View File

@ -1,12 +0,0 @@
# extmod/modtrezorcrypto/modtrezorcrypto-ssss.h
def split(m: int, n: int, secret: bytes) -> tuple:
'''
Split secret to (M of N) shares using Shamir's Secret Sharing Scheme
'''
# extmod/modtrezorcrypto/modtrezorcrypto-ssss.h
def combine(shares: tuple) -> bytes:
'''
Combine M shares of Shamir's Secret Sharing Scheme into secret
'''

View File

@ -1,25 +0,0 @@
# extmod/modtrezormsg/modtrezormsg.c
def init_usb(usb_info, usb_ifaces) -> None:
'''
Registers passed interfaces and initializes the USB stack
'''
# extmod/modtrezormsg/modtrezormsg.c
def deinit_usb() -> None:
'''
Cleans up the USB stack
'''
# extmod/modtrezormsg/modtrezormsg.c
def send(iface: int, message: bytes) -> int:
'''
Sends message using USB HID (device) or UDP (emulator).
'''
# extmod/modtrezormsg/modtrezormsg.c
def select(timeout_us: int) -> tuple:
'''
Polls the event queue and returns the event object.
Function returns None if timeout specified in microseconds is reached.
'''

View File

@ -1,116 +0,0 @@
# extmod/modtrezorui/modtrezorui-display.h
def clear() -> None
'''
Clear display (with black color)
'''
# extmod/modtrezorui/modtrezorui-display.h
def refresh() -> None
'''
Refresh display (update screen)
'''
# extmod/modtrezorui/modtrezorui-display.h
def bar(x: int, y: int, w: int, h: int, color: int) -> None:
'''
Renders a bar at position (x,y = upper left corner) with width w and height h of color color.
'''
# extmod/modtrezorui/modtrezorui-display.h
def bar_radius(x: int, y: int, w: int, h: int, fgcolor: int, bgcolor: int=None, radius: int=None) -> None:
'''
Renders a rounded bar at position (x,y = upper left corner) with width w and height h of color fgcolor.
Background is set to bgcolor and corners are drawn with radius radius.
'''
# extmod/modtrezorui/modtrezorui-display.h
def image(x: int, y: int, image: bytes) -> None:
'''
Renders an image at position (x,y).
The image needs to be in TREZOR Optimized Image Format (TOIF) - full-color mode.
'''
# extmod/modtrezorui/modtrezorui-display.h
def icon(x: int, y: int, icon: bytes, fgcolor: int, bgcolor: int) -> None:
'''
Renders an icon at position (x,y), fgcolor is used as foreground color, bgcolor as background.
The image needs to be in TREZOR Optimized Image Format (TOIF) - gray-scale mode.
'''
# extmod/modtrezorui/modtrezorui-display.h
def print(text: str) -> None:
'''
Renders text using 5x8 bitmap font (using special text mode)
'''
# extmod/modtrezorui/modtrezorui-display.h
def text(x: int, y: int, text: str, font: int, fgcolor: int, bgcolor: int) -> None:
'''
Renders left-aligned text at position (x,y) where x is left position and y is baseline.
Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
'''
# extmod/modtrezorui/modtrezorui-display.h
def text_center(x: int, y: int, text: str, font: int, fgcolor: int, bgcolor: int) -> None:
'''
Renders text centered at position (x,y) where x is text center and y is baseline.
Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
'''
# extmod/modtrezorui/modtrezorui-display.h
def text_right(x: int, y: int, text: str, font: int, fgcolor: int, bgcolor: int) -> None:
'''
Renders right-aligned text at position (x,y) where x is right position and y is baseline.
Font font is used for rendering, fgcolor is used as foreground color, bgcolor as background.
'''
# extmod/modtrezorui/modtrezorui-display.h
def text_width(text: str, font: int) -> int:
'''
Returns a width of text in pixels. Font font is used for rendering.
'''
# extmod/modtrezorui/modtrezorui-display.h
def qrcode(x: int, y: int, data: bytes, scale: int) -> None:
'''
Renders data encoded as a QR code centered at position (x,y).
Scale determines a zoom factor.
'''
# extmod/modtrezorui/modtrezorui-display.h
def loader(progress: int, yoffset: int, fgcolor: int, bgcolor: int, icon: bytes=None, iconfgcolor: int=None) -> None:
'''
Renders a rotating loader graphic.
Progress determines its position (0-1000), fgcolor is used as foreground color, bgcolor as background.
When icon and iconfgcolor are provided, an icon is drawn in the middle using the color specified in iconfgcolor.
Icon needs to be of exactly LOADER_ICON_SIZE x LOADER_ICON_SIZE pixels size.
'''
# extmod/modtrezorui/modtrezorui-display.h
def orientation(degrees: int=None) -> int:
'''
Sets display orientation to 0, 90, 180 or 270 degrees.
Everything needs to be redrawn again when this function is used.
Call without the degrees parameter to just perform the read of the value.
'''
# extmod/modtrezorui/modtrezorui-display.h
def backlight(val: int=None) -> int:
'''
Sets backlight intensity to the value specified in val.
Call without the val parameter to just perform the read of the value.
'''
# extmod/modtrezorui/modtrezorui-display.h
def offset(xy: tuple=None) -> tuple:
'''
Sets offset (x, y) for all subsequent drawing calls.
Call without the xy parameter to just perform the read of the value.
'''
# extmod/modtrezorui/modtrezorui-display.h
def save(filename: string) -> None:
'''
Saves current display contents to file filename.
'''

View File

@ -1,15 +0,0 @@
# extmod/modtrezorutils/modtrezorutils.c
def memcpy(dst: bytearray, dst_ofs: int,
src: bytearray, src_ofs: 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
'''