diff --git a/extmod/modtrezorcrypto/modtrezorcrypto-blake2s.h b/extmod/modtrezorcrypto/modtrezorcrypto-blake2s.h index 9de3fb617..7d88d8ae5 100644 --- a/extmod/modtrezorcrypto/modtrezorcrypto-blake2s.h +++ b/extmod/modtrezorcrypto/modtrezorcrypto-blake2s.h @@ -42,7 +42,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Blake2s_make_new(const mp_obj_type_t *type, siz return MP_OBJ_FROM_PTR(o); } -/// def trezor.crypto.hashlib.Blake2s.update(self, data: bytes) -> None: +/// def trezor.crypto.hashlib.blake2s.update(self, data: bytes) -> None: /// ''' /// Update the hash context with hashed data. /// ''' @@ -57,7 +57,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Blake2s_update(mp_obj_t self, mp_obj_t data) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Blake2s_update_obj, mod_TrezorCrypto_Blake2s_update); -/// def trezor.crypto.hashlib.Blake2s.digest(self) -> bytes: +/// def trezor.crypto.hashlib.blake2s.digest(self) -> bytes: /// ''' /// Returns the digest of hashed data. /// ''' diff --git a/extmod/modtrezorcrypto/modtrezorcrypto-pbkdf2.h b/extmod/modtrezorcrypto/modtrezorcrypto-pbkdf2.h index fbf383b71..676276f75 100644 --- a/extmod/modtrezorcrypto/modtrezorcrypto-pbkdf2.h +++ b/extmod/modtrezorcrypto/modtrezorcrypto-pbkdf2.h @@ -62,7 +62,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Pbkdf2_make_new(const mp_obj_type_t *type, size return MP_OBJ_FROM_PTR(o); } -/// def trezor.crypto.pbkdf2.Pbkdf2.update(self, iterations: int) -> None: +/// def trezor.crypto.pbkdf2.update(self, iterations: int) -> None: /// ''' /// Update a PBKDF2 context /// ''' @@ -79,7 +79,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Pbkdf2_update(mp_obj_t self, mp_obj_t iteration } STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Pbkdf2_update_obj, mod_TrezorCrypto_Pbkdf2_update); -/// def trezor.crypto.pbkdf2.Pbkdf2.key(self) -> bytes: +/// def trezor.crypto.pbkdf2.key(self) -> bytes: /// ''' /// Retreive derived key /// ''' diff --git a/extmod/modtrezorcrypto/modtrezorcrypto-ripemd160.h b/extmod/modtrezorcrypto/modtrezorcrypto-ripemd160.h index 6b495fd9f..38ded686a 100644 --- a/extmod/modtrezorcrypto/modtrezorcrypto-ripemd160.h +++ b/extmod/modtrezorcrypto/modtrezorcrypto-ripemd160.h @@ -35,7 +35,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Ripemd160_make_new(const mp_obj_type_t *type, s return MP_OBJ_FROM_PTR(o); } -/// def trezor.crypto.hashlib.Ripemd160.update(self, data: bytes) -> None: +/// def trezor.crypto.hashlib.ripemd160.update(self, data: bytes) -> None: /// ''' /// Update the hash context with hashed data. /// ''' @@ -50,7 +50,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Ripemd160_update(mp_obj_t self, mp_obj_t data) } STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Ripemd160_update_obj, mod_TrezorCrypto_Ripemd160_update); -/// def trezor.crypto.hashlib.Ripemd160.digest(self) -> bytes: +/// def trezor.crypto.hashlib.ripemd160.digest(self) -> bytes: /// ''' /// Returns the digest of hashed data. /// ''' diff --git a/extmod/modtrezorcrypto/modtrezorcrypto-sha1.h b/extmod/modtrezorcrypto/modtrezorcrypto-sha1.h index a462d5921..0003853bf 100644 --- a/extmod/modtrezorcrypto/modtrezorcrypto-sha1.h +++ b/extmod/modtrezorcrypto/modtrezorcrypto-sha1.h @@ -35,7 +35,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha1_make_new(const mp_obj_type_t *type, size_t return MP_OBJ_FROM_PTR(o); } -/// def trezor.crypto.hashlib.Sha1.update(self, data: bytes) -> None: +/// def trezor.crypto.hashlib.sha1.update(self, data: bytes) -> None: /// ''' /// Update the hash context with hashed data. /// ''' @@ -50,7 +50,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha1_update(mp_obj_t self, mp_obj_t data) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Sha1_update_obj, mod_TrezorCrypto_Sha1_update); -/// def trezor.crypto.hashlib.Sha1.digest(self) -> bytes: +/// def trezor.crypto.hashlib.sha1.digest(self) -> bytes: /// ''' /// Returns the digest of hashed data. /// ''' diff --git a/extmod/modtrezorcrypto/modtrezorcrypto-sha256.h b/extmod/modtrezorcrypto/modtrezorcrypto-sha256.h index 38cc3c4b6..25ba25620 100644 --- a/extmod/modtrezorcrypto/modtrezorcrypto-sha256.h +++ b/extmod/modtrezorcrypto/modtrezorcrypto-sha256.h @@ -35,7 +35,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha256_make_new(const mp_obj_type_t *type, size return MP_OBJ_FROM_PTR(o); } -/// def trezor.crypto.hashlib.Sha256.update(self, data: bytes) -> None: +/// def trezor.crypto.hashlib.sha256.update(self, data: bytes) -> None: /// ''' /// Update the hash context with hashed data. /// ''' @@ -50,7 +50,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha256_update(mp_obj_t self, mp_obj_t data) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Sha256_update_obj, mod_TrezorCrypto_Sha256_update); -/// def trezor.crypto.hashlib.Sha256.digest(self) -> bytes: +/// def trezor.crypto.hashlib.sha256.digest(self) -> bytes: /// ''' /// Returns the digest of hashed data. /// ''' diff --git a/extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h b/extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h index 0b22e62e6..14431b3c8 100644 --- a/extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h +++ b/extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h @@ -35,7 +35,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha3_256_make_new(const mp_obj_type_t *type, si return MP_OBJ_FROM_PTR(o); } -/// def trezor.crypto.hashlib.Sha3_256.update(self, data: bytes) -> None: +/// def trezor.crypto.hashlib.sha3_256.update(self, data: bytes) -> None: /// ''' /// Update the hash context with hashed data. /// ''' @@ -50,7 +50,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha3_256_update(mp_obj_t self, mp_obj_t data) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Sha3_256_update_obj, mod_TrezorCrypto_Sha3_256_update); -/// def trezor.crypto.hashlib.Sha3_256.digest(self, keccak: bool=False) -> bytes: +/// def trezor.crypto.hashlib.sha3_256.digest(self, keccak: bool=False) -> bytes: /// ''' /// Returns the digest of hashed data. /// ''' diff --git a/extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h b/extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h index d89a86a8d..77ea52855 100644 --- a/extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h +++ b/extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h @@ -35,7 +35,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha3_512_make_new(const mp_obj_type_t *type, si return MP_OBJ_FROM_PTR(o); } -/// def trezor.crypto.hashlib.Sha3_512.update(self, data: bytes) -> None: +/// def trezor.crypto.hashlib.sha3_512.update(self, data: bytes) -> None: /// ''' /// Update the hash context with hashed data. /// ''' @@ -50,7 +50,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha3_512_update(mp_obj_t self, mp_obj_t data) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Sha3_512_update_obj, mod_TrezorCrypto_Sha3_512_update); -/// def trezor.crypto.hashlib.Sha3_512.digest(self, keccak: bool=False) -> bytes: +/// def trezor.crypto.hashlib.sha3_512.digest(self, keccak: bool=False) -> bytes: /// ''' /// Returns the digest of hashed data. /// ''' diff --git a/extmod/modtrezorcrypto/modtrezorcrypto-sha512.h b/extmod/modtrezorcrypto/modtrezorcrypto-sha512.h index e8b24ff47..5813483fc 100644 --- a/extmod/modtrezorcrypto/modtrezorcrypto-sha512.h +++ b/extmod/modtrezorcrypto/modtrezorcrypto-sha512.h @@ -34,7 +34,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha512_make_new(const mp_obj_type_t *type, size return MP_OBJ_FROM_PTR(o); } -/// def trezor.crypto.hashlib.Sha512.hash(self, data: bytes) -> None: +/// def trezor.crypto.hashlib.sha512.hash(self, data: bytes) -> None: /// ''' /// Update the hash context with hashed data. /// ''' @@ -49,7 +49,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Sha512_update(mp_obj_t self, mp_obj_t data) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_TrezorCrypto_Sha512_update_obj, mod_TrezorCrypto_Sha512_update); -/// def trezor.crypto.hashlib.Sha512.digest(self) -> bytes: +/// def trezor.crypto.hashlib.sha512.digest(self) -> bytes: /// ''' /// Returns the digest of hashed data. /// ''' diff --git a/mocks/trezor/crypto/hashlib/Blake2s.py b/mocks/trezor/crypto/hashlib/blake2s.py similarity index 100% rename from mocks/trezor/crypto/hashlib/Blake2s.py rename to mocks/trezor/crypto/hashlib/blake2s.py diff --git a/mocks/trezor/crypto/hashlib/Ripemd160.py b/mocks/trezor/crypto/hashlib/ripemd160.py similarity index 100% rename from mocks/trezor/crypto/hashlib/Ripemd160.py rename to mocks/trezor/crypto/hashlib/ripemd160.py diff --git a/mocks/trezor/crypto/hashlib/Sha1.py b/mocks/trezor/crypto/hashlib/sha1.py similarity index 100% rename from mocks/trezor/crypto/hashlib/Sha1.py rename to mocks/trezor/crypto/hashlib/sha1.py diff --git a/mocks/trezor/crypto/hashlib/Sha256.py b/mocks/trezor/crypto/hashlib/sha256.py similarity index 100% rename from mocks/trezor/crypto/hashlib/Sha256.py rename to mocks/trezor/crypto/hashlib/sha256.py diff --git a/mocks/trezor/crypto/hashlib/Sha3_256.py b/mocks/trezor/crypto/hashlib/sha3_256.py similarity index 85% rename from mocks/trezor/crypto/hashlib/Sha3_256.py rename to mocks/trezor/crypto/hashlib/sha3_256.py index fef5ce667..b09a5bd2c 100644 --- a/mocks/trezor/crypto/hashlib/Sha3_256.py +++ b/mocks/trezor/crypto/hashlib/sha3_256.py @@ -6,7 +6,7 @@ def update(self, data: bytes) -> None: ''' # ../extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h -def digest(self) -> bytes: +def digest(self, keccak: bool=False) -> bytes: ''' Returns the digest of hashed data. ''' diff --git a/mocks/trezor/crypto/hashlib/Sha3_512.py b/mocks/trezor/crypto/hashlib/sha3_512.py similarity index 85% rename from mocks/trezor/crypto/hashlib/Sha3_512.py rename to mocks/trezor/crypto/hashlib/sha3_512.py index ba592a9be..aa6f048ee 100644 --- a/mocks/trezor/crypto/hashlib/Sha3_512.py +++ b/mocks/trezor/crypto/hashlib/sha3_512.py @@ -6,7 +6,7 @@ def update(self, data: bytes) -> None: ''' # ../extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h -def digest(self) -> bytes: +def digest(self, keccak: bool=False) -> bytes: ''' Returns the digest of hashed data. ''' diff --git a/mocks/trezor/crypto/hashlib/Sha512.py b/mocks/trezor/crypto/hashlib/sha512.py similarity index 100% rename from mocks/trezor/crypto/hashlib/Sha512.py rename to mocks/trezor/crypto/hashlib/sha512.py diff --git a/mocks/trezor/crypto/pbkdf2/Pbkdf2.py b/mocks/trezor/crypto/pbkdf2.py similarity index 100% rename from mocks/trezor/crypto/pbkdf2/Pbkdf2.py rename to mocks/trezor/crypto/pbkdf2.py diff --git a/mocks/trezor/crypto/pbkdf2/.mock-generated b/mocks/trezor/crypto/pbkdf2/.mock-generated deleted file mode 100644 index e69de29bb..000000000 diff --git a/mocks/trezor/crypto/pbkdf2/__init__.py b/mocks/trezor/crypto/pbkdf2/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/tests/check_coverage.sh b/src/tests/check_coverage.sh new file mode 100755 index 000000000..9964fe541 --- /dev/null +++ b/src/tests/check_coverage.sh @@ -0,0 +1,26 @@ +#!/bin/bash +find ../../mocks -name '*.py' | sort | while read module; do + module=$(echo $module | sed 's:^\.\./\.\./mocks/::') + base=$(basename $module) + # skip __init__.py + if [[ $base == "__init__.py" ]]; then + continue + fi + # skip everything outside of trezor + if [[ $module != trezor* ]]; then + continue + fi + # skip classes (uppercase modules) + if [[ $base == [ABCDEFGHIJKLMNOPQRSTUVWXYZ]* ]]; then + continue + fi + module=$(echo $module | sed -e 's:\.py$::' -e 's:/:.:g') + + if [ -r test_$module.py ]; then + echo "OK $module" + else + echo "MISS $module" + missing=$(expr $missing + 1) + fi + +done