mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-27 06:42:02 +00:00
style(core): support AnyStr in all hash function arguments
This commit is contained in:
parent
dec89ea59e
commit
45787307ca
@ -37,7 +37,7 @@ typedef struct _mp_obj_Blake256_t {
|
|||||||
|
|
||||||
STATIC mp_obj_t mod_trezorcrypto_Blake256_update(mp_obj_t self, mp_obj_t data);
|
STATIC mp_obj_t mod_trezorcrypto_Blake256_update(mp_obj_t self, mp_obj_t data);
|
||||||
|
|
||||||
/// def __init__(self, data: bytes | None = None) -> None:
|
/// def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Creates a hash context object.
|
/// Creates a hash context object.
|
||||||
/// """
|
/// """
|
||||||
@ -55,7 +55,7 @@ STATIC mp_obj_t mod_trezorcrypto_Blake256_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// def update(self, data: bytes) -> None:
|
/// def update(self, __data: AnyStr) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Update the hash context with hashed data.
|
/// Update the hash context with hashed data.
|
||||||
/// """
|
/// """
|
||||||
|
@ -109,7 +109,7 @@ STATIC mp_obj_t mod_trezorcrypto_Blake2b_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// def update(self, data: bytes) -> None:
|
/// def update(self, __data: AnyStr) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Update the hash context with hashed data.
|
/// Update the hash context with hashed data.
|
||||||
/// """
|
/// """
|
||||||
|
@ -109,7 +109,7 @@ STATIC mp_obj_t mod_trezorcrypto_Blake2s_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// def update(self, data: bytes) -> None:
|
/// def update(self, __data: AnyStr) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Update the hash context with hashed data.
|
/// Update the hash context with hashed data.
|
||||||
/// """
|
/// """
|
||||||
|
@ -41,7 +41,7 @@ typedef struct _mp_obj_Groestl512_t {
|
|||||||
STATIC mp_obj_t mod_trezorcrypto_Groestl512_update(mp_obj_t self,
|
STATIC mp_obj_t mod_trezorcrypto_Groestl512_update(mp_obj_t self,
|
||||||
mp_obj_t data);
|
mp_obj_t data);
|
||||||
|
|
||||||
/// def __init__(self, data: bytes | None = None) -> None:
|
/// def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Creates a hash context object.
|
/// Creates a hash context object.
|
||||||
/// """
|
/// """
|
||||||
@ -58,7 +58,7 @@ STATIC mp_obj_t mod_trezorcrypto_Groestl512_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// def update(self, data: bytes) -> None:
|
/// def update(self, __data: AnyStr) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Update the hash context with hashed data.
|
/// Update the hash context with hashed data.
|
||||||
/// """
|
/// """
|
||||||
|
@ -37,7 +37,7 @@ typedef struct _mp_obj_Ripemd160_t {
|
|||||||
|
|
||||||
STATIC mp_obj_t mod_trezorcrypto_Ripemd160_update(mp_obj_t self, mp_obj_t data);
|
STATIC mp_obj_t mod_trezorcrypto_Ripemd160_update(mp_obj_t self, mp_obj_t data);
|
||||||
|
|
||||||
/// def __init__(self, data: bytes | None = None) -> None:
|
/// def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Creates a hash context object.
|
/// Creates a hash context object.
|
||||||
/// """
|
/// """
|
||||||
@ -55,7 +55,7 @@ STATIC mp_obj_t mod_trezorcrypto_Ripemd160_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// def update(self, data: bytes) -> None:
|
/// def update(self, __data: AnyStr) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Update the hash context with hashed data.
|
/// Update the hash context with hashed data.
|
||||||
/// """
|
/// """
|
||||||
|
@ -37,7 +37,7 @@ typedef struct _mp_obj_Sha1_t {
|
|||||||
|
|
||||||
STATIC mp_obj_t mod_trezorcrypto_Sha1_update(mp_obj_t self, mp_obj_t data);
|
STATIC mp_obj_t mod_trezorcrypto_Sha1_update(mp_obj_t self, mp_obj_t data);
|
||||||
|
|
||||||
/// def __init__(self, data: bytes | None = None) -> None:
|
/// def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Creates a hash context object.
|
/// Creates a hash context object.
|
||||||
/// """
|
/// """
|
||||||
@ -55,7 +55,7 @@ STATIC mp_obj_t mod_trezorcrypto_Sha1_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// def update(self, data: bytes) -> None:
|
/// def update(self, __data: AnyStr) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Update the hash context with hashed data.
|
/// Update the hash context with hashed data.
|
||||||
/// """
|
/// """
|
||||||
|
@ -37,7 +37,7 @@ typedef struct _mp_obj_Sha256_t {
|
|||||||
|
|
||||||
STATIC mp_obj_t mod_trezorcrypto_Sha256_update(mp_obj_t self, mp_obj_t data);
|
STATIC mp_obj_t mod_trezorcrypto_Sha256_update(mp_obj_t self, mp_obj_t data);
|
||||||
|
|
||||||
/// def __init__(self, data: bytes | None = None) -> None:
|
/// def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Creates a hash context object.
|
/// Creates a hash context object.
|
||||||
/// """
|
/// """
|
||||||
@ -55,7 +55,7 @@ STATIC mp_obj_t mod_trezorcrypto_Sha256_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// def update(self, data: bytes) -> None:
|
/// def update(self, __data: AnyStr) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Update the hash context with hashed data.
|
/// Update the hash context with hashed data.
|
||||||
/// """
|
/// """
|
||||||
|
@ -72,7 +72,7 @@ STATIC mp_obj_t mod_trezorcrypto_Sha3_256_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// def update(self, data: bytes) -> None:
|
/// def update(self, __data: AnyStr) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Update the hash context with hashed data.
|
/// Update the hash context with hashed data.
|
||||||
/// """
|
/// """
|
||||||
|
@ -72,7 +72,7 @@ STATIC mp_obj_t mod_trezorcrypto_Sha3_512_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// def update(self, data: bytes) -> None:
|
/// def update(self, __data: AnyStr) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Update the hash context with hashed data.
|
/// Update the hash context with hashed data.
|
||||||
/// """
|
/// """
|
||||||
|
@ -37,7 +37,7 @@ typedef struct _mp_obj_Sha512_t {
|
|||||||
|
|
||||||
STATIC mp_obj_t mod_trezorcrypto_Sha512_update(mp_obj_t self, mp_obj_t data);
|
STATIC mp_obj_t mod_trezorcrypto_Sha512_update(mp_obj_t self, mp_obj_t data);
|
||||||
|
|
||||||
/// def __init__(self, data: bytes | None = None) -> None:
|
/// def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Creates a hash context object.
|
/// Creates a hash context object.
|
||||||
/// """
|
/// """
|
||||||
@ -54,7 +54,7 @@ STATIC mp_obj_t mod_trezorcrypto_Sha512_make_new(const mp_obj_type_t *type,
|
|||||||
return MP_OBJ_FROM_PTR(o);
|
return MP_OBJ_FROM_PTR(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// def update(self, data: bytes) -> None:
|
/// def update(self, __data: AnyStr) -> None:
|
||||||
/// """
|
/// """
|
||||||
/// Update the hash context with hashed data.
|
/// Update the hash context with hashed data.
|
||||||
/// """
|
/// """
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// package: trezorio.__init__
|
/// package: trezorio.__init__
|
||||||
|
/// from . import fatfs, sdcard
|
||||||
|
|
||||||
/// POLL_READ: int # wait until interface is readable and return read data
|
/// POLL_READ: int # wait until interface is readable and return read data
|
||||||
/// POLL_WRITE: int # wait until interface is writable
|
/// POLL_WRITE: int # wait until interface is writable
|
||||||
@ -68,9 +69,6 @@
|
|||||||
|
|
||||||
/// WireInterface = Union[HID, WebUSB]
|
/// WireInterface = Union[HID, WebUSB]
|
||||||
|
|
||||||
/// if False:
|
|
||||||
/// from . import fatfs, sdcard
|
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t mp_module_trezorio_globals_table[] = {
|
STATIC const mp_rom_map_elem_t mp_module_trezorio_globals_table[] = {
|
||||||
{MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorio)},
|
{MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorio)},
|
||||||
|
|
||||||
|
@ -41,12 +41,12 @@ class blake256:
|
|||||||
block_size: int
|
block_size: int
|
||||||
digest_size: int
|
digest_size: int
|
||||||
|
|
||||||
def __init__(self, data: bytes | None = None) -> None:
|
def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
"""
|
"""
|
||||||
Creates a hash context object.
|
Creates a hash context object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def update(self, data: bytes) -> None:
|
def update(self, __data: AnyStr) -> None:
|
||||||
"""
|
"""
|
||||||
Update the hash context with hashed data.
|
Update the hash context with hashed data.
|
||||||
"""
|
"""
|
||||||
@ -76,7 +76,7 @@ class blake2b:
|
|||||||
Creates a hash context object.
|
Creates a hash context object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def update(self, data: bytes) -> None:
|
def update(self, __data: AnyStr) -> None:
|
||||||
"""
|
"""
|
||||||
Update the hash context with hashed data.
|
Update the hash context with hashed data.
|
||||||
"""
|
"""
|
||||||
@ -106,7 +106,7 @@ class blake2s:
|
|||||||
Creates a hash context object.
|
Creates a hash context object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def update(self, data: bytes) -> None:
|
def update(self, __data: AnyStr) -> None:
|
||||||
"""
|
"""
|
||||||
Update the hash context with hashed data.
|
Update the hash context with hashed data.
|
||||||
"""
|
"""
|
||||||
@ -162,12 +162,12 @@ class groestl512:
|
|||||||
block_size: int
|
block_size: int
|
||||||
digest_size: int
|
digest_size: int
|
||||||
|
|
||||||
def __init__(self, data: bytes | None = None) -> None:
|
def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
"""
|
"""
|
||||||
Creates a hash context object.
|
Creates a hash context object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def update(self, data: bytes) -> None:
|
def update(self, __data: AnyStr) -> None:
|
||||||
"""
|
"""
|
||||||
Update the hash context with hashed data.
|
Update the hash context with hashed data.
|
||||||
"""
|
"""
|
||||||
@ -246,12 +246,12 @@ class ripemd160:
|
|||||||
block_size: int
|
block_size: int
|
||||||
digest_size: int
|
digest_size: int
|
||||||
|
|
||||||
def __init__(self, data: bytes | None = None) -> None:
|
def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
"""
|
"""
|
||||||
Creates a hash context object.
|
Creates a hash context object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def update(self, data: bytes) -> None:
|
def update(self, __data: AnyStr) -> None:
|
||||||
"""
|
"""
|
||||||
Update the hash context with hashed data.
|
Update the hash context with hashed data.
|
||||||
"""
|
"""
|
||||||
@ -270,12 +270,12 @@ class sha1:
|
|||||||
block_size: int
|
block_size: int
|
||||||
digest_size: int
|
digest_size: int
|
||||||
|
|
||||||
def __init__(self, data: bytes | None = None) -> None:
|
def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
"""
|
"""
|
||||||
Creates a hash context object.
|
Creates a hash context object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def update(self, data: bytes) -> None:
|
def update(self, __data: AnyStr) -> None:
|
||||||
"""
|
"""
|
||||||
Update the hash context with hashed data.
|
Update the hash context with hashed data.
|
||||||
"""
|
"""
|
||||||
@ -294,12 +294,12 @@ class sha256:
|
|||||||
block_size: int
|
block_size: int
|
||||||
digest_size: int
|
digest_size: int
|
||||||
|
|
||||||
def __init__(self, data: bytes | None = None) -> None:
|
def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
"""
|
"""
|
||||||
Creates a hash context object.
|
Creates a hash context object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def update(self, data: bytes) -> None:
|
def update(self, __data: AnyStr) -> None:
|
||||||
"""
|
"""
|
||||||
Update the hash context with hashed data.
|
Update the hash context with hashed data.
|
||||||
"""
|
"""
|
||||||
@ -327,7 +327,7 @@ class sha3_256:
|
|||||||
Creates a hash context object.
|
Creates a hash context object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def update(self, data: bytes) -> None:
|
def update(self, __data: AnyStr) -> None:
|
||||||
"""
|
"""
|
||||||
Update the hash context with hashed data.
|
Update the hash context with hashed data.
|
||||||
"""
|
"""
|
||||||
@ -360,7 +360,7 @@ class sha3_512:
|
|||||||
Creates a hash context object.
|
Creates a hash context object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def update(self, data: bytes) -> None:
|
def update(self, __data: AnyStr) -> None:
|
||||||
"""
|
"""
|
||||||
Update the hash context with hashed data.
|
Update the hash context with hashed data.
|
||||||
"""
|
"""
|
||||||
@ -384,12 +384,12 @@ class sha512:
|
|||||||
block_size: int
|
block_size: int
|
||||||
digest_size: int
|
digest_size: int
|
||||||
|
|
||||||
def __init__(self, data: bytes | None = None) -> None:
|
def __init__(self, __data: AnyStr | None = None) -> None:
|
||||||
"""
|
"""
|
||||||
Creates a hash context object.
|
Creates a hash context object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def update(self, data: bytes) -> None:
|
def update(self, __data: AnyStr) -> None:
|
||||||
"""
|
"""
|
||||||
Update the hash context with hashed data.
|
Update the hash context with hashed data.
|
||||||
"""
|
"""
|
||||||
|
@ -190,6 +190,7 @@ class WebUSB:
|
|||||||
"""
|
"""
|
||||||
Sends message using USB WebUSB (device) or UDP (emulator).
|
Sends message using USB WebUSB (device) or UDP (emulator).
|
||||||
"""
|
"""
|
||||||
|
from . import fatfs, sdcard
|
||||||
POLL_READ: int # wait until interface is readable and return read data
|
POLL_READ: int # wait until interface is readable and return read data
|
||||||
POLL_WRITE: int # wait until interface is writable
|
POLL_WRITE: int # wait until interface is writable
|
||||||
TOUCH: int # interface id of the touch events
|
TOUCH: int # interface id of the touch events
|
||||||
@ -202,5 +203,3 @@ BUTTON_RELEASED: int # button up event
|
|||||||
BUTTON_LEFT: int # button number of left button
|
BUTTON_LEFT: int # button number of left button
|
||||||
BUTTON_RIGHT: int # button number of right button
|
BUTTON_RIGHT: int # button number of right button
|
||||||
WireInterface = Union[HID, WebUSB]
|
WireInterface = Union[HID, WebUSB]
|
||||||
if False:
|
|
||||||
from . import fatfs, sdcard
|
|
||||||
|
Loading…
Reference in New Issue
Block a user