chore(common,core,legacy,crypto): remove Groestlcoin
What changed, and why it matters
This commit removes all support for the Groestlcoin cryptocurrency from Trezor firmware. It deletes coin definitions, the custom Groestl hash algorithm code, related address/transaction handling, and tests. There is no security vulnerability here—this is a feature-removal cleanup.
No security action required. Reviewers may verify that no stale Groestlcoin references remain and that removal does not break builds or tests for other coins.
Security signals we found
No security-relevant change: pure feature removal
No new attack surface introduced
No vulnerability patched or created
Evidence from the diff
The commit is a broad deletion of Groestlcoin (GRS/tGRS) support across common definitions, core firmware, legacy firmware, and the crypto library. It removes JSON coin definitions, blockchain link entries, support metadata, the secp256k1_groestl curve binding, the Groestl512 hash implementation, Python bindings, coininfo.py entries, base58/checksum helpers, and associated unit/device tests. No new code paths, bug fixes, or behavioral changes to remaining coins are introduced.
Changed components
common/defs/bitcoin/groestlcoin.jsoncommon/defs/bitcoin/groestlcoin_testnet.jsoncommon/defs/blockchain_link.jsoncommon/defs/support.jsoncore/embed/crypto/build.rscore/embed/upymod/modtrezorcrypto/modtrezorcrypto-groestl.hcore/embed/upymod/modtrezorcrypto/modtrezorcrypto.ccore/src/apps/common/coininfo.pycore/src/apps/common/coininfo.py.makocore/src/trezor/crypto/base58.pycore/src/trezor/crypto/hashlib.pycrypto/groestl.ccrypto/groestl.hcrypto/groestl_internal.hcrypto/bip32.ccrypto/curves.ccrypto/curves.hcrypto/hasher.ccrypto/hasher.hcrypto/secp256k1.ccrypto/secp256k1.hlegacy/firmware/MakefileInspect captured patch +41 / −4468
### common/defs/bitcoin/groestlcoin.json
@@ -1,43 +0,0 @@
-{
- "coin_name": "Groestlcoin",
- "coin_shortcut": "GRS",
- "coin_label": "Groestlcoin",
- "website": "https://www.groestlcoin.org",
- "github": "https://github.com/Groestlcoin/groestlcoin",
- "maintainer": "Yura Pakhuchiy <pakhuchiy@gmail.com>",
- "curve_name": "secp256k1_groestl",
- "decimals": 8,
- "address_type": 36,
- "address_type_p2sh": 5,
- "maxfee_kb": 16000000000,
- "minfee_kb": 1000,
- "signed_message_header": "GroestlCoin Signed Message:\n",
- "hash_genesis_block": "00000ac5927c594d49cc0bdb81759d0da8297eb614683d3acb62f0703b639023",
- "xprv_magic": 76066276,
- "xpub_magic": 76067358,
- "xpub_magic_segwit_p2sh": 77429938,
- "xpub_magic_segwit_native": 78792518,
- "xpub_magic_multisig_segwit_p2sh": 76067358,
- "xpub_magic_multisig_segwit_native": 76067358,
- "bech32_prefix": "grs",
- "cashaddr_prefix": null,
- "slip44": 17,
- "segwit": true,
- "taproot": true,
- "decred": false,
- "fork_id": null,
- "force_bip143": false,
- "default_fee_b": {
- "Normal": 10
- },
- "dust_limit": 546,
- "blocktime_seconds": 60,
- "uri_prefix": "groestlcoin",
- "min_address_length": 27,
- "max_address_length": 34,
- "negative_fee": false,
- "cooldown": 100,
- "overwintered": false,
- "extra_data": false,
- "timestamp": false
-}
### common/defs/bitcoin/groestlcoin.png
[binary or diff unavailable]
### common/defs/bitcoin/groestlcoin_testnet.json
@@ -1,43 +0,0 @@
-{
- "coin_name": "Groestlcoin Testnet",
- "coin_shortcut": "tGRS",
- "coin_label": "Groestlcoin Testnet",
- "website": "https://www.groestlcoin.org",
- "github": "https://github.com/Groestlcoin/groestlcoin",
- "maintainer": "Yura Pakhuchiy <pakhuchiy@gmail.com>",
- "curve_name": "secp256k1_groestl",
- "decimals": 8,
- "address_type": 111,
- "address_type_p2sh": 196,
- "maxfee_kb": 100000,
- "minfee_kb": 1000,
- "signed_message_header": "GroestlCoin Signed Message:\n",
- "hash_genesis_block": "000000ffbb50fc9898cdd36ec163e6ba23230164c0052a28876255b7dcf2cd36",
- "xprv_magic": 70615956,
- "xpub_magic": 70617039,
- "xpub_magic_segwit_p2sh": 71979618,
- "xpub_magic_segwit_native": 73342198,
- "xpub_magic_multisig_segwit_p2sh": 70617039,
- "xpub_magic_multisig_segwit_native": 70617039,
- "bech32_prefix": "tgrs",
- "cashaddr_prefix": null,
- "slip44": 1,
- "segwit": true,
- "taproot": true,
- "decred": false,
- "fork_id": null,
- "force_bip143": false,
- "default_fee_b": {
- "Normal": 10
- },
- "dust_limit": 546,
- "blocktime_seconds": 60,
- "uri_prefix": "groestlcoin",
- "min_address_length": 27,
- "max_address_length": 34,
- "negative_fee": false,
- "cooldown": 100,
- "overwintered": false,
- "extra_data": false,
- "timestamp": false
-}
### common/defs/bitcoin/groestlcoin_testnet.png
[binary or diff unavailable]
### common/defs/blockchain_link.json
@@ -75,12 +75,6 @@
"https://explorer.fujicoin.org"
]
},
- "bitcoin:GRS": {
- "type": "blockbook",
- "url": [
- "https://blockbook.groestlcoin.org"
- ]
- },
"bitcoin:LTC": {
"type": "blockbook",
"url": [
@@ -172,12 +166,6 @@
"https://zny.blockbook.ovh"
]
},
- "bitcoin:tGRS": {
- "type": "blockbook",
- "url": [
- "https://blockbook-test.groestlcoin.org"
- ]
- },
"bitcoin:tPIVX": {
"type": "blockbook",
"url": [
### common/defs/support.json
@@ -19,7 +19,6 @@
"bitcoin:FJC": "1.6.1",
"bitcoin:FLO": "1.7.2",
"bitcoin:FTC": "1.7.1",
- "bitcoin:GRS": "1.6.2",
"bitcoin:KMD": "1.8.0",
"bitcoin:KOTO": "1.7.1",
"bitcoin:LTC": "1.5.2",
@@ -51,7 +50,6 @@
"bitcoin:ZEC": "1.8.1",
"bitcoin:tDASH": "1.6.2",
"bitcoin:tFIRO": "1.6.2",
- "bitcoin:tGRS": "1.6.2",
"bitcoin:tLTC": "1.6.2",
"bitcoin:tPPC": "1.8.4",
"bitcoin:tQTUM": "1.8.1",
@@ -127,7 +125,6 @@
"bitcoin:FJC": "2.6.1",
"bitcoin:FLO": "2.6.1",
"bitcoin:FTC": "2.6.1",
- "bitcoin:GRS": "2.6.1",
"bitcoin:KMD": "2.6.1",
"bitcoin:KOTO": "2.6.1",
"bitcoin:LTC": "2.6.1",
@@ -154,7 +151,6 @@
"bitcoin:ZCR": "2.6.1",
"bitcoin:ZEC": "2.6.1",
"bitcoin:tFIRO": "2.6.1",
- "bitcoin:tGRS": "2.6.1",
"bitcoin:tLTC": "2.6.1",
"bitcoin:tPPC": "2.6.1",
"bitcoin:tQTUM": "2.6.1",
@@ -243,7 +239,6 @@
"bitcoin:FJC": "2.0.5",
"bitcoin:FLO": "2.0.11",
"bitcoin:FTC": "2.0.8",
- "bitcoin:GRS": "2.0.8",
"bitcoin:KMD": "2.0.11",
"bitcoin:KOTO": "2.0.8",
"bitcoin:LTC": "2.0.5",
@@ -275,7 +270,6 @@
"bitcoin:ZEC": "2.1.1",
"bitcoin:tDASH": "2.0.8",
"bitcoin:tFIRO": "2.0.7",
- "bitcoin:tGRS": "2.0.8",
"bitcoin:tLTC": "2.0.7",
"bitcoin:tPPC": "2.1.9",
"bitcoin:tQTUM": "2.1.1",
@@ -351,7 +345,6 @@
"bitcoin:FJC": "2.8.1",
"bitcoin:FLO": "2.8.1",
"bitcoin:FTC": "2.8.1",
- "bitcoin:GRS": "2.8.1",
"bitcoin:KMD": "2.8.1",
"bitcoin:KOTO": "2.8.1",
"bitcoin:LTC": "2.8.1",
@@ -378,7 +371,6 @@
"bitcoin:ZCR": "2.8.1",
"bitcoin:ZEC": "2.8.1",
"bitcoin:tFIRO": "2.8.1",
- "bitcoin:tGRS": "2.8.1",
"bitcoin:tLTC": "2.8.1",
"bitcoin:tPPC": "2.8.1",
"bitcoin:tQTUM": "2.8.1",
@@ -463,7 +455,6 @@
"bitcoin:FJC": "2.6.1",
"bitcoin:FLO": "2.6.1",
"bitcoin:FTC": "2.6.1",
- "bitcoin:GRS": "2.6.1",
"bitcoin:KMD": "2.6.1",
"bitcoin:KOTO": "2.6.1",
"bitcoin:LTC": "2.6.1",
@@ -490,7 +481,6 @@
"bitcoin:ZCR": "2.6.1",
"bitcoin:ZEC": "2.6.1",
"bitcoin:tFIRO": "2.6.1",
- "bitcoin:tGRS": "2.6.1",
"bitcoin:tLTC": "2.6.1",
"bitcoin:tPPC": "2.6.1",
"bitcoin:tQTUM": "2.6.1",
@@ -575,7 +565,6 @@
"bitcoin:FJC": "2.6.1",
"bitcoin:FLO": "2.6.1",
"bitcoin:FTC": "2.6.1",
- "bitcoin:GRS": "2.6.1",
"bitcoin:KMD": "2.6.1",
"bitcoin:KOTO": "2.6.1",
"bitcoin:LTC": "2.6.1",
@@ -602,7 +591,6 @@
"bitcoin:ZCR": "2.6.1",
"bitcoin:ZEC": "2.6.1",
"bitcoin:tFIRO": "2.6.1",
- "bitcoin:tGRS": "2.6.1",
"bitcoin:tLTC": "2.6.1",
"bitcoin:tPPC": "2.6.1",
"bitcoin:tQTUM": "2.6.1",
@@ -688,7 +676,6 @@
"bitcoin:FJC": "2.6.1",
"bitcoin:FLO": "2.6.1",
"bitcoin:FTC": "2.6.1",
- "bitcoin:GRS": "2.6.1",
"bitcoin:KMD": "2.6.1",
"bitcoin:KOTO": "2.6.1",
"bitcoin:LTC": "2.6.1",
@@ -715,7 +702,6 @@
"bitcoin:ZCR": "2.6.1",
"bitcoin:ZEC": "2.6.1",
"bitcoin:tFIRO": "2.6.1",
- "bitcoin:tGRS": "2.6.1",
"bitcoin:tLTC": "2.6.1",
"bitcoin:tPPC": "2.6.1",
"bitcoin:tQTUM": "2.6.1",
@@ -801,7 +787,6 @@
"bitcoin:FJC": "2.6.1",
"bitcoin:FLO": "2.6.1",
"bitcoin:FTC": "2.6.1",
- "bitcoin:GRS": "2.6.1",
"bitcoin:KMD": "2.6.1",
"bitcoin:KOTO": "2.6.1",
"bitcoin:LTC": "2.6.1",
@@ -828,7 +813,6 @@
"bitcoin:ZCR": "2.6.1",
"bitcoin:ZEC": "2.6.1",
"bitcoin:tFIRO": "2.6.1",
- "bitcoin:tGRS": "2.6.1",
"bitcoin:tLTC": "2.6.1",
"bitcoin:tPPC": "2.6.1",
"bitcoin:tQTUM": "2.6.1",
### common/tools/coin_info.py
@@ -235,7 +235,6 @@ def do_check(coin: Coin) -> None:
choice=[
"secp256k1",
"secp256k1_decred",
- "secp256k1_groestl",
"secp256k1_smart",
],
),
### core/.changelog.d/8293.removed
@@ -0,0 +1 @@
+Remove Groestlcoin support.
### core/embed/crypto/build.rs
@@ -97,7 +97,6 @@ fn add_crypto_base(lib: &mut CLibrary, common_attrs: &CompileAttrs) -> Result<()
"ed25519-donna/ed25519.c",
"ed25519-donna/modm-donna-32bit.c",
"elligator2.c",
- "groestl.c",
"hash_to_curve.c",
"hasher.c",
"hmac.c",
### core/embed/upymod/modtrezorcrypto/modtrezorcrypto-groestl.h
@@ -1,123 +0,0 @@
-/*
- * This file is part of the Trezor project, https://trezor.io/
- *
- * Copyright (c) SatoshiLabs
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "py/objstr.h"
-
-#include "groestl.h"
-#include "memzero.h"
-
-#define GROESTL512_DIGEST_LENGTH 64
-#define GROESTL512_BLOCK_LENGTH 128
-
-/// package: trezorcrypto.__init__
-
-/// class groestl512:
-/// """
-/// GROESTL512 context.
-/// """
-/// block_size: int
-/// digest_size: int
-typedef struct _mp_obj_Groestl512_t {
- mp_obj_base_t base;
- GROESTL512_CTX ctx;
-} mp_obj_Groestl512_t;
-
-static mp_obj_t mod_trezorcrypto_Groestl512_update(mp_obj_t self,
- mp_obj_t data);
-
-/// def __init__(self, __data: StrOrBytes | None = None) -> None:
-/// """
-/// Creates a hash context object.
-/// """
-static mp_obj_t mod_trezorcrypto_Groestl512_make_new(const mp_obj_type_t *type,
- size_t n_args, size_t n_kw,
- const mp_obj_t *args) {
- mp_arg_check_num(n_args, n_kw, 0, 1, false);
- mp_obj_Groestl512_t *o =
- mp_obj_malloc_with_finaliser(mp_obj_Groestl512_t, type);
- groestl512_Init(&(o->ctx));
- if (n_args == 1) {
- mod_trezorcrypto_Groestl512_update(MP_OBJ_FROM_PTR(o), args[0]);
- }
- return MP_OBJ_FROM_PTR(o);
-}
-
-/// def update(self, __data: StrOrBytes) -> None:
-/// """
-/// Update the hash context with hashed data.
-/// """
-static mp_obj_t mod_trezorcrypto_Groestl512_update(mp_obj_t self,
- mp_obj_t data) {
- mp_obj_Groestl512_t *o = MP_OBJ_TO_PTR(self);
- mp_buffer_info_t msg = {0};
- mp_get_buffer_raise(data, &msg, MP_BUFFER_READ);
- if (msg.len > 0) {
- groestl512_Update(&(o->ctx), msg.buf, msg.len);
- }
- return mp_const_none;
-}
-static MP_DEFINE_CONST_FUN_OBJ_2(mod_trezorcrypto_Groestl512_update_obj,
- mod_trezorcrypto_Groestl512_update);
-
-/// def digest(self) -> bytes:
-/// """
-/// Returns the digest of hashed data.
-/// """
-static mp_obj_t mod_trezorcrypto_Groestl512_digest(mp_obj_t self) {
- mp_obj_Groestl512_t *o = MP_OBJ_TO_PTR(self);
- vstr_t hash = {0};
- vstr_init_len(&hash, GROESTL512_DIGEST_LENGTH);
- GROESTL512_CTX ctx = {0};
- memcpy(&ctx, &(o->ctx), sizeof(GROESTL512_CTX));
- groestl512_Final(&ctx, (uint8_t *)hash.buf);
- memzero(&ctx, sizeof(GROESTL512_CTX));
- return mp_obj_new_bytes_from_vstr(&hash);
-}
-static MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorcrypto_Groestl512_digest_obj,
- mod_trezorcrypto_Groestl512_digest);
-
-static mp_obj_t mod_trezorcrypto_Groestl512___del__(mp_obj_t self) {
- mp_obj_Groestl512_t *o = MP_OBJ_TO_PTR(self);
- memzero(&(o->ctx), sizeof(GROESTL512_CTX));
- return mp_const_none;
-}
-static MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorcrypto_Groestl512___del___obj,
- mod_trezorcrypto_Groestl512___del__);
-
-static const mp_rom_map_elem_t mod_trezorcrypto_Groestl512_locals_dict_table[] =
- {
- {MP_ROM_QSTR(MP_QSTR_update),
- MP_ROM_PTR(&mod_trezorcrypto_Groestl512_update_obj)},
- {MP_ROM_QSTR(MP_QSTR_digest),
- MP_ROM_PTR(&mod_trezorcrypto_Groestl512_digest_obj)},
- {MP_ROM_QSTR(MP_QSTR___del__),
- MP_ROM_PTR(&mod_trezorcrypto_Groestl512___del___obj)},
- {MP_ROM_QSTR(MP_QSTR_block_size), MP_ROM_INT(GROESTL512_BLOCK_LENGTH)},
- {MP_ROM_QSTR(MP_QSTR_digest_size),
- MP_ROM_INT(GROESTL512_DIGEST_LENGTH)},
-};
-static MP_DEFINE_CONST_DICT(mod_trezorcrypto_Groestl512_locals_dict,
- mod_trezorcrypto_Groestl512_locals_dict_table);
-
-// clang-format off
-static MP_DEFINE_CONST_OBJ_TYPE(mod_trezorcrypto_Groestl512_type,
- MP_QSTR_Groestl512, MP_TYPE_FLAG_NONE,
- make_new, mod_trezorcrypto_Groestl512_make_new,
- locals_dict, &mod_trezorcrypto_Groestl512_locals_dict);
-// clang-format on
### core/embed/upymod/modtrezorcrypto/modtrezorcrypto.c
@@ -54,7 +54,6 @@ extern const mp_obj_type_t mp_type_AuthenticationError;
#if USE_THP
#include "modtrezorcrypto-elligator2.h"
#endif
-#include "modtrezorcrypto-groestl.h"
#include "modtrezorcrypto-hmac.h"
#include "modtrezorcrypto-nist256p1.h"
#include "modtrezorcrypto-pbkdf2.h"
@@ -123,8 +122,6 @@ static const mp_rom_map_elem_t mp_module_trezorcrypto_globals_table[] = {
#endif
{MP_ROM_QSTR(MP_QSTR_nist256p1),
MP_ROM_PTR(&mod_trezorcrypto_nist256p1_module)},
- {MP_ROM_QSTR(MP_QSTR_groestl512),
- MP_ROM_PTR(&mod_trezorcrypto_Groestl512_type)},
{MP_ROM_QSTR(MP_QSTR_hmac), MP_ROM_PTR(&mod_trezorcrypto_Hmac_type)},
{MP_ROM_QSTR(MP_QSTR_pbkdf2), MP_ROM_PTR(&mod_trezorcrypto_Pbkdf2_type)},
{MP_ROM_QSTR(MP_QSTR_random), MP_ROM_PTR(&mod_trezorcrypto_random_module)},
### core/mocks/generated/trezorcrypto/__init__.pyi
@@ -273,30 +273,6 @@ class AuthenticationError(Exception):
"""
-# upymod/modtrezorcrypto/modtrezorcrypto-groestl.h
-class groestl512:
- """
- GROESTL512 context.
- """
- block_size: int
- digest_size: int
-
- def __init__(self, __data: StrOrBytes | None = None) -> None:
- """
- Creates a hash context object.
- """
-
- def update(self, __data: StrOrBytes) -> None:
- """
- Update the hash context with hashed data.
- """
-
- def digest(self) -> bytes:
- """
- Returns the digest of hashed data.
- """
-
-
# upymod/modtrezorcrypto/modtrezorcrypto-hmac.h
class hmac:
"""
### core/src/apps/benchmark/benchmarks.py
@@ -10,7 +10,6 @@
blake2b,
blake2s,
blake256,
- groestl512,
ripemd160,
sha3_256,
sha3_512,
@@ -54,7 +53,6 @@ def verify(self, public_key: bytes, signature: bytes, digest: bytes) -> bool:
"crypto/hash/blake2b": HashBenchmark(lambda: blake2b()),
"crypto/hash/blake2s": HashBenchmark(lambda: blake2s()),
"crypto/hash/blake256": HashBenchmark(lambda: blake256()),
- "crypto/hash/groestl512": HashBenchmark(lambda: groestl512()),
"crypto/hash/ripemd160": HashBenchmark(lambda: ripemd160()),
"crypto/hash/sha3_256": HashBenchmark(lambda: sha3_256()),
"crypto/hash/sha3_512": HashBenchmark(lambda: sha3_512()),
### core/src/apps/common/coininfo.py
@@ -7,7 +7,7 @@
from typing import Any
from trezor import utils
-from trezor.crypto.base58 import blake256d_32, groestl512d_32, keccak_32, sha256d_32
+from trezor.crypto.base58 import blake256d_32, keccak_32, sha256d_32
from trezor.crypto.scripts import blake256_ripemd160, sha256_ripemd160
# flake8: noqa
@@ -67,14 +67,10 @@ def __init__(
self.extra_data = extra_data
self.timestamp = timestamp
self.overwintered = overwintered
- if curve_name == "secp256k1-groestl":
- self.b58_hash = groestl512d_32
- self.sign_hash_double = False
- self.script_hash: type[utils.HashContextInitable] = sha256_ripemd160
- elif curve_name == "secp256k1-decred":
+ if curve_name == "secp256k1-decred":
self.b58_hash = blake256d_32
self.sign_hash_double = False
- self.script_hash = blake256_ripemd160
+ self.script_hash: type[utils.HashContextInitable] = blake256_ripemd160
elif curve_name == "secp256k1-smart":
self.b58_hash = keccak_32
self.sign_hash_double = False
@@ -626,62 +622,6 @@ def by_name(name: str) -> CoinInfo:
False, # timestamp
False, # overwintered
)
- if name == "Groestlcoin":
- return CoinInfo(
- name, # coin_name
- "GRS", # coin_shortcut
- 8, # decimals
- 36, # address_type
- 5, # address_type_p2sh
- 16000000000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x0488b21e, # xpub_magic
- 0x049d7cb2, # xpub_magic_segwit_p2sh
- 0x04b24746, # xpub_magic_segwit_native
- 0x0488b21e, # xpub_magic_multisig_segwit_p2sh
- 0x0488b21e, # xpub_magic_multisig_segwit_native
- "grs", # bech32_prefix
- None, # cashaddr_prefix
- 17, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
- if name == "Groestlcoin Testnet":
- return CoinInfo(
- name, # coin_name
- "tGRS", # coin_shortcut
- 8, # decimals
- 111, # address_type
- 196, # address_type_p2sh
- 100000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x043587cf, # xpub_magic
- 0x044a5262, # xpub_magic_segwit_p2sh
- 0x045f1cf6, # xpub_magic_segwit_native
- 0x043587cf, # xpub_magic_multisig_segwit_p2sh
- 0x043587cf, # xpub_magic_multisig_segwit_native
- "tgrs", # bech32_prefix
- None, # cashaddr_prefix
- 1, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
if name == "Komodo":
return CoinInfo(
name, # coin_name
@@ -2141,62 +2081,6 @@ def by_name(name: str) -> CoinInfo:
False, # timestamp
False, # overwintered
)
- if name == "Groestlcoin":
- return CoinInfo(
- name, # coin_name
- "GRS", # coin_shortcut
- 8, # decimals
- 36, # address_type
- 5, # address_type_p2sh
- 16000000000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x0488b21e, # xpub_magic
- 0x049d7cb2, # xpub_magic_segwit_p2sh
- 0x04b24746, # xpub_magic_segwit_native
- 0x0488b21e, # xpub_magic_multisig_segwit_p2sh
- 0x0488b21e, # xpub_magic_multisig_segwit_native
- "grs", # bech32_prefix
- None, # cashaddr_prefix
- 17, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
- if name == "Groestlcoin Testnet":
- return CoinInfo(
- name, # coin_name
- "tGRS", # coin_shortcut
- 8, # decimals
- 111, # address_type
- 196, # address_type_p2sh
- 100000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x043587cf, # xpub_magic
- 0x044a5262, # xpub_magic_segwit_p2sh
- 0x045f1cf6, # xpub_magic_segwit_native
- 0x043587cf, # xpub_magic_multisig_segwit_p2sh
- 0x043587cf, # xpub_magic_multisig_segwit_native
- "tgrs", # bech32_prefix
- None, # cashaddr_prefix
- 1, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
if name == "Komodo":
return CoinInfo(
name, # coin_name
@@ -3516,62 +3400,6 @@ def by_name(name: str) -> CoinInfo:
False, # timestamp
False, # overwintered
)
- if name == "Groestlcoin":
- return CoinInfo(
- name, # coin_name
- "GRS", # coin_shortcut
- 8, # decimals
- 36, # address_type
- 5, # address_type_p2sh
- 16000000000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x0488b21e, # xpub_magic
- 0x049d7cb2, # xpub_magic_segwit_p2sh
- 0x04b24746, # xpub_magic_segwit_native
- 0x0488b21e, # xpub_magic_multisig_segwit_p2sh
- 0x0488b21e, # xpub_magic_multisig_segwit_native
- "grs", # bech32_prefix
- None, # cashaddr_prefix
- 17, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
- if name == "Groestlcoin Testnet":
- return CoinInfo(
- name, # coin_name
- "tGRS", # coin_shortcut
- 8, # decimals
- 111, # address_type
- 196, # address_type_p2sh
- 100000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x043587cf, # xpub_magic
- 0x044a5262, # xpub_magic_segwit_p2sh
- 0x045f1cf6, # xpub_magic_segwit_native
- 0x043587cf, # xpub_magic_multisig_segwit_p2sh
- 0x043587cf, # xpub_magic_multisig_segwit_native
- "tgrs", # bech32_prefix
- None, # cashaddr_prefix
- 1, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
if name == "Komodo":
return CoinInfo(
name, # coin_name
@@ -4835,62 +4663,6 @@ def by_name(name: str) -> CoinInfo:
False, # timestamp
False, # overwintered
)
- if name == "Groestlcoin":
- return CoinInfo(
- name, # coin_name
- "GRS", # coin_shortcut
- 8, # decimals
- 36, # address_type
- 5, # address_type_p2sh
- 16000000000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x0488b21e, # xpub_magic
- 0x049d7cb2, # xpub_magic_segwit_p2sh
- 0x04b24746, # xpub_magic_segwit_native
- 0x0488b21e, # xpub_magic_multisig_segwit_p2sh
- 0x0488b21e, # xpub_magic_multisig_segwit_native
- "grs", # bech32_prefix
- None, # cashaddr_prefix
- 17, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
- if name == "Groestlcoin Testnet":
- return CoinInfo(
- name, # coin_name
- "tGRS", # coin_shortcut
- 8, # decimals
- 111, # address_type
- 196, # address_type_p2sh
- 100000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x043587cf, # xpub_magic
- 0x044a5262, # xpub_magic_segwit_p2sh
- 0x045f1cf6, # xpub_magic_segwit_native
- 0x043587cf, # xpub_magic_multisig_segwit_p2sh
- 0x043587cf, # xpub_magic_multisig_segwit_native
- "tgrs", # bech32_prefix
- None, # cashaddr_prefix
- 1, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
if name == "Komodo":
return CoinInfo(
name, # coin_name
@@ -6154,62 +5926,6 @@ def by_name(name: str) -> CoinInfo:
False, # timestamp
False, # overwintered
)
- if name == "Groestlcoin":
- return CoinInfo(
- name, # coin_name
- "GRS", # coin_shortcut
- 8, # decimals
- 36, # address_type
- 5, # address_type_p2sh
- 16000000000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x0488b21e, # xpub_magic
- 0x049d7cb2, # xpub_magic_segwit_p2sh
- 0x04b24746, # xpub_magic_segwit_native
- 0x0488b21e, # xpub_magic_multisig_segwit_p2sh
- 0x0488b21e, # xpub_magic_multisig_segwit_native
- "grs", # bech32_prefix
- None, # cashaddr_prefix
- 17, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
- if name == "Groestlcoin Testnet":
- return CoinInfo(
- name, # coin_name
- "tGRS", # coin_shortcut
- 8, # decimals
- 111, # address_type
- 196, # address_type_p2sh
- 100000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x043587cf, # xpub_magic
- 0x044a5262, # xpub_magic_segwit_p2sh
- 0x045f1cf6, # xpub_magic_segwit_native
- 0x043587cf, # xpub_magic_multisig_segwit_p2sh
- 0x043587cf, # xpub_magic_multisig_segwit_native
- "tgrs", # bech32_prefix
- None, # cashaddr_prefix
- 1, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
if name == "Komodo":
return CoinInfo(
name, # coin_name
@@ -7473,62 +7189,6 @@ def by_name(name: str) -> CoinInfo:
False, # timestamp
False, # overwintered
)
- if name == "Groestlcoin":
- return CoinInfo(
- name, # coin_name
- "GRS", # coin_shortcut
- 8, # decimals
- 36, # address_type
- 5, # address_type_p2sh
- 16000000000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x0488b21e, # xpub_magic
- 0x049d7cb2, # xpub_magic_segwit_p2sh
- 0x04b24746, # xpub_magic_segwit_native
- 0x0488b21e, # xpub_magic_multisig_segwit_p2sh
- 0x0488b21e, # xpub_magic_multisig_segwit_native
- "grs", # bech32_prefix
- None, # cashaddr_prefix
- 17, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
- if name == "Groestlcoin Testnet":
- return CoinInfo(
- name, # coin_name
- "tGRS", # coin_shortcut
- 8, # decimals
- 111, # address_type
- 196, # address_type_p2sh
- 100000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x043587cf, # xpub_magic
- 0x044a5262, # xpub_magic_segwit_p2sh
- 0x045f1cf6, # xpub_magic_segwit_native
- 0x043587cf, # xpub_magic_multisig_segwit_p2sh
- 0x043587cf, # xpub_magic_multisig_segwit_native
- "tgrs", # bech32_prefix
- None, # cashaddr_prefix
- 1, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
if name == "Komodo":
return CoinInfo(
name, # coin_name
@@ -8792,62 +8452,6 @@ def by_name(name: str) -> CoinInfo:
False, # timestamp
False, # overwintered
)
- if name == "Groestlcoin":
- return CoinInfo(
- name, # coin_name
- "GRS", # coin_shortcut
- 8, # decimals
- 36, # address_type
- 5, # address_type_p2sh
- 16000000000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x0488b21e, # xpub_magic
- 0x049d7cb2, # xpub_magic_segwit_p2sh
- 0x04b24746, # xpub_magic_segwit_native
- 0x0488b21e, # xpub_magic_multisig_segwit_p2sh
- 0x0488b21e, # xpub_magic_multisig_segwit_native
- "grs", # bech32_prefix
- None, # cashaddr_prefix
- 17, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
- if name == "Groestlcoin Testnet":
- return CoinInfo(
- name, # coin_name
- "tGRS", # coin_shortcut
- 8, # decimals
- 111, # address_type
- 196, # address_type_p2sh
- 100000, # maxfee_kb
- "GroestlCoin Signed Message:\n", # signed_message_header
- 0x043587cf, # xpub_magic
- 0x044a5262, # xpub_magic_segwit_p2sh
- 0x045f1cf6, # xpub_magic_segwit_native
- 0x043587cf, # xpub_magic_multisig_segwit_p2sh
- 0x043587cf, # xpub_magic_multisig_segwit_native
- "tgrs", # bech32_prefix
- None, # cashaddr_prefix
- 1, # slip44
- True, # segwit
- True, # taproot
- None, # fork_id
- False, # force_bip143
- False, # decred
- False, # negative_fee
- 'secp256k1-groestl', # curve_name
- False, # extra_data
- False, # timestamp
- False, # overwintered
- )
if name == "Komodo":
return CoinInfo(
name, # coin_name
### core/src/apps/common/coininfo.py.mako
@@ -7,7 +7,7 @@
from typing import Any
from trezor import utils
-from trezor.crypto.base58 import blake256d_32, groestl512d_32, keccak_32, sha256d_32
+from trezor.crypto.base58 import blake256d_32, keccak_32, sha256d_32
from trezor.crypto.scripts import blake256_ripemd160, sha256_ripemd160
# flake8: noqa
@@ -67,14 +67,10 @@ class CoinInfo:
self.extra_data = extra_data
self.timestamp = timestamp
self.overwintered = overwintered
- if curve_name == "secp256k1-groestl":
- self.b58_hash = groestl512d_32
- self.sign_hash_double = False
- self.script_hash: type[utils.HashContextInitable] = sha256_ripemd160
- elif curve_name == "secp256k1-decred":
+ if curve_name == "secp256k1-decred":
self.b58_hash = blake256d_32
self.sign_hash_double = False
- self.script_hash = blake256_ripemd160
+ self.script_hash: type[utils.HashContextInitable] = blake256_ripemd160
elif curve_name == "secp256k1-smart":
self.b58_hash = keccak_32
self.sign_hash_double = False
### core/src/trezor/crypto/base58.py
@@ -72,12 +72,6 @@ def sha256d_32(data: AnyBytes) -> bytes:
return sha256(sha256(data).digest()).digest()[:4]
-def groestl512d_32(data: AnyBytes) -> bytes:
- from .hashlib import groestl512
-
- return groestl512(groestl512(data).digest()).digest()[:4]
-
-
def blake256d_32(data: AnyBytes) -> bytes:
from .hashlib import blake256
### core/src/trezor/crypto/hashlib.py
@@ -2,7 +2,6 @@
blake2b,
blake2s,
blake256,
- groestl512,
ripemd160,
sha3_256,
sha3_512,
### core/tests/test_apps.bitcoin.address_grs.py
@@ -1,106 +0,0 @@
-# flake8: noqa: F403,F405
-from common import * # isort:skip
-
-from trezor.crypto import bip32, bip39
-
-from apps.bitcoin.addresses import *
-from apps.bitcoin.common import *
-from apps.common import coins
-
-
-def node_derive(root, path):
- node = root.clone()
- node.derive_path(path)
- return node
-
-
-@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
-class TestAddressGRS(unittest.TestCase):
- # pylint: disable=C0301
-
- def test_p2pkh_node_derive_address(self):
- coin = coins.by_name("Groestlcoin")
- seed = bip39.seed(" ".join(["all"] * 12), "")
- root = bip32.from_seed(seed, coin.curve_name)
-
- node = node_derive(
- root, [44 | 0x80000000, 17 | 0x80000000, 0 | 0x80000000, 1, 0]
- )
- address = node.address(coin.address_type) # generate in trezor-crypto
- self.assertEqual(address, "FmRaqvVBRrAp2Umfqx9V1ectZy8gw54QDN")
- address = address_pkh(node.public_key(), coin) # generate in trezor-core
- self.assertEqual(address, "FmRaqvVBRrAp2Umfqx9V1ectZy8gw54QDN")
-
- node = node_derive(
- root, [44 | 0x80000000, 17 | 0x80000000, 0 | 0x80000000, 1, 1]
- )
- address = node.address(coin.address_type)
- self.assertEqual(address, "Fmhtxeh7YdCBkyQF7AQG4QnY8y3rJg89di")
- address = address_pkh(node.public_key(), coin)
- self.assertEqual(address, "Fmhtxeh7YdCBkyQF7AQG4QnY8y3rJg89di")
-
- node = node_derive(
- root, [44 | 0x80000000, 17 | 0x80000000, 0 | 0x80000000, 0, 0]
- )
- address = node.address(coin.address_type)
- self.assertEqual(address, "Fj62rBJi8LvbmWu2jzkaUX1NFXLEqDLoZM")
- address = address_pkh(node.public_key(), coin)
- self.assertEqual(address, "Fj62rBJi8LvbmWu2jzkaUX1NFXLEqDLoZM")
-
- def test_p2wpkh_in_p2sh_node_derive_address(self):
- coin = coins.by_name("Groestlcoin Testnet")
- seed = bip39.seed(" ".join(["all"] * 12), "")
- root = bip32.from_seed(seed, coin.curve_name)
-
- node = node_derive(
- root, [49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0]
- )
- address = address_p2wpkh_in_p2sh(node.public_key(), coin)
- self.assertEqual(address, "2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7")
-
- node = node_derive(
- root, [49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 1]
- )
- address = address_p2wpkh_in_p2sh(node.public_key(), coin)
- self.assertEqual(address, "2NFWLCJQBSpz1oUJwwLpX8ECifFWGxQyzGu")
-
- node = node_derive(
- root, [49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 0]
- )
- address = address_p2wpkh_in_p2sh(node.public_key(), coin)
- self.assertEqual(address, "2N4Q5FhU2497BryFfUgbqkAJE87aKDv3V3e")
-
- def test_p2sh_address(self):
- coin = coins.by_name("Groestlcoin Testnet")
-
- address = address_p2sh(
- bytes.fromhex("7a55d61848e77ca266e79a39bfc85c580a6426c9"), coin
- )
- self.assertEqual(address, "2N4Q5FhU2497BryFfUgbqkAJE87aKDv3V3e")
-
- def test_p2wpkh_node_derive_address(self):
- coin = coins.by_name("Groestlcoin")
- seed = bip39.seed(" ".join(["all"] * 12), "")
- root = bip32.from_seed(seed, coin.curve_name)
-
- node = node_derive(
- root, [84 | 0x80000000, 17 | 0x80000000, 0 | 0x80000000, 1, 0]
- )
- address = address_p2wpkh(node.public_key(), coin)
- self.assertEqual(address, "grs1qzfpwn55tvkxcw0xwfa0g8k2gtlzlgkcq3z000e")
-
- node = node_derive(
- root, [84 | 0x80000000, 17 | 0x80000000, 0 | 0x80000000, 1, 1]
- )
- address = address_p2wpkh(node.public_key(), coin)
- self.assertEqual(address, "grs1qxsgwl66tx7tsuwfm4kk5c5dh6tlfpr4qjqg6gg")
-
- node = node_derive(
- root, [84 | 0x80000000, 17 | 0x80000000, 0 | 0x80000000, 0, 0]
- )
- address = address_p2wpkh(node.public_key(), coin)
- self.assertEqual(address, "grs1qw4teyraux2s77nhjdwh9ar8rl9dt7zww8r6lne")
-
-
-if __name__ == "__main__":
- unittest.main()
### core/tests/test_apps.bitcoin.segwit.signtx.native_p2wpkh_grs.py
@@ -1,449 +0,0 @@
-# flake8: noqa: F403,F405
-from common import * # isort:skip
-
-from trezor.crypto import bip39
-from trezor.enums import AmountUnit, InputScriptType, OutputScriptType
-from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
-from trezor.messages import (
- PrevInput,
- PrevOutput,
- PrevTx,
- SignTx,
- TxAckInput,
- TxAckInputWrapper,
- TxAckOutput,
- TxAckOutputWrapper,
- TxAckPrevInput,
- TxAckPrevInputWrapper,
- TxAckPrevMeta,
- TxAckPrevOutput,
- TxAckPrevOutputWrapper,
- TxInput,
- TxOutput,
- TxRequest,
- TxRequestDetailsType,
- TxRequestSerializedType,
-)
-
-from apps.bitcoin.keychain import _get_schemas_for_coin
-from apps.bitcoin.sign_tx import bitcoinlike
-from apps.common import coins
-from apps.common.keychain import Keychain
-
-EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray())
-
-
-# https://groestlsight-test.groestlcoin.org/api/tx/9b5c4859a8a31e69788cb4402812bb28f14ad71cbd8c60b09903478bc56f79a3
-@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
-class TestSignSegwitTxNativeP2WPKH_GRS(unittest.TestCase):
- # pylint: disable=C0301
-
- def test_send_native_p2wpkh(self):
-
- coin = coins.by_name("Groestlcoin Testnet")
- seed = bip39.seed(" ".join(["all"] * 12), "")
-
- inp1 = TxInput(
- # 84'/1'/0'/0/0" - tgrs1qkvwu9g3k2pdxewfqr7syz89r3gj557l3ued7ja
- address_n=[84 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 0],
- amount=12300000,
- prev_hash=bytes.fromhex(
- "4f2f857f39ed1afe05542d058fb0be865a387446e32fc876d086203f483f61d1"
- ),
- prev_index=0,
- script_type=InputScriptType.SPENDWITNESS,
- sequence=0xFFFFFFFE,
- multisig=None,
- )
- ptx1 = PrevTx(
- version=1,
- lock_time=650645,
- inputs_count=1,
- outputs_count=2,
- extra_data_len=0,
- )
- pinp1 = PrevInput(
- script_sig=bytes.fromhex(
- "483045022100d9615361c044e91f6dd7bb4455f3ad686cd5a663d7800bb74c448b2706500ccb022026bed24b81a501e8398411c5a9a793741d9bfe39617d51c363dde0a84f44f4f9012102659a6eefcc72d6f2eff92e57095388b17db0b06034946ecd44120e5e7a830ff4"
- ),
- prev_hash=bytes.fromhex(
- "1c92508b38239e5c10b23fb46dcf765ee2f3a95b835edbf0943ec21b21711160"
- ),
- prev_index=1,
- sequence=4294967293,
- )
- pout1 = PrevOutput(
- script_pubkey=bytes.fromhex("0014b31dc2a236505a6cb9201fa0411ca38a254a7bf1"),
- amount=12300000,
- )
- pout2 = PrevOutput(
- script_pubkey=bytes.fromhex(
- "76a91438cc090e4a4b2e458c33fe35af1c5c0094699ac288ac"
- ),
- amount=9887699777,
- )
-
- out1 = TxOutput(
- address="2N4Q5FhU2497BryFfUgbqkAJE87aKDv3V3e",
- amount=5000000,
- script_type=OutputScriptType.PAYTOADDRESS,
- address_n=[],
- multisig=None,
- )
- out2 = TxOutput(
- address="tgrs1qejqxwzfld7zr6mf7ygqy5s5se5xq7vmt9lkd57",
- script_type=OutputScriptType.PAYTOADDRESS,
- amount=12300000 - 11000 - 5000000,
- address_n=[],
- multisig=None,
- )
- tx = SignTx(
- coin_name="Groestlcoin Testnet",
- version=1,
- lock_time=650713,
- inputs_count=1,
- outputs_count=2,
- )
-
- # precomputed tx weight is 142 = ceil(566 / 4)
- fee_rate = 11000 / 142
-
- messages = [
- # check fee
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
- ui.confirm_output(
- out1, coin, AmountUnit.BITCOIN, 0, False, [H_(84), H_(1), H_(0)]
- ),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
- ui.confirm_output(
- out2, coin, AmountUnit.BITCOIN, 1, False, [H_(84), H_(1), H_(0)]
- ),
- ui.confirm_nondefault_locktime(tx.lock_time, False),
- ui.confirm_total(
- 12300000, 11000, fee_rate, coin, AmountUnit.BITCOIN, inp1.address_n[:3]
- ),
- # check prev tx
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXMETA,
- details=TxRequestDetailsType(
- request_index=None, tx_hash=inp1.prev_hash
- ),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevMeta(tx=ptx1),
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevInput(tx=TxAckPrevInputWrapper(input=pinp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevOutput(tx=TxAckPrevOutputWrapper(output=pout1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevOutput(tx=TxAckPrevOutputWrapper(output=pout2)),
- # sign tx
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized header
- serialized_tx=bytes.fromhex("01000000000101"),
- ),
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized inp1
- serialized_tx=bytes.fromhex(
- "d1613f483f2086d076c82fe34674385a86beb08f052d5405fe1aed397f852f4f0000000000feffffff02"
- ),
- ),
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized out1
- serialized_tx=bytes.fromhex(
- "404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987"
- ),
- signature_index=None,
- signature=None,
- ),
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
- # segwit
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized out2
- serialized_tx=bytes.fromhex(
- "a8386f0000000000160014cc8067093f6f843d6d3e22004a4290cd0c0f336b"
- ),
- signature_index=None,
- signature=None,
- ),
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXFINISHED,
- details=TxRequestDetailsType(),
- serialized=TxRequestSerializedType(
- serialized_tx=bytes.fromhex(
- "02483045022100ea8780bc1e60e14e945a80654a41748bbf1aa7d6f2e40a88d91dfc2de1f34bd10220181a474a3420444bd188501d8d270736e1e9fe379da9970de992ff445b0972e3012103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f862d9ed0900"
- ),
- signature_index=0,
- signature=bytes.fromhex(
- "3045022100ea8780bc1e60e14e945a80654a41748bbf1aa7d6f2e40a88d91dfc2de1f34bd10220181a474a3420444bd188501d8d270736e1e9fe379da9970de992ff445b0972e3"
- ),
- ),
- ),
- ]
-
- ns = _get_schemas_for_coin(coin)
- keychain = Keychain(seed, coin.curve_name, ns)
- signer = bitcoinlike.Bitcoinlike(tx, keychain, coin, None)
- run_signer(self, signer, messages)
-
- def test_send_native_p2wpkh_change(self):
-
- coin = coins.by_name("Groestlcoin Testnet")
- seed = bip39.seed(" ".join(["all"] * 12), "")
-
- inp1 = TxInput(
- # 84'/1'/0'/0/0" - tgrs1qkvwu9g3k2pdxewfqr7syz89r3gj557l3ued7ja
- address_n=[84 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 0],
- amount=12300000,
- prev_hash=bytes.fromhex(
- "4f2f857f39ed1afe05542d058fb0be865a387446e32fc876d086203f483f61d1"
- ),
- prev_index=0,
- script_type=InputScriptType.SPENDWITNESS,
- sequence=0xFFFFFFFE,
- multisig=None,
- )
- ptx1 = PrevTx(
- version=1,
- lock_time=650645,
- inputs_count=1,
- outputs_count=2,
- extra_data_len=0,
- )
- pinp1 = PrevInput(
- script_sig=bytes.fromhex(
- "483045022100d9615361c044e91f6dd7bb4455f3ad686cd5a663d7800bb74c448b2706500ccb022026bed24b81a501e8398411c5a9a793741d9bfe39617d51c363dde0a84f44f4f9012102659a6eefcc72d6f2eff92e57095388b17db0b06034946ecd44120e5e7a830ff4"
- ),
- prev_hash=bytes.fromhex(
- "1c92508b38239e5c10b23fb46dcf765ee2f3a95b835edbf0943ec21b21711160"
- ),
- prev_index=1,
- sequence=4294967293,
- )
- pout1 = PrevOutput(
- script_pubkey=bytes.fromhex("0014b31dc2a236505a6cb9201fa0411ca38a254a7bf1"),
- amount=12300000,
- )
- pout2 = PrevOutput(
- script_pubkey=bytes.fromhex(
- "76a91438cc090e4a4b2e458c33fe35af1c5c0094699ac288ac"
- ),
- amount=9887699777,
- )
-
- out1 = TxOutput(
- address="2N4Q5FhU2497BryFfUgbqkAJE87aKDv3V3e",
- amount=5000000,
- script_type=OutputScriptType.PAYTOADDRESS,
- address_n=[],
- multisig=None,
- )
- out2 = TxOutput(
- address=None,
- # 84'/1'/0'/1/0" - tgrs1qejqxwzfld7zr6mf7ygqy5s5se5xq7vmt9lkd57
- address_n=[84 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
- script_type=OutputScriptType.PAYTOWITNESS,
- amount=12300000 - 11000 - 5000000,
- multisig=None,
- )
- tx = SignTx(
- coin_name="Groestlcoin Testnet",
- version=1,
- lock_time=650713,
- inputs_count=1,
- outputs_count=2,
- )
-
- # precomputed tx weight is 142 = ceil(566 / 4)
- fee_rate = 11000 / 142
-
- messages = [
- # check fee
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
- ui.confirm_output(
- out1, coin, AmountUnit.BITCOIN, 0, False, [H_(84), H_(1), H_(0)]
- ),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
- ui.confirm_nondefault_locktime(tx.lock_time, False),
- ui.confirm_total(
- 5000000 + 11000,
- 11000,
- fee_rate,
- coin,
- AmountUnit.BITCOIN,
- inp1.address_n[:3],
- ),
- # check prev tx
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXMETA,
- details=TxRequestDetailsType(
- request_index=None, tx_hash=inp1.prev_hash
- ),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevMeta(tx=ptx1),
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevInput(tx=TxAckPrevInputWrapper(input=pinp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevOutput(tx=TxAckPrevOutputWrapper(output=pout1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevOutput(tx=TxAckPrevOutputWrapper(output=pout2)),
- # sign tx
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized header
- serialized_tx=bytes.fromhex("01000000000101"),
- ),
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized inp1
- serialized_tx=bytes.fromhex(
- "d1613f483f2086d076c82fe34674385a86beb08f052d5405fe1aed397f852f4f0000000000feffffff02"
- ),
- ),
- ),
- # the out has to be cloned not to send the same object which was modified
- TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out1.__dict__))),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized out1
- serialized_tx=bytes.fromhex(
- "404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987"
- ),
- signature_index=None,
- signature=None,
- ),
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out2.__dict__))),
- # segwit
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized out2
- serialized_tx=bytes.fromhex(
- "a8386f0000000000160014cc8067093f6f843d6d3e22004a4290cd0c0f336b"
- ),
- signature_index=None,
- signature=None,
- ),
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXFINISHED,
- details=TxRequestDetailsType(),
- serialized=TxRequestSerializedType(
- serialized_tx=bytes.fromhex(
- "02483045022100ea8780bc1e60e14e945a80654a41748bbf1aa7d6f2e40a88d91dfc2de1f34bd10220181a474a3420444bd188501d8d270736e1e9fe379da9970de992ff445b0972e3012103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f862d9ed0900"
- ),
- signature_index=0,
- signature=bytes.fromhex(
- "3045022100ea8780bc1e60e14e945a80654a41748bbf1aa7d6f2e40a88d91dfc2de1f34bd10220181a474a3420444bd188501d8d270736e1e9fe379da9970de992ff445b0972e3"
- ),
- ),
- ),
- ]
-
- ns = _get_schemas_for_coin(coin)
- keychain = Keychain(seed, coin.curve_name, ns)
- signer = bitcoinlike.Bitcoinlike(tx, keychain, coin, None)
- run_signer(self, signer, messages)
-
-
-if __name__ == "__main__":
- unittest.main()
### core/tests/test_apps.bitcoin.segwit.signtx.p2wpkh_in_p2sh_grs.py
@@ -1,457 +0,0 @@
-# flake8: noqa: F403,F405
-from common import * # isort:skip
-
-from trezor.crypto import bip39
-from trezor.enums import AmountUnit, InputScriptType, OutputScriptType
-from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
-from trezor.messages import (
- PrevInput,
- PrevOutput,
- PrevTx,
- SignTx,
- TxAckInput,
- TxAckInputWrapper,
- TxAckOutput,
- TxAckOutputWrapper,
- TxAckPrevInput,
- TxAckPrevInputWrapper,
- TxAckPrevMeta,
- TxAckPrevOutput,
- TxAckPrevOutputWrapper,
- TxInput,
- TxOutput,
- TxRequest,
- TxRequestDetailsType,
- TxRequestSerializedType,
-)
-
-from apps.bitcoin.keychain import _get_schemas_for_coin
-from apps.bitcoin.sign_tx import bitcoinlike
-from apps.common import coins
-from apps.common.keychain import Keychain
-
-EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray())
-
-
-# https://groestlsight-test.groestlcoin.org/api/tx/4ce0220004bdfe14e3dd49fd8636bcb770a400c0c9e9bff670b6a13bb8f15c72
-@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
-class TestSignSegwitTxP2WPKHInP2SH_GRS(unittest.TestCase):
- # pylint: disable=C0301
-
- def test_send_p2wpkh_in_p2sh(self):
-
- coin = coins.by_name("Groestlcoin Testnet")
- seed = bip39.seed(" ".join(["all"] * 12), "")
-
- inp1 = TxInput(
- # 49'/1'/0'/1/0" - 2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7
- address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
- amount=123456789,
- prev_hash=bytes.fromhex(
- "09a48bce2f9d5c6e4f0cb9ea1b32d0891855e8acfe5334f9ebd72b9ad2de60cf"
- ),
- prev_index=0,
- script_type=InputScriptType.SPENDP2SHWITNESS,
- sequence=0xFFFFFFFE,
- multisig=None,
- )
- ptx1 = PrevTx(
- version=1,
- lock_time=650749,
- inputs_count=1,
- outputs_count=2,
- extra_data_len=0,
- )
- pinp1 = PrevInput(
- script_sig=bytes.fromhex(
- "47304402201f8f57f708144c3a11da322546cb37bd385aa825d940c37e8016f0efd6ec3e9402202a41bc02c29e4f3f13efd4bededbcd4308a6393279111d614ee1f7635cf3e65701210371546a36bdf6bc82087301b3f6e759736dc8790150673d2e7e2715d2ad72f3a4"
- ),
- prev_hash=bytes.fromhex(
- "4f2f857f39ed1afe05542d058fb0be865a387446e32fc876d086203f483f61d1"
- ),
- prev_index=1,
- sequence=4294967294,
- )
- pout1 = PrevOutput(
- script_pubkey=bytes.fromhex(
- "a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87"
- ),
- amount=123456789,
- )
- pout2 = PrevOutput(
- script_pubkey=bytes.fromhex(
- "76a91435528b20e9a793cf2c3a1cf9cff1f2127ad377da88ac"
- ),
- amount=9764242764,
- )
-
- out1 = TxOutput(
- address="mvbu1Gdy8SUjTenqerxUaZyYjmvedc787y",
- amount=12300000,
- script_type=OutputScriptType.PAYTOADDRESS,
- address_n=[],
- multisig=None,
- )
- out2 = TxOutput(
- address="2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7",
- script_type=OutputScriptType.PAYTOADDRESS,
- amount=123456789 - 11000 - 12300000,
- address_n=[],
- multisig=None,
- )
- tx = SignTx(
- coin_name="Groestlcoin Testnet",
- version=1,
- lock_time=650756,
- inputs_count=1,
- outputs_count=2,
- )
-
- # precomputed tx weight is 168 = ceil(670 / 4)
- fee_rate = 11000 / 168
-
- messages = [
- # check fee
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
- ui.confirm_output(
- out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]
- ),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
- ui.confirm_output(
- out2, coin, AmountUnit.BITCOIN, 1, False, [H_(49), H_(1), H_(0)]
- ),
- ui.confirm_nondefault_locktime(tx.lock_time, False),
- ui.confirm_total(
- 123445789 + 11000,
- 11000,
- fee_rate,
- coin,
- AmountUnit.BITCOIN,
- inp1.address_n[:3],
- ),
- # check prev tx
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXMETA,
- details=TxRequestDetailsType(
- request_index=None, tx_hash=inp1.prev_hash
- ),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevMeta(tx=ptx1),
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevInput(tx=TxAckPrevInputWrapper(input=pinp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevOutput(tx=TxAckPrevOutputWrapper(output=pout1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevOutput(tx=TxAckPrevOutputWrapper(output=pout2)),
- # sign tx
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized header
- serialized_tx=bytes.fromhex("01000000000101"),
- ),
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized inp1
- serialized_tx=bytes.fromhex(
- "cf60ded29a2bd7ebf93453feace8551889d0321beab90c4f6e5c9d2fce8ba4090000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5feffffff02"
- ),
- ),
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized out1
- serialized_tx=bytes.fromhex(
- "e0aebb00000000001976a914a579388225827d9f2fe9014add644487808c695d88ac"
- ),
- signature_index=None,
- signature=None,
- ),
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
- # segwit
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized out2
- serialized_tx=bytes.fromhex(
- "3df39f060000000017a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87"
- ),
- signature_index=None,
- signature=None,
- ),
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXFINISHED,
- details=TxRequestDetailsType(),
- serialized=TxRequestSerializedType(
- serialized_tx=bytes.fromhex(
- "02483045022100b7ce2972bcbc3a661fe320ba901e680913b2753fcb47055c9c6ba632fc4acf81022001c3cfd6c2fe92eb60f5176ce0f43707114dd7223da19c56f2df89c13c2fef80012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b7904ee0900"
- ),
- signature_index=0,
- signature=bytes.fromhex(
- "3045022100b7ce2972bcbc3a661fe320ba901e680913b2753fcb47055c9c6ba632fc4acf81022001c3cfd6c2fe92eb60f5176ce0f43707114dd7223da19c56f2df89c13c2fef80"
- ),
- ),
- ),
- ]
-
- ns = _get_schemas_for_coin(coin)
- keychain = Keychain(seed, coin.curve_name, ns)
- signer = bitcoinlike.Bitcoinlike(tx, keychain, coin, None)
- run_signer(self, signer, messages)
-
- def test_send_p2wpkh_in_p2sh_change(self):
-
- coin = coins.by_name("Groestlcoin Testnet")
- seed = bip39.seed(" ".join(["all"] * 12), "")
-
- inp1 = TxInput(
- # 49'/1'/0'/1/0" - 2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7
- address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
- amount=123456789,
- prev_hash=bytes.fromhex(
- "09a48bce2f9d5c6e4f0cb9ea1b32d0891855e8acfe5334f9ebd72b9ad2de60cf"
- ),
- prev_index=0,
- script_type=InputScriptType.SPENDP2SHWITNESS,
- sequence=0xFFFFFFFE,
- multisig=None,
- )
- ptx1 = PrevTx(
- version=1,
- lock_time=650749,
- inputs_count=1,
- outputs_count=2,
- extra_data_len=0,
- )
- pinp1 = PrevInput(
- script_sig=bytes.fromhex(
- "47304402201f8f57f708144c3a11da322546cb37bd385aa825d940c37e8016f0efd6ec3e9402202a41bc02c29e4f3f13efd4bededbcd4308a6393279111d614ee1f7635cf3e65701210371546a36bdf6bc82087301b3f6e759736dc8790150673d2e7e2715d2ad72f3a4"
- ),
- prev_hash=bytes.fromhex(
- "4f2f857f39ed1afe05542d058fb0be865a387446e32fc876d086203f483f61d1"
- ),
- prev_index=1,
- sequence=4294967294,
- )
- pout1 = PrevOutput(
- script_pubkey=bytes.fromhex(
- "a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87"
- ),
- amount=123456789,
- )
- pout2 = PrevOutput(
- script_pubkey=bytes.fromhex(
- "76a91435528b20e9a793cf2c3a1cf9cff1f2127ad377da88ac"
- ),
- amount=9764242764,
- )
-
- out1 = TxOutput(
- address="mvbu1Gdy8SUjTenqerxUaZyYjmvedc787y",
- amount=12300000,
- script_type=OutputScriptType.PAYTOADDRESS,
- address_n=[],
- multisig=None,
- )
- out2 = TxOutput(
- address_n=[49 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 0],
- script_type=OutputScriptType.PAYTOP2SHWITNESS,
- amount=123456789 - 11000 - 12300000,
- address=None,
- multisig=None,
- )
- tx = SignTx(
- coin_name="Groestlcoin Testnet",
- version=1,
- lock_time=650756,
- inputs_count=1,
- outputs_count=2,
- )
-
- # precomputed tx weight is 168 = ceil(670 / 4)
- fee_rate = 11000 / 168
-
- messages = [
- # check fee
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
- ui.confirm_output(
- out1, coin, AmountUnit.BITCOIN, 0, False, [H_(49), H_(1), H_(0)]
- ),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out2)),
- ui.confirm_nondefault_locktime(tx.lock_time, False),
- ui.confirm_total(
- 12300000 + 11000,
- 11000,
- fee_rate,
- coin,
- AmountUnit.BITCOIN,
- inp1.address_n[:3],
- ),
- # check prev tx
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXMETA,
- details=TxRequestDetailsType(
- request_index=None, tx_hash=inp1.prev_hash
- ),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevMeta(tx=ptx1),
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevInput(tx=TxAckPrevInputWrapper(input=pinp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevOutput(tx=TxAckPrevOutputWrapper(output=pout1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=inp1.prev_hash),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevOutput(tx=TxAckPrevOutputWrapper(output=pout2)),
- # sign tx
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized header
- serialized_tx=bytes.fromhex("01000000000101"),
- ),
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized inp1
- serialized_tx=bytes.fromhex(
- "cf60ded29a2bd7ebf93453feace8551889d0321beab90c4f6e5c9d2fce8ba4090000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5feffffff02"
- ),
- ),
- ),
- # the out has to be cloned not to send the same object which was modified
- TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out1.__dict__))),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=1, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized out1
- serialized_tx=bytes.fromhex(
- "e0aebb00000000001976a914a579388225827d9f2fe9014add644487808c695d88ac"
- ),
- signature_index=None,
- signature=None,
- ),
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=TxOutput(**out2.__dict__))),
- # segwit
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- # returned serialized out2
- serialized_tx=bytes.fromhex(
- "3df39f060000000017a91458b53ea7f832e8f096e896b8713a8c6df0e892ca87"
- ),
- signature_index=None,
- signature=None,
- ),
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXFINISHED,
- details=TxRequestDetailsType(),
- serialized=TxRequestSerializedType(
- serialized_tx=bytes.fromhex(
- "02483045022100b7ce2972bcbc3a661fe320ba901e680913b2753fcb47055c9c6ba632fc4acf81022001c3cfd6c2fe92eb60f5176ce0f43707114dd7223da19c56f2df89c13c2fef80012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b7904ee0900"
- ),
- signature_index=0,
- signature=bytes.fromhex(
- "3045022100b7ce2972bcbc3a661fe320ba901e680913b2753fcb47055c9c6ba632fc4acf81022001c3cfd6c2fe92eb60f5176ce0f43707114dd7223da19c56f2df89c13c2fef80"
- ),
- ),
- ),
- ]
-
- ns = _get_schemas_for_coin(coin)
- keychain = Keychain(seed, coin.curve_name, ns)
- signer = bitcoinlike.Bitcoinlike(tx, keychain, coin, None)
- run_signer(self, signer, messages)
-
-
-if __name__ == "__main__":
- unittest.main()
### core/tests/test_apps.bitcoin.signtx_grs.py
@@ -1,212 +0,0 @@
-# flake8: noqa: F403,F405
-from common import * # isort:skip
-
-from trezor.crypto import bip39
-from trezor.enums import AmountUnit, OutputScriptType
-from trezor.enums.RequestType import TXFINISHED, TXINPUT, TXMETA, TXOUTPUT
-from trezor.messages import (
- PrevInput,
- PrevOutput,
- PrevTx,
- SignTx,
- TxAckInput,
- TxAckInputWrapper,
- TxAckOutput,
- TxAckOutputWrapper,
- TxAckPrevInput,
- TxAckPrevInputWrapper,
- TxAckPrevMeta,
- TxAckPrevOutput,
- TxAckPrevOutputWrapper,
- TxInput,
- TxOutput,
- TxRequest,
- TxRequestDetailsType,
- TxRequestSerializedType,
-)
-
-from apps.bitcoin.keychain import _get_schemas_for_coin
-from apps.bitcoin.sign_tx import bitcoinlike
-from apps.common import coins
-from apps.common.keychain import Keychain
-
-EMPTY_SERIALIZED = TxRequestSerializedType(serialized_tx=bytearray())
-
-
-@unittest.skipUnless(not utils.BITCOIN_ONLY, "altcoin")
-class TestSignTx_GRS(unittest.TestCase):
- # pylint: disable=C0301
-
- def test_one_one_fee(self):
- # http://groestlsight.groestlcoin.org/tx/f56521b17b828897f72b30dd21b0192fd942342e89acbb06abf1d446282c30f5
- # ptx1: http://groestlsight.groestlcoin.org/api/tx/cb74c8478c5814742c87cffdb4a21231869888f8042fb07a90e015a9db1f9d4a
-
- coin = coins.by_name("Groestlcoin")
-
- ptx1 = PrevTx(
- version=1,
- lock_time=2160993,
- inputs_count=1,
- outputs_count=1,
- extra_data_len=0,
- )
- pinp1 = PrevInput(
- script_sig=bytes.fromhex(
- "48304502210096a287593b1212a188e778596eb8ecd4cc169b93a4d115226460d8e3deae431c02206c78ec09b3df977f04a6df5eb53181165c4ea5a0b35f826551349130f879d6b8012102cf5126ff54e38a80a919579d7091cafe24840eab1d30fe2b4d59bdd9d267cad8"
- ),
- prev_hash=bytes.fromhex(
- "7dc74a738c50c2ae1228ce9890841e5355fd6d7f2c1367e0a74403ab60db3224"
- ),
- prev_index=0,
- sequence=4294967294,
- )
- pout1 = PrevOutput(
- script_pubkey=bytes.fromhex(
- "76a914172b4e06e9b7881a48d2ee8062b495d0b2517fe888ac"
- ),
- amount=210016,
- )
-
- inp1 = TxInput(
- address_n=[
- 44 | 0x80000000,
- 17 | 0x80000000,
- 0 | 0x80000000,
- 0,
- 2,
- ], # FXHDsC5ZqWQHkDmShzgRVZ1MatpWhwxTAA
- prev_hash=bytes.fromhex(
- "cb74c8478c5814742c87cffdb4a21231869888f8042fb07a90e015a9db1f9d4a"
- ),
- prev_index=0,
- amount=210016,
- )
- out1 = TxOutput(
- address="FtM4zAn9aVYgHgxmamWBgWPyZsb6RhvkA9",
- amount=210016 - 192,
- script_type=OutputScriptType.PAYTOADDRESS,
- address_n=[],
- )
- tx = SignTx(
- coin_name="Groestlcoin",
- version=1,
- lock_time=0,
- inputs_count=1,
- outputs_count=1,
- )
-
- # precomputed tx weight is 768
- fee_rate = 192 / (768 / 4)
-
- messages = [
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
- ui.confirm_output(
- out1, coin, AmountUnit.BITCOIN, 0, False, [H_(44), H_(17), H_(0)]
- ),
- ui.confirm_total(
- 210016, 192, fee_rate, coin, AmountUnit.BITCOIN, inp1.address_n[:3]
- ),
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXMETA,
- details=TxRequestDetailsType(
- request_index=None,
- tx_hash=bytes.fromhex(
- "cb74c8478c5814742c87cffdb4a21231869888f8042fb07a90e015a9db1f9d4a"
- ),
- ),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevMeta(tx=ptx1),
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(
- request_index=0,
- tx_hash=bytes.fromhex(
- "cb74c8478c5814742c87cffdb4a21231869888f8042fb07a90e015a9db1f9d4a"
- ),
- ),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevInput(tx=TxAckPrevInputWrapper(input=pinp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(
- request_index=0,
- tx_hash=bytes.fromhex(
- "cb74c8478c5814742c87cffdb4a21231869888f8042fb07a90e015a9db1f9d4a"
- ),
- ),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckPrevOutput(tx=TxAckPrevOutputWrapper(output=pout1)),
- # ButtonRequest(code=ButtonRequest_ConfirmOutput),
- # ButtonRequest(code=ButtonRequest_SignTx),
- TxRequest(
- request_type=TXINPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- signature_index=None,
- signature=None,
- serialized_tx=bytes.fromhex("0100000001"),
- ),
- ),
- TxAckInput(tx=TxAckInputWrapper(input=inp1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=EMPTY_SERIALIZED,
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
- TxRequest(
- request_type=TXOUTPUT,
- details=TxRequestDetailsType(request_index=0, tx_hash=None),
- serialized=TxRequestSerializedType(
- signature_index=0,
- signature=bytes.fromhex(
- "304402201fb96d20d0778f54520ab59afe70d5fb20e500ecc9f02281cf57934e8029e8e10220383d5a3e80f2e1eb92765b6da0f23d454aecbd8236f083d483e9a74302368761"
- ),
- serialized_tx=bytes.fromhex(
- "4a9d1fdba915e0907ab02f04f88898863112a2b4fdcf872c7414588c47c874cb000000006a47304402201fb96d20d0778f54520ab59afe70d5fb20e500ecc9f02281cf57934e8029e8e10220383d5a3e80f2e1eb92765b6da0f23d454aecbd8236f083d483e9a7430236876101210331693756f749180aeed0a65a0fab0625a2250bd9abca502282a4cf0723152e67ffffffff01"
- ),
- ),
- ),
- TxAckOutput(tx=TxAckOutputWrapper(output=out1)),
- TxRequest(
- request_type=TXFINISHED,
- details=TxRequestDetailsType(),
- serialized=TxRequestSerializedType(
- signature_index=None,
- signature=None,
- serialized_tx=bytes.fromhex(
- "a0330300000000001976a914fe40329c95c5598ac60752a5310b320cb52d18e688ac00000000"
- ),
- ),
- ),
- ]
-
- seed = bip39.seed(" ".join(["all"] * 12), "")
- ns = _get_schemas_for_coin(coin)
- keychain = Keychain(seed, coin.curve_name, ns)
- signer = bitcoinlike.Bitcoinlike(tx, keychain, coin, None)
- run_signer(self, signer, messages)
-
-
-if __name__ == "__main__":
- unittest.main()
### core/tests/test_trezor.crypto.hashlib.groestl512.py
@@ -1,80 +0,0 @@
-# flake8: noqa: F403,F405
-from common import * # isort:skip
-
-from trezor.crypto import hashlib
-
-
-class TestCryptoGroestl512(unittest.TestCase):
- # vectors from www.groestl.info/Groestl.zip #/KAT_MCT/*
- vectors = [
- (
- b"",
- "6D3AD29D279110EEF3ADBD66DE2A0345A77BAEDE1557F5D099FCE0C03D6DC2BA8E6D4A6633DFBD66053C20FAA87D1A11F39A7FBE4A6C2F009801370308FC4AD8",
- ),
- (
- bytes.fromhex("C1ECFDFC"),
- "4726D760203C1EAF847F6837C74C16ADCEF5B55EAD5768A7C13E21A33D0D7B740F52DE8C81356DA63DABA791DA6680AF015DEB81246550201F232822BB087CE5",
- ),
- (
- bytes.fromhex("82E192E4043DDCD12ECF52969D0F807EED"),
- "8CD831960FE9726055F7B3693CC5639DB7D01EDDA045AE41E877853111C4CF53D26D5B4E135118571721C247ACA6607979A4DF73849D1477365F7DB0149FBC9F",
- ),
- (
- bytes.fromhex(
- "F5961DFD2B1FFFFDA4FFBF30560C165BFEDAB8CE0BE525845DEB8DC61004B7DB38467205F5DCFB34A2ACFE96C0"
- ),
- "CE24486770D443B423274DD30AF746EA4080065393D13DF0535709E260CF14B033CCD190A9FA5F81705178EB656031A6F1465A5A993BE62BE8D43931950BD5DB",
- ),
- (
- bytes.fromhex(
- "2B6DB7CED8665EBE9DEB080295218426BDAA7C6DA9ADD2088932CDFFBAA1C14129BCCDD70F369EFB149285858D2B1D155D14DE2FDB680A8B027284055182A0CAE275234CC9C92863C1B4AB66F304CF0621CD54565F5BFF461D3B461BD40DF28198E3732501B4860EADD503D26D6E69338F4E0456E9E9BAF3D827AE685FB1D817"
- ),
- "FF410B511135DBC0B8644C28EFA3EC632326FEB98E50EDC6390C441610D7C514ACDF0A61A0BF01AA9DC1F55D92E085248EBA1C24EE23978B4986AF41C13A6176",
- ),
- (
- bytes.fromhex(
- "EECBB8FDFA4DA62170FD06727F697D81F83F601FF61E478105D3CB7502F2C89BF3E8F56EDD469D049807A38882A7EEFBC85FC9A950952E9FA84B8AFEBD3CE782D4DA598002827B1EB98882EA1F0A8F7AA9CE013A6E9BC462FB66C8D4A18DA21401E1B93356EB12F3725B6DB1684F2300A98B9A119E5D27FF704AFFB618E12708E77E6E5F34139A5A41131FD1D6336C272A8FC37080F041C71341BEE6AB550CB4A20A6DDB6A8E0299F2B14BC730C54B8B1C1C487B494BDCCFD3A53535AB2F231590BF2C4062FD2AD58F906A2D0D"
- ),
- "3AE2AABD659C5844C923FD171CA36431A7E606ECA52A21B96A0F5E8CD1FA24141BEDAADF58608781DFABC103FE929CD2EADE8D6FBD6185D4F4B855DCA610D7A0",
- ),
- (
- bytes.fromhex(
- "724627916C50338643E6996F07877EAFD96BDF01DA7E991D4155B9BE1295EA7D21C9391F4C4A41C75F77E5D27389253393725F1427F57914B273AB862B9E31DABCE506E558720520D33352D119F699E784F9E548FF91BC35CA147042128709820D69A8287EA3257857615EB0321270E94B84F446942765CE882B191FAEE7E1C87E0F0BD4E0CD8A927703524B559B769CA4ECE1F6DBF313FDCF67C572EC4185C1A88E86EC11B6454B371980020F19633B6B95BD280E4FBCB0161E1A82470320CEC6ECFA25AC73D09F1536F286D3F9DACAFB2CD1D0CE72D64D197F5C7520B3CCB2FD74EB72664BA93853EF41EABF52F015DD591500D018DD162815CC993595B195"
- ),
- "F88E8E86FBE2200E90226A181E48348E06D1643270C079B8BDD3660E8D21CD0493C55051CBFA607B1CFACA2C5A2C9354CDD405C1D3AD1D8435B825884CC0559F",
- ),
- (
- bytes.fromhex(
- "D0FF6E045F4B636F75A389799F314066644854821B6E7AE4047ADFDE2D0C0E02C250F0BE582BEC94011189B964A8AF430F5921ED9D9F4446E4C788515B89CA69E5F7CDFCCC9E83E8F9460145B43DDC41C07CC512B7E6FDD0E1E7AABA29A6C016CCB7BD54B145F3951EAB9BC4908F623E5A9B0C5B36056292540B79FD15C53457DC74A65FD773A34D6B313A056F79BC29A3FAC15F6A1446BFAEEAAFBAC8ECF8168DDE5F6AE6B6E579BD3CE74E7ABFADF361D0FD32D56586A8D2D4FF4CFDF8A750FAFDE4C2E9EB32B06847FA30B13CC273532D1A23C8257F80C60B8FA94FA976F534145CD61C41C0A511B62CADD5848CEFF643F83CE43F8E6969C5A559AFAD60E310599A34B2E5E029FBDDF2988FCE59269C7128A1FC79A74B154D8AA2850DCFDBF594684E74099E37882B440367C1DD3003F61CAFB46AC75D30E677AF54559A5DAB70C506CF61A9C35E0E56E1430746916DDEEC8D89B0C10DAA02C5D7E9F42621D2B312EAFFC9FF306297952A32D26C2148570AEC90501CA739CE5E689E7066D9580A4FC25E2023897C74C6856273133E1275A0D275DC5B75DB724CD12C9C01BB95AB5A227B7850020630506096878D289923177183EA9282A4C78EC212D2E898CB99D81A3364DF20927EE34D4475A5CF5CDB24088ED75B60201922E9C972D8556CA75F8274D15F3FB88A6B42C766DEF6B21329DEE7C457446DDE8C26405FE5D0309A04229F449E8490CF9000EE8DF400CB7C7EE831BD7059D24088FB42D61681CDE45050FCA78FF64D9C8D1F58B55F802FA5D2F2E723F3E4EED4338B060D31C8ACC46D26870BD45D0DE0798D48E32AAD1A6D4322E69F5E72309B9D7FA1F24BB1D63FF09ED47391C232497BF222C542A70975C8292D275197A4CA"
- ),
- "27AB9EA01D8FD80ED14990761ED6BC329DC842770F83FDD1CE95C0A074D6D7495C7C85297CC73F3A695377E4211F897F68C1A7F910F6BF440264FB63F120ABA2",
- ),
- ]
-
- def test_digest(self):
- for b, d in self.vectors:
- self.assertEqual(hashlib.groestl512(b).digest(), bytes.fromhex(d))
-
- def test_update(self):
- for b, d in self.vectors:
- x = hashlib.groestl512()
- x.update(b)
- self.assertEqual(x.digest(), bytes.fromhex(d))
-
- # Test from ExtremelyLongMsgKAT_512.txt, disabled by default because it resource-expensive
- # x = hashlib.groestl512()
- # for i in range(16777216):
- # x.update(b'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno')
- # self.assertEqual(x.digest(), bytes.fromhex('787C88460E5D09ABD7A98C050F3422BBFDBD36A74B05DE04B57A13FA3F36A570B8561580AB9DA4096CCD5111B5DE948F769D9D61833A6CE2B2F223061E688994'))
-
- def test_digest_multi(self):
- x = hashlib.groestl512()
- d0 = x.digest()
- d1 = x.digest()
- d2 = x.digest()
- self.assertEqual(d0, d1)
- self.assertEqual(d0, d2)
-
-
-if __name__ == "__main__":
- unittest.main()
### crypto/LICENSE
@@ -253,36 +253,6 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. Use this program at your own risk!
---------------------------------------------------------------------------------
-Groestl -- Projet RNRT SAPHIR (sphlib)
-https://github.com/Groestlcoin/vanitygen
-Trezor adaptation by Yura Pakhuchiy <pakhuchiy@gmail.com>
-
-Files: groestl.c, groestl.h, groestl_internal.h
---------------------------------------------------------------------------------
-
-Copyright (c) 2007-2010 Projet RNRT SAPHIR
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
--------------------------------------------------------------------------------
Shamir secret sharing (sss) -- Daan Sprenkels
https://github.com/dsprenkels/sss
### crypto/Makefile
@@ -116,7 +116,6 @@ SRCS += noise_xxpsk3.c
SRCS += blake256.c
SRCS += blake2b.c blake2s.c
SRCS += chacha_drbg.c
-SRCS += groestl.c
SRCS += chacha20poly1305/chacha20poly1305.c chacha20poly1305/chacha_merged.c chacha20poly1305/poly1305-donna.c chacha20poly1305/rfc7539.c
SRCS += rc4.c
SRCS += segwit_addr.c cash_addr.c
### crypto/bip32.c
@@ -694,9 +694,6 @@ const curve_info *get_curve_by_name(const char *curve_name) {
if (strcmp(curve_name, SECP256K1_DECRED_NAME) == 0) {
return &secp256k1_decred_info;
}
- if (strcmp(curve_name, SECP256K1_GROESTL_NAME) == 0) {
- return &secp256k1_groestl_info;
- }
if (strcmp(curve_name, SECP256K1_SMART_NAME) == 0) {
return &secp256k1_smart_info;
}
### crypto/curves.c
@@ -24,7 +24,6 @@
const char SECP256K1_NAME[] = "secp256k1";
const char SECP256K1_DECRED_NAME[] = "secp256k1-decred";
-const char SECP256K1_GROESTL_NAME[] = "secp256k1-groestl";
const char SECP256K1_SMART_NAME[] = "secp256k1-smart";
const char NIST256P1_NAME[] = "nist256p1";
const char ED25519_NAME[] = "ed25519";
### crypto/curves.h
@@ -27,7 +27,6 @@
extern const char SECP256K1_NAME[];
extern const char SECP256K1_DECRED_NAME[];
-extern const char SECP256K1_GROESTL_NAME[];
extern const char SECP256K1_SMART_NAME[];
extern const char NIST256P1_NAME[];
extern const char ED25519_NAME[];
### crypto/fuzzer/fuzzer.c
@@ -345,8 +345,6 @@ int fuzz_base58_encode_check(void) {
// run multiple hasher variants for the same input
base58_encode_check(in_buffer, raw_inlen, HASHER_SHA2D, out_buffer, outlen);
base58_encode_check(in_buffer, raw_inlen, HASHER_BLAKED, out_buffer, outlen);
- base58_encode_check(in_buffer, raw_inlen, HASHER_GROESTLD_TRUNC, out_buffer,
- outlen);
ret = base58_encode_check(in_buffer, raw_inlen, HASHER_SHA3K, out_buffer,
outlen);
@@ -382,8 +380,6 @@ int fuzz_base58_decode_check(void) {
// run multiple hasher variants for the same input
base58_decode_check(in_char, HASHER_SHA2D, out_buffer, MAX_ADDR_RAW_SIZE);
base58_decode_check(in_char, HASHER_BLAKED, out_buffer, MAX_ADDR_RAW_SIZE);
- base58_decode_check(in_char, HASHER_GROESTLD_TRUNC, out_buffer,
- MAX_ADDR_RAW_SIZE);
base58_decode_check(in_char, HASHER_SHA3K, out_buffer, MAX_ADDR_RAW_SIZE);
check_msan(out_buffer, MAX_ADDR_RAW_SIZE);
### crypto/groestl.c
@@ -1,533 +0,0 @@
-/* Groestl hash from https://github.com/Groestlcoin/vanitygen
- * Trezor adaptation by Yura Pakhuchiy <pakhuchiy@gmail.com>. */
-/*
- * Groestl implementation.
- *
- * ==========================(LICENSE BEGIN)============================
- *
- * Copyright (c) 2007-2010 Projet RNRT SAPHIR
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * ===========================(LICENSE END)=============================
- *
- * @author Thomas Pornin <thomas.pornin@cryptolog.com>
- */
-
-#include <stddef.h>
-#include <string.h>
-
-#include "groestl.h"
-#include "groestl_internal.h"
-#include "memzero.h"
-
-#define C32e(x) \
- ((SPH_C32(x) >> 24) | ((SPH_C32(x) >> 8) & SPH_C32(0x0000FF00)) | \
- ((SPH_C32(x) << 8) & SPH_C32(0x00FF0000)) | \
- ((SPH_C32(x) << 24) & SPH_C32(0xFF000000)))
-#define dec32e_aligned sph_dec32le_aligned
-#define enc32e sph_enc32le
-#define B32_0(x) ((x) & 0xFF)
-#define B32_1(x) (((x) >> 8) & 0xFF)
-#define B32_2(x) (((x) >> 16) & 0xFF)
-#define B32_3(x) ((x) >> 24)
-
-#define R32u(u, d) SPH_T32(((u) << 16) | ((d) >> 16))
-#define R32d(u, d) SPH_T32(((u) >> 16) | ((d) << 16))
-
-#define PC32up(j, r) ((sph_u32)((j) + (r)))
-#define PC32dn(j, r) 0
-#define QC32up(j, r) SPH_C32(0xFFFFFFFF)
-#define QC32dn(j, r) (((sph_u32)(r) << 24) ^ SPH_T32(~((sph_u32)(j) << 24)))
-
-static const sph_u32 T0up[] = {
- C32e(0xc632f4a5), C32e(0xf86f9784), C32e(0xee5eb099), C32e(0xf67a8c8d),
- C32e(0xffe8170d), C32e(0xd60adcbd), C32e(0xde16c8b1), C32e(0x916dfc54),
- C32e(0x6090f050), C32e(0x02070503), C32e(0xce2ee0a9), C32e(0x56d1877d),
- C32e(0xe7cc2b19), C32e(0xb513a662), C32e(0x4d7c31e6), C32e(0xec59b59a),
- C32e(0x8f40cf45), C32e(0x1fa3bc9d), C32e(0x8949c040), C32e(0xfa689287),
- C32e(0xefd03f15), C32e(0xb29426eb), C32e(0x8ece40c9), C32e(0xfbe61d0b),
- C32e(0x416e2fec), C32e(0xb31aa967), C32e(0x5f431cfd), C32e(0x456025ea),
- C32e(0x23f9dabf), C32e(0x535102f7), C32e(0xe445a196), C32e(0x9b76ed5b),
- C32e(0x75285dc2), C32e(0xe1c5241c), C32e(0x3dd4e9ae), C32e(0x4cf2be6a),
- C32e(0x6c82ee5a), C32e(0x7ebdc341), C32e(0xf5f30602), C32e(0x8352d14f),
- C32e(0x688ce45c), C32e(0x515607f4), C32e(0xd18d5c34), C32e(0xf9e11808),
- C32e(0xe24cae93), C32e(0xab3e9573), C32e(0x6297f553), C32e(0x2a6b413f),
- C32e(0x081c140c), C32e(0x9563f652), C32e(0x46e9af65), C32e(0x9d7fe25e),
- C32e(0x30487828), C32e(0x37cff8a1), C32e(0x0a1b110f), C32e(0x2febc4b5),
- C32e(0x0e151b09), C32e(0x247e5a36), C32e(0x1badb69b), C32e(0xdf98473d),
- C32e(0xcda76a26), C32e(0x4ef5bb69), C32e(0x7f334ccd), C32e(0xea50ba9f),
- C32e(0x123f2d1b), C32e(0x1da4b99e), C32e(0x58c49c74), C32e(0x3446722e),
- C32e(0x3641772d), C32e(0xdc11cdb2), C32e(0xb49d29ee), C32e(0x5b4d16fb),
- C32e(0xa4a501f6), C32e(0x76a1d74d), C32e(0xb714a361), C32e(0x7d3449ce),
- C32e(0x52df8d7b), C32e(0xdd9f423e), C32e(0x5ecd9371), C32e(0x13b1a297),
- C32e(0xa6a204f5), C32e(0xb901b868), C32e(0x00000000), C32e(0xc1b5742c),
- C32e(0x40e0a060), C32e(0xe3c2211f), C32e(0x793a43c8), C32e(0xb69a2ced),
- C32e(0xd40dd9be), C32e(0x8d47ca46), C32e(0x671770d9), C32e(0x72afdd4b),
- C32e(0x94ed79de), C32e(0x98ff67d4), C32e(0xb09323e8), C32e(0x855bde4a),
- C32e(0xbb06bd6b), C32e(0xc5bb7e2a), C32e(0x4f7b34e5), C32e(0xedd73a16),
- C32e(0x86d254c5), C32e(0x9af862d7), C32e(0x6699ff55), C32e(0x11b6a794),
- C32e(0x8ac04acf), C32e(0xe9d93010), C32e(0x040e0a06), C32e(0xfe669881),
- C32e(0xa0ab0bf0), C32e(0x78b4cc44), C32e(0x25f0d5ba), C32e(0x4b753ee3),
- C32e(0xa2ac0ef3), C32e(0x5d4419fe), C32e(0x80db5bc0), C32e(0x0580858a),
- C32e(0x3fd3ecad), C32e(0x21fedfbc), C32e(0x70a8d848), C32e(0xf1fd0c04),
- C32e(0x63197adf), C32e(0x772f58c1), C32e(0xaf309f75), C32e(0x42e7a563),
- C32e(0x20705030), C32e(0xe5cb2e1a), C32e(0xfdef120e), C32e(0xbf08b76d),
- C32e(0x8155d44c), C32e(0x18243c14), C32e(0x26795f35), C32e(0xc3b2712f),
- C32e(0xbe8638e1), C32e(0x35c8fda2), C32e(0x88c74fcc), C32e(0x2e654b39),
- C32e(0x936af957), C32e(0x55580df2), C32e(0xfc619d82), C32e(0x7ab3c947),
- C32e(0xc827efac), C32e(0xba8832e7), C32e(0x324f7d2b), C32e(0xe642a495),
- C32e(0xc03bfba0), C32e(0x19aab398), C32e(0x9ef668d1), C32e(0xa322817f),
- C32e(0x44eeaa66), C32e(0x54d6827e), C32e(0x3bdde6ab), C32e(0x0b959e83),
- C32e(0x8cc945ca), C32e(0xc7bc7b29), C32e(0x6b056ed3), C32e(0x286c443c),
- C32e(0xa72c8b79), C32e(0xbc813de2), C32e(0x1631271d), C32e(0xad379a76),
- C32e(0xdb964d3b), C32e(0x649efa56), C32e(0x74a6d24e), C32e(0x1436221e),
- C32e(0x92e476db), C32e(0x0c121e0a), C32e(0x48fcb46c), C32e(0xb88f37e4),
- C32e(0x9f78e75d), C32e(0xbd0fb26e), C32e(0x43692aef), C32e(0xc435f1a6),
- C32e(0x39dae3a8), C32e(0x31c6f7a4), C32e(0xd38a5937), C32e(0xf274868b),
- C32e(0xd5835632), C32e(0x8b4ec543), C32e(0x6e85eb59), C32e(0xda18c2b7),
- C32e(0x018e8f8c), C32e(0xb11dac64), C32e(0x9cf16dd2), C32e(0x49723be0),
- C32e(0xd81fc7b4), C32e(0xacb915fa), C32e(0xf3fa0907), C32e(0xcfa06f25),
- C32e(0xca20eaaf), C32e(0xf47d898e), C32e(0x476720e9), C32e(0x10382818),
- C32e(0x6f0b64d5), C32e(0xf0738388), C32e(0x4afbb16f), C32e(0x5cca9672),
- C32e(0x38546c24), C32e(0x575f08f1), C32e(0x732152c7), C32e(0x9764f351),
- C32e(0xcbae6523), C32e(0xa125847c), C32e(0xe857bf9c), C32e(0x3e5d6321),
- C32e(0x96ea7cdd), C32e(0x611e7fdc), C32e(0x0d9c9186), C32e(0x0f9b9485),
- C32e(0xe04bab90), C32e(0x7cbac642), C32e(0x712657c4), C32e(0xcc29e5aa),
- C32e(0x90e373d8), C32e(0x06090f05), C32e(0xf7f40301), C32e(0x1c2a3612),
- C32e(0xc23cfea3), C32e(0x6a8be15f), C32e(0xaebe10f9), C32e(0x69026bd0),
- C32e(0x17bfa891), C32e(0x9971e858), C32e(0x3a536927), C32e(0x27f7d0b9),
- C32e(0xd9914838), C32e(0xebde3513), C32e(0x2be5ceb3), C32e(0x22775533),
- C32e(0xd204d6bb), C32e(0xa9399070), C32e(0x07878089), C32e(0x33c1f2a7),
- C32e(0x2decc1b6), C32e(0x3c5a6622), C32e(0x15b8ad92), C32e(0xc9a96020),
- C32e(0x875cdb49), C32e(0xaab01aff), C32e(0x50d88878), C32e(0xa52b8e7a),
- C32e(0x03898a8f), C32e(0x594a13f8), C32e(0x09929b80), C32e(0x1a233917),
- C32e(0x651075da), C32e(0xd7845331), C32e(0x84d551c6), C32e(0xd003d3b8),
- C32e(0x82dc5ec3), C32e(0x29e2cbb0), C32e(0x5ac39977), C32e(0x1e2d3311),
- C32e(0x7b3d46cb), C32e(0xa8b71ffc), C32e(0x6d0c61d6), C32e(0x2c624e3a)};
-
-static const sph_u32 T0dn[] = {
- C32e(0xf497a5c6), C32e(0x97eb84f8), C32e(0xb0c799ee), C32e(0x8cf78df6),
- C32e(0x17e50dff), C32e(0xdcb7bdd6), C32e(0xc8a7b1de), C32e(0xfc395491),
- C32e(0xf0c05060), C32e(0x05040302), C32e(0xe087a9ce), C32e(0x87ac7d56),
- C32e(0x2bd519e7), C32e(0xa67162b5), C32e(0x319ae64d), C32e(0xb5c39aec),
- C32e(0xcf05458f), C32e(0xbc3e9d1f), C32e(0xc0094089), C32e(0x92ef87fa),
- C32e(0x3fc515ef), C32e(0x267febb2), C32e(0x4007c98e), C32e(0x1ded0bfb),
- C32e(0x2f82ec41), C32e(0xa97d67b3), C32e(0x1cbefd5f), C32e(0x258aea45),
- C32e(0xda46bf23), C32e(0x02a6f753), C32e(0xa1d396e4), C32e(0xed2d5b9b),
- C32e(0x5deac275), C32e(0x24d91ce1), C32e(0xe97aae3d), C32e(0xbe986a4c),
- C32e(0xeed85a6c), C32e(0xc3fc417e), C32e(0x06f102f5), C32e(0xd11d4f83),
- C32e(0xe4d05c68), C32e(0x07a2f451), C32e(0x5cb934d1), C32e(0x18e908f9),
- C32e(0xaedf93e2), C32e(0x954d73ab), C32e(0xf5c45362), C32e(0x41543f2a),
- C32e(0x14100c08), C32e(0xf6315295), C32e(0xaf8c6546), C32e(0xe2215e9d),
- C32e(0x78602830), C32e(0xf86ea137), C32e(0x11140f0a), C32e(0xc45eb52f),
- C32e(0x1b1c090e), C32e(0x5a483624), C32e(0xb6369b1b), C32e(0x47a53ddf),
- C32e(0x6a8126cd), C32e(0xbb9c694e), C32e(0x4cfecd7f), C32e(0xbacf9fea),
- C32e(0x2d241b12), C32e(0xb93a9e1d), C32e(0x9cb07458), C32e(0x72682e34),
- C32e(0x776c2d36), C32e(0xcda3b2dc), C32e(0x2973eeb4), C32e(0x16b6fb5b),
- C32e(0x0153f6a4), C32e(0xd7ec4d76), C32e(0xa37561b7), C32e(0x49face7d),
- C32e(0x8da47b52), C32e(0x42a13edd), C32e(0x93bc715e), C32e(0xa2269713),
- C32e(0x0457f5a6), C32e(0xb86968b9), C32e(0x00000000), C32e(0x74992cc1),
- C32e(0xa0806040), C32e(0x21dd1fe3), C32e(0x43f2c879), C32e(0x2c77edb6),
- C32e(0xd9b3bed4), C32e(0xca01468d), C32e(0x70ced967), C32e(0xdde44b72),
- C32e(0x7933de94), C32e(0x672bd498), C32e(0x237be8b0), C32e(0xde114a85),
- C32e(0xbd6d6bbb), C32e(0x7e912ac5), C32e(0x349ee54f), C32e(0x3ac116ed),
- C32e(0x5417c586), C32e(0x622fd79a), C32e(0xffcc5566), C32e(0xa7229411),
- C32e(0x4a0fcf8a), C32e(0x30c910e9), C32e(0x0a080604), C32e(0x98e781fe),
- C32e(0x0b5bf0a0), C32e(0xccf04478), C32e(0xd54aba25), C32e(0x3e96e34b),
- C32e(0x0e5ff3a2), C32e(0x19bafe5d), C32e(0x5b1bc080), C32e(0x850a8a05),
- C32e(0xec7ead3f), C32e(0xdf42bc21), C32e(0xd8e04870), C32e(0x0cf904f1),
- C32e(0x7ac6df63), C32e(0x58eec177), C32e(0x9f4575af), C32e(0xa5846342),
- C32e(0x50403020), C32e(0x2ed11ae5), C32e(0x12e10efd), C32e(0xb7656dbf),
- C32e(0xd4194c81), C32e(0x3c301418), C32e(0x5f4c3526), C32e(0x719d2fc3),
- C32e(0x3867e1be), C32e(0xfd6aa235), C32e(0x4f0bcc88), C32e(0x4b5c392e),
- C32e(0xf93d5793), C32e(0x0daaf255), C32e(0x9de382fc), C32e(0xc9f4477a),
- C32e(0xef8bacc8), C32e(0x326fe7ba), C32e(0x7d642b32), C32e(0xa4d795e6),
- C32e(0xfb9ba0c0), C32e(0xb3329819), C32e(0x6827d19e), C32e(0x815d7fa3),
- C32e(0xaa886644), C32e(0x82a87e54), C32e(0xe676ab3b), C32e(0x9e16830b),
- C32e(0x4503ca8c), C32e(0x7b9529c7), C32e(0x6ed6d36b), C32e(0x44503c28),
- C32e(0x8b5579a7), C32e(0x3d63e2bc), C32e(0x272c1d16), C32e(0x9a4176ad),
- C32e(0x4dad3bdb), C32e(0xfac85664), C32e(0xd2e84e74), C32e(0x22281e14),
- C32e(0x763fdb92), C32e(0x1e180a0c), C32e(0xb4906c48), C32e(0x376be4b8),
- C32e(0xe7255d9f), C32e(0xb2616ebd), C32e(0x2a86ef43), C32e(0xf193a6c4),
- C32e(0xe372a839), C32e(0xf762a431), C32e(0x59bd37d3), C32e(0x86ff8bf2),
- C32e(0x56b132d5), C32e(0xc50d438b), C32e(0xebdc596e), C32e(0xc2afb7da),
- C32e(0x8f028c01), C32e(0xac7964b1), C32e(0x6d23d29c), C32e(0x3b92e049),
- C32e(0xc7abb4d8), C32e(0x1543faac), C32e(0x09fd07f3), C32e(0x6f8525cf),
- C32e(0xea8fafca), C32e(0x89f38ef4), C32e(0x208ee947), C32e(0x28201810),
- C32e(0x64ded56f), C32e(0x83fb88f0), C32e(0xb1946f4a), C32e(0x96b8725c),
- C32e(0x6c702438), C32e(0x08aef157), C32e(0x52e6c773), C32e(0xf3355197),
- C32e(0x658d23cb), C32e(0x84597ca1), C32e(0xbfcb9ce8), C32e(0x637c213e),
- C32e(0x7c37dd96), C32e(0x7fc2dc61), C32e(0x911a860d), C32e(0x941e850f),
- C32e(0xabdb90e0), C32e(0xc6f8427c), C32e(0x57e2c471), C32e(0xe583aacc),
- C32e(0x733bd890), C32e(0x0f0c0506), C32e(0x03f501f7), C32e(0x3638121c),
- C32e(0xfe9fa3c2), C32e(0xe1d45f6a), C32e(0x1047f9ae), C32e(0x6bd2d069),
- C32e(0xa82e9117), C32e(0xe8295899), C32e(0x6974273a), C32e(0xd04eb927),
- C32e(0x48a938d9), C32e(0x35cd13eb), C32e(0xce56b32b), C32e(0x55443322),
- C32e(0xd6bfbbd2), C32e(0x904970a9), C32e(0x800e8907), C32e(0xf266a733),
- C32e(0xc15ab62d), C32e(0x6678223c), C32e(0xad2a9215), C32e(0x608920c9),
- C32e(0xdb154987), C32e(0x1a4fffaa), C32e(0x88a07850), C32e(0x8e517aa5),
- C32e(0x8a068f03), C32e(0x13b2f859), C32e(0x9b128009), C32e(0x3934171a),
- C32e(0x75cada65), C32e(0x53b531d7), C32e(0x5113c684), C32e(0xd3bbb8d0),
- C32e(0x5e1fc382), C32e(0xcb52b029), C32e(0x99b4775a), C32e(0x333c111e),
- C32e(0x46f6cb7b), C32e(0x1f4bfca8), C32e(0x61dad66d), C32e(0x4e583a2c)};
-
-static const sph_u32 T1up[] = {
- C32e(0xc6c632f4), C32e(0xf8f86f97), C32e(0xeeee5eb0), C32e(0xf6f67a8c),
- C32e(0xffffe817), C32e(0xd6d60adc), C32e(0xdede16c8), C32e(0x91916dfc),
- C32e(0x606090f0), C32e(0x02020705), C32e(0xcece2ee0), C32e(0x5656d187),
- C32e(0xe7e7cc2b), C32e(0xb5b513a6), C32e(0x4d4d7c31), C32e(0xecec59b5),
- C32e(0x8f8f40cf), C32e(0x1f1fa3bc), C32e(0x898949c0), C32e(0xfafa6892),
- C32e(0xefefd03f), C32e(0xb2b29426), C32e(0x8e8ece40), C32e(0xfbfbe61d),
- C32e(0x41416e2f), C32e(0xb3b31aa9), C32e(0x5f5f431c), C32e(0x45456025),
- C32e(0x2323f9da), C32e(0x53535102), C32e(0xe4e445a1), C32e(0x9b9b76ed),
- C32e(0x7575285d), C32e(0xe1e1c524), C32e(0x3d3dd4e9), C32e(0x4c4cf2be),
- C32e(0x6c6c82ee), C32e(0x7e7ebdc3), C32e(0xf5f5f306), C32e(0x838352d1),
- C32e(0x68688ce4), C32e(0x51515607), C32e(0xd1d18d5c), C32e(0xf9f9e118),
- C32e(0xe2e24cae), C32e(0xabab3e95), C32e(0x626297f5), C32e(0x2a2a6b41),
- C32e(0x08081c14), C32e(0x959563f6), C32e(0x4646e9af), C32e(0x9d9d7fe2),
- C32e(0x30304878), C32e(0x3737cff8), C32e(0x0a0a1b11), C32e(0x2f2febc4),
- C32e(0x0e0e151b), C32e(0x24247e5a), C32e(0x1b1badb6), C32e(0xdfdf9847),
- C32e(0xcdcda76a), C32e(0x4e4ef5bb), C32e(0x7f7f334c), C32e(0xeaea50ba),
- C32e(0x12123f2d), C32e(0x1d1da4b9), C32e(0x5858c49c), C32e(0x34344672),
- C32e(0x36364177), C32e(0xdcdc11cd), C32e(0xb4b49d29), C32e(0x5b5b4d16),
- C32e(0xa4a4a501), C32e(0x7676a1d7), C32e(0xb7b714a3), C32e(0x7d7d3449),
- C32e(0x5252df8d), C32e(0xdddd9f42), C32e(0x5e5ecd93), C32e(0x1313b1a2),
- C32e(0xa6a6a204), C32e(0xb9b901b8), C32e(0x00000000), C32e(0xc1c1b574),
- C32e(0x4040e0a0), C32e(0xe3e3c221), C32e(0x79793a43), C32e(0xb6b69a2c),
- C32e(0xd4d40dd9), C32e(0x8d8d47ca), C32e(0x67671770), C32e(0x7272afdd),
- C32e(0x9494ed79), C32e(0x9898ff67), C32e(0xb0b09323), C32e(0x85855bde),
- C32e(0xbbbb06bd), C32e(0xc5c5bb7e), C32e(0x4f4f7b34), C32e(0xededd73a),
- C32e(0x8686d254), C32e(0x9a9af862), C32e(0x666699ff), C32e(0x1111b6a7),
- C32e(0x8a8ac04a), C32e(0xe9e9d930), C32e(0x04040e0a), C32e(0xfefe6698),
- C32e(0xa0a0ab0b), C32e(0x7878b4cc), C32e(0x2525f0d5), C32e(0x4b4b753e),
- C32e(0xa2a2ac0e), C32e(0x5d5d4419), C32e(0x8080db5b), C32e(0x05058085),
- C32e(0x3f3fd3ec), C32e(0x2121fedf), C32e(0x7070a8d8), C32e(0xf1f1fd0c),
- C32e(0x6363197a), C32e(0x77772f58), C32e(0xafaf309f), C32e(0x4242e7a5),
- C32e(0x20207050), C32e(0xe5e5cb2e), C32e(0xfdfdef12), C32e(0xbfbf08b7),
- C32e(0x818155d4), C32e(0x1818243c), C32e(0x2626795f), C32e(0xc3c3b271),
- C32e(0xbebe8638), C32e(0x3535c8fd), C32e(0x8888c74f), C32e(0x2e2e654b),
- C32e(0x93936af9), C32e(0x5555580d), C32e(0xfcfc619d), C32e(0x7a7ab3c9),
- C32e(0xc8c827ef), C32e(0xbaba8832), C32e(0x32324f7d), C32e(0xe6e642a4),
- C32e(0xc0c03bfb), C32e(0x1919aab3), C32e(0x9e9ef668), C32e(0xa3a32281),
- C32e(0x4444eeaa), C32e(0x5454d682), C32e(0x3b3bdde6), C32e(0x0b0b959e),
- C32e(0x8c8cc945), C32e(0xc7c7bc7b), C32e(0x6b6b056e), C32e(0x28286c44),
- C32e(0xa7a72c8b), C32e(0xbcbc813d), C32e(0x16163127), C32e(0xadad379a),
- C32e(0xdbdb964d), C32e(0x64649efa), C32e(0x7474a6d2), C32e(0x14143622),
- C32e(0x9292e476), C32e(0x0c0c121e), C32e(0x4848fcb4), C32e(0xb8b88f37),
- C32e(0x9f9f78e7), C32e(0xbdbd0fb2), C32e(0x4343692a), C32e(0xc4c435f1),
- C32e(0x3939dae3), C32e(0x3131c6f7), C32e(0xd3d38a59), C32e(0xf2f27486),
- C32e(0xd5d58356), C32e(0x8b8b4ec5), C32e(0x6e6e85eb), C32e(0xdada18c2),
- C32e(0x01018e8f), C32e(0xb1b11dac), C32e(0x9c9cf16d), C32e(0x4949723b),
- C32e(0xd8d81fc7), C32e(0xacacb915), C32e(0xf3f3fa09), C32e(0xcfcfa06f),
- C32e(0xcaca20ea), C32e(0xf4f47d89), C32e(0x47476720), C32e(0x10103828),
- C32e(0x6f6f0b64), C32e(0xf0f07383), C32e(0x4a4afbb1), C32e(0x5c5cca96),
- C32e(0x3838546c), C32e(0x57575f08), C32e(0x73732152), C32e(0x979764f3),
- C32e(0xcbcbae65), C32e(0xa1a12584), C32e(0xe8e857bf), C32e(0x3e3e5d63),
- C32e(0x9696ea7c), C32e(0x61611e7f), C32e(0x0d0d9c91), C32e(0x0f0f9b94),
- C32e(0xe0e04bab), C32e(0x7c7cbac6), C32e(0x71712657), C32e(0xcccc29e5),
- C32e(0x9090e373), C32e(0x0606090f), C32e(0xf7f7f403), C32e(0x1c1c2a36),
- C32e(0xc2c23cfe), C32e(0x6a6a8be1), C32e(0xaeaebe10), C32e(0x6969026b),
- C32e(0x1717bfa8), C32e(0x999971e8), C32e(0x3a3a5369), C32e(0x2727f7d0),
- C32e(0xd9d99148), C32e(0xebebde35), C32e(0x2b2be5ce), C32e(0x22227755),
- C32e(0xd2d204d6), C32e(0xa9a93990), C32e(0x07078780), C32e(0x3333c1f2),
- C32e(0x2d2decc1), C32e(0x3c3c5a66), C32e(0x1515b8ad), C32e(0xc9c9a960),
- C32e(0x87875cdb), C32e(0xaaaab01a), C32e(0x5050d888), C32e(0xa5a52b8e),
- C32e(0x0303898a), C32e(0x59594a13), C32e(0x0909929b), C32e(0x1a1a2339),
- C32e(0x65651075), C32e(0xd7d78453), C32e(0x8484d551), C32e(0xd0d003d3),
- C32e(0x8282dc5e), C32e(0x2929e2cb), C32e(0x5a5ac399), C32e(0x1e1e2d33),
- C32e(0x7b7b3d46), C32e(0xa8a8b71f), C32e(0x6d6d0c61), C32e(0x2c2c624e)};
-
-static const sph_u32 T1dn[] = {
- C32e(0xa5f497a5), C32e(0x8497eb84), C32e(0x99b0c799), C32e(0x8d8cf78d),
- C32e(0x0d17e50d), C32e(0xbddcb7bd), C32e(0xb1c8a7b1), C32e(0x54fc3954),
- C32e(0x50f0c050), C32e(0x03050403), C32e(0xa9e087a9), C32e(0x7d87ac7d),
- C32e(0x192bd519), C32e(0x62a67162), C32e(0xe6319ae6), C32e(0x9ab5c39a),
- C32e(0x45cf0545), C32e(0x9dbc3e9d), C32e(0x40c00940), C32e(0x8792ef87),
- C32e(0x153fc515), C32e(0xeb267feb), C32e(0xc94007c9), C32e(0x0b1ded0b),
- C32e(0xec2f82ec), C32e(0x67a97d67), C32e(0xfd1cbefd), C32e(0xea258aea),
- C32e(0xbfda46bf), C32e(0xf702a6f7), C32e(0x96a1d396), C32e(0x5bed2d5b),
- C32e(0xc25deac2), C32e(0x1c24d91c), C32e(0xaee97aae), C32e(0x6abe986a),
- C32e(0x5aeed85a), C32e(0x41c3fc41), C32e(0x0206f102), C32e(0x4fd11d4f),
- C32e(0x5ce4d05c), C32e(0xf407a2f4), C32e(0x345cb934), C32e(0x0818e908),
- C32e(0x93aedf93), C32e(0x73954d73), C32e(0x53f5c453), C32e(0x3f41543f),
- C32e(0x0c14100c), C32e(0x52f63152), C32e(0x65af8c65), C32e(0x5ee2215e),
- C32e(0x28786028), C32e(0xa1f86ea1), C32e(0x0f11140f), C32e(0xb5c45eb5),
- C32e(0x091b1c09), C32e(0x365a4836), C32e(0x9bb6369b), C32e(0x3d47a53d),
- C32e(0x266a8126), C32e(0x69bb9c69), C32e(0xcd4cfecd), C32e(0x9fbacf9f),
- C32e(0x1b2d241b), C32e(0x9eb93a9e), C32e(0x749cb074), C32e(0x2e72682e),
- C32e(0x2d776c2d), C32e(0xb2cda3b2), C32e(0xee2973ee), C32e(0xfb16b6fb),
- C32e(0xf60153f6), C32e(0x4dd7ec4d), C32e(0x61a37561), C32e(0xce49face),
- C32e(0x7b8da47b), C32e(0x3e42a13e), C32e(0x7193bc71), C32e(0x97a22697),
- C32e(0xf50457f5), C32e(0x68b86968), C32e(0x00000000), C32e(0x2c74992c),
- C32e(0x60a08060), C32e(0x1f21dd1f), C32e(0xc843f2c8), C32e(0xed2c77ed),
- C32e(0xbed9b3be), C32e(0x46ca0146), C32e(0xd970ced9), C32e(0x4bdde44b),
- C32e(0xde7933de), C32e(0xd4672bd4), C32e(0xe8237be8), C32e(0x4ade114a),
- C32e(0x6bbd6d6b), C32e(0x2a7e912a), C32e(0xe5349ee5), C32e(0x163ac116),
- C32e(0xc55417c5), C32e(0xd7622fd7), C32e(0x55ffcc55), C32e(0x94a72294),
- C32e(0xcf4a0fcf), C32e(0x1030c910), C32e(0x060a0806), C32e(0x8198e781),
- C32e(0xf00b5bf0), C32e(0x44ccf044), C32e(0xbad54aba), C32e(0xe33e96e3),
- C32e(0xf30e5ff3), C32e(0xfe19bafe), C32e(0xc05b1bc0), C32e(0x8a850a8a),
- C32e(0xadec7ead), C32e(0xbcdf42bc), C32e(0x48d8e048), C32e(0x040cf904),
- C32e(0xdf7ac6df), C32e(0xc158eec1), C32e(0x759f4575), C32e(0x63a58463),
- C32e(0x30504030), C32e(0x1a2ed11a), C32e(0x0e12e10e), C32e(0x6db7656d),
- C32e(0x4cd4194c), C32e(0x143c3014), C32e(0x355f4c35), C32e(0x2f719d2f),
- C32e(0xe13867e1), C32e(0xa2fd6aa2), C32e(0xcc4f0bcc), C32e(0x394b5c39),
- C32e(0x57f93d57), C32e(0xf20daaf2), C32e(0x829de382), C32e(0x47c9f447),
- C32e(0xacef8bac), C32e(0xe7326fe7), C32e(0x2b7d642b), C32e(0x95a4d795),
- C32e(0xa0fb9ba0), C32e(0x98b33298), C32e(0xd16827d1), C32e(0x7f815d7f),
- C32e(0x66aa8866), C32e(0x7e82a87e), C32e(0xabe676ab), C32e(0x839e1683),
- C32e(0xca4503ca), C32e(0x297b9529), C32e(0xd36ed6d3), C32e(0x3c44503c),
- C32e(0x798b5579), C32e(0xe23d63e2), C32e(0x1d272c1d), C32e(0x769a4176),
- C32e(0x3b4dad3b), C32e(0x56fac856), C32e(0x4ed2e84e), C32e(0x1e22281e),
- C32e(0xdb763fdb), C32e(0x0a1e180a), C32e(0x6cb4906c), C32e(0xe4376be4),
- C32e(0x5de7255d), C32e(0x6eb2616e), C32e(0xef2a86ef), C32e(0xa6f193a6),
- C32e(0xa8e372a8), C32e(0xa4f762a4), C32e(0x3759bd37), C32e(0x8b86ff8b),
- C32e(0x3256b132), C32e(0x43c50d43), C32e(0x59ebdc59), C32e(0xb7c2afb7),
- C32e(0x8c8f028c), C32e(0x64ac7964), C32e(0xd26d23d2), C32e(0xe03b92e0),
- C32e(0xb4c7abb4), C32e(0xfa1543fa), C32e(0x0709fd07), C32e(0x256f8525),
- C32e(0xafea8faf), C32e(0x8e89f38e), C32e(0xe9208ee9), C32e(0x18282018),
- C32e(0xd564ded5), C32e(0x8883fb88), C32e(0x6fb1946f), C32e(0x7296b872),
- C32e(0x246c7024), C32e(0xf108aef1), C32e(0xc752e6c7), C32e(0x51f33551),
- C32e(0x23658d23), C32e(0x7c84597c), C32e(0x9cbfcb9c), C32e(0x21637c21),
- C32e(0xdd7c37dd), C32e(0xdc7fc2dc), C32e(0x86911a86), C32e(0x85941e85),
- C32e(0x90abdb90), C32e(0x42c6f842), C32e(0xc457e2c4), C32e(0xaae583aa),
- C32e(0xd8733bd8), C32e(0x050f0c05), C32e(0x0103f501), C32e(0x12363812),
- C32e(0xa3fe9fa3), C32e(0x5fe1d45f), C32e(0xf91047f9), C32e(0xd06bd2d0),
- C32e(0x91a82e91), C32e(0x58e82958), C32e(0x27697427), C32e(0xb9d04eb9),
- C32e(0x3848a938), C32e(0x1335cd13), C32e(0xb3ce56b3), C32e(0x33554433),
- C32e(0xbbd6bfbb), C32e(0x70904970), C32e(0x89800e89), C32e(0xa7f266a7),
- C32e(0xb6c15ab6), C32e(0x22667822), C32e(0x92ad2a92), C32e(0x20608920),
- C32e(0x49db1549), C32e(0xff1a4fff), C32e(0x7888a078), C32e(0x7a8e517a),
- C32e(0x8f8a068f), C32e(0xf813b2f8), C32e(0x809b1280), C32e(0x17393417),
- C32e(0xda75cada), C32e(0x3153b531), C32e(0xc65113c6), C32e(0xb8d3bbb8),
- C32e(0xc35e1fc3), C32e(0xb0cb52b0), C32e(0x7799b477), C32e(0x11333c11),
- C32e(0xcb46f6cb), C32e(0xfc1f4bfc), C32e(0xd661dad6), C32e(0x3a4e583a)};
-
-#define DECL_STATE_BIG sph_u32 H[32] = {0};
-
-#define READ_STATE_BIG(sc) \
- do { \
- memcpy(H, (sc)->state.narrow, sizeof H); \
- } while (0)
-
-#define WRITE_STATE_BIG(sc) \
- do { \
- memcpy((sc)->state.narrow, H, sizeof H); \
- } while (0)
-
-static void RBTT(size_t d0, size_t d1, sph_u32 *a, size_t b0, size_t b1,
- size_t b2, size_t b3, size_t b4, size_t b5, size_t b6,
- size_t b7, sph_u32 *t) {
- sph_u32 fu2 = T0up[B32_2(a[b2])];
- sph_u32 fd2 = T0dn[B32_2(a[b2])];
- sph_u32 fu3 = T1up[B32_3(a[b3])];
- sph_u32 fd3 = T1dn[B32_3(a[b3])];
- sph_u32 fu6 = T0up[B32_2(a[b6])];
- sph_u32 fd6 = T0dn[B32_2(a[b6])];
- sph_u32 fu7 = T1up[B32_3(a[b7])];
- sph_u32 fd7 = T1dn[B32_3(a[b7])];
- t[d0] = T0up[B32_0(a[b0])] ^ T1up[B32_1(a[b1])] ^ R32u(fu2, fd2) ^
- R32u(fu3, fd3) ^ T0dn[B32_0(a[b4])] ^ T1dn[B32_1(a[b5])] ^
- R32d(fu6, fd6) ^ R32d(fu7, fd7);
- t[d1] = T0dn[B32_0(a[b0])] ^ T1dn[B32_1(a[b1])] ^ R32d(fu2, fd2) ^
- R32d(fu3, fd3) ^ T0up[B32_0(a[b4])] ^ T1up[B32_1(a[b5])] ^
- R32u(fu6, fd6) ^ R32u(fu7, fd7);
-}
-
-static void ROUND_BIG_P(sph_u32 *a, int r) {
- sph_u32 t[32] = {0};
- for (size_t i = 0; i < 16; i++) {
- int j = i << 4;
- a[2 * i] ^= PC32up(j, r);
- a[2 * i + 1] ^= PC32dn(j, r);
- }
- for (size_t u = 0; u < 32; u += 8) {
- RBTT(u + 0x00, (u + 0x01) & 0x1F, a, u + 0x00, (u + 0x02) & 0x1F,
- (u + 0x04) & 0x1F, (u + 0x06) & 0x1F, (u + 0x09) & 0x1F,
- (u + 0x0B) & 0x1F, (u + 0x0D) & 0x1F, (u + 0x17) & 0x1F, t);
- RBTT(u + 0x02, (u + 0x03) & 0x1F, a, u + 0x02, (u + 0x04) & 0x1F,
- (u + 0x06) & 0x1F, (u + 0x08) & 0x1F, (u + 0x0B) & 0x1F,
- (u + 0x0D) & 0x1F, (u + 0x0F) & 0x1F, (u + 0x19) & 0x1F, t);
- RBTT(u + 0x04, (u + 0x05) & 0x1F, a, u + 0x04, (u + 0x06) & 0x1F,
- (u + 0x08) & 0x1F, (u + 0x0A) & 0x1F, (u + 0x0D) & 0x1F,
- (u + 0x0F) & 0x1F, (u + 0x11) & 0x1F, (u + 0x1B) & 0x1F, t);
- RBTT(u + 0x06, (u + 0x07) & 0x1F, a, u + 0x06, (u + 0x08) & 0x1F,
- (u + 0x0A) & 0x1F, (u + 0x0C) & 0x1F, (u + 0x0F) & 0x1F,
- (u + 0x11) & 0x1F, (u + 0x13) & 0x1F, (u + 0x1D) & 0x1F, t);
- }
- memcpy(a, t, sizeof(t));
-}
-
-static void ROUND_BIG_Q(sph_u32 *a, int r) {
- sph_u32 t[32] = {0};
- for (size_t i = 0; i < 16; i++) {
- int j = i << 4;
- a[2 * i] ^= QC32up(j, r);
- a[2 * i + 1] ^= QC32dn(j, r);
- }
- for (size_t u = 0; u < 32; u += 8) {
- RBTT(u + 0x00, (u + 0x01) & 0x1F, a, (u + 0x02) & 0x1F, (u + 0x06) & 0x1F,
- (u + 0x0A) & 0x1F, (u + 0x16) & 0x1F, (u + 0x01) & 0x1F,
- (u + 0x05) & 0x1F, (u + 0x09) & 0x1F, (u + 0x0D) & 0x1F, t);
- RBTT(u + 0x02, (u + 0x03) & 0x1F, a, (u + 0x04) & 0x1F, (u + 0x08) & 0x1F,
- (u + 0x0C) & 0x1F, (u + 0x18) & 0x1F, (u + 0x03) & 0x1F,
- (u + 0x07) & 0x1F, (u + 0x0B) & 0x1F, (u + 0x0F) & 0x1F, t);
- RBTT(u + 0x04, (u + 0x05) & 0x1F, a, (u + 0x06) & 0x1F, (u + 0x0A) & 0x1F,
- (u + 0x0E) & 0x1F, (u + 0x1A) & 0x1F, (u + 0x05) & 0x1F,
- (u + 0x09) & 0x1F, (u + 0x0D) & 0x1F, (u + 0x11) & 0x1F, t);
- RBTT(u + 0x06, (u + 0x07) & 0x1F, a, (u + 0x08) & 0x1F, (u + 0x0C) & 0x1F,
- (u + 0x10) & 0x1F, (u + 0x1C) & 0x1F, (u + 0x07) & 0x1F,
- (u + 0x0B) & 0x1F, (u + 0x0F) & 0x1F, (u + 0x13) & 0x1F, t);
- }
- memcpy(a, t, sizeof(t));
-}
-
-#define PERM_BIG_P(a) \
- do { \
- int r; \
- for (r = 0; r < 14; r++) ROUND_BIG_P(a, r); \
- } while (0)
-
-#define PERM_BIG_Q(a) \
- do { \
- int r; \
- for (r = 0; r < 14; r++) ROUND_BIG_Q(a, r); \
- } while (0)
-
-#define COMPRESS_BIG \
- do { \
- sph_u32 g[32], m[32]; \
- size_t uu; \
- for (uu = 0; uu < 32; uu++) { \
- m[uu] = dec32e_aligned(buf + (uu << 2)); \
- g[uu] = m[uu] ^ H[uu]; \
- } \
- PERM_BIG_P(g); \
- PERM_BIG_Q(m); \
- for (uu = 0; uu < 32; uu++) H[uu] ^= g[uu] ^ m[uu]; \
- } while (0)
-
-#define FINAL_BIG \
- do { \
- sph_u32 x[32]; \
- size_t uu; \
- memcpy(x, H, sizeof x); \
- PERM_BIG_P(x); \
- for (uu = 0; uu < 32; uu++) H[uu] ^= x[uu]; \
- } while (0)
-
-static void groestl_big_init(sph_groestl_big_context *sc, unsigned out_size) {
- size_t u = 0;
-
- sc->ptr = 0;
- for (u = 0; u < 31; u++) sc->state.narrow[u] = 0;
- sc->state.narrow[31] =
- ((sph_u32)(out_size & 0xFF) << 24) | ((sph_u32)(out_size & 0xFF00) << 8);
- sc->count = 0;
-}
-
-static void groestl_big_core(sph_groestl_big_context *sc, const void *data,
- size_t len) {
- if (len == 0) {
- return;
- }
-
- unsigned char *buf = NULL;
- size_t ptr = 0;
- DECL_STATE_BIG
-
- buf = sc->buf;
- ptr = sc->ptr;
- if (len < (sizeof sc->buf) - ptr) {
- memcpy(buf + ptr, data, len);
- ptr += len;
- sc->ptr = ptr;
- return;
- }
-
- READ_STATE_BIG(sc);
- while (len > 0) {
- size_t clen = 0;
-
- clen = (sizeof sc->buf) - ptr;
- if (clen > len) clen = len;
- memcpy(buf + ptr, data, clen);
- ptr += clen;
- data = (const unsigned char *)data + clen;
- len -= clen;
- if (ptr == sizeof sc->buf) {
- COMPRESS_BIG;
- sc->count++;
- ptr = 0;
- }
- }
- WRITE_STATE_BIG(sc);
- sc->ptr = ptr;
-}
-
-static void groestl_big_close(sph_groestl_big_context *sc, unsigned ub,
- unsigned n, void *dst, size_t out_len) {
- unsigned char pad[136] = {0};
- size_t ptr = 0, pad_len = 0, u2 = 0;
- sph_u64 count = 0;
- unsigned z = 0;
- DECL_STATE_BIG
-
- ptr = sc->ptr;
- z = 0x80 >> n;
- pad[0] = ((ub & -z) | z) & 0xFF;
- if (ptr < 120) {
- pad_len = 128 - ptr;
- count = SPH_T64(sc->count + 1);
- } else {
- pad_len = 256 - ptr;
- count = SPH_T64(sc->count + 2);
- }
- memzero(pad + 1, pad_len - 9);
- sph_enc64be(pad + pad_len - 8, count);
- groestl_big_core(sc, pad, pad_len);
- READ_STATE_BIG(sc);
- FINAL_BIG;
- for (u2 = 0; u2 < 16; u2++) enc32e(pad + (u2 << 2), H[u2 + 16]);
- memcpy(dst, pad + 64 - out_len, out_len);
- groestl_big_init(sc, (unsigned)out_len << 3);
-}
-
-void groestl512_Init(void *cc) {
- groestl_big_init((sph_groestl_big_context *)cc, 512);
-}
-
-void groestl512_Update(void *cc, const void *data, size_t len) {
- groestl_big_core((sph_groestl_big_context *)cc, data, len);
-}
-
-void groestl512_Final(void *cc, void *dst) {
- groestl_big_close((sph_groestl_big_context *)cc, 0, 0, dst, 64);
-}
-
-void groestl512_DoubleTrunc(void *cc, void *dst) {
- char buf[64] = {0};
-
- groestl512_Final(cc, buf);
- groestl512_Update(cc, buf, sizeof(buf));
- groestl512_Final(cc, buf);
- memcpy(dst, buf, 32);
-}
### crypto/groestl.h
@@ -1,96 +0,0 @@
-/* Groestl hash from https://github.com/Groestlcoin/vanitygen
- * Trezor adaptation by Yura Pakhuchiy <pakhuchiy@gmail.com>. */
-/**
- * Groestl interface. This code implements Groestl with the recommended
- * parameters for SHA-3, with output of 512 bits.
- *
- * ==========================(LICENSE BEGIN)============================
- *
- * Copyright (c) 2007-2010 Projet RNRT SAPHIR
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * ===========================(LICENSE END)=============================
- *
- * @file groestl.h
- * @author Thomas Pornin <thomas.pornin@cryptolog.com>
- */
-
-#ifndef GROESTL_H__
-#define GROESTL_H__
-
-#include <stddef.h>
-#include <stdint.h>
-
-/**
- * This structure is a context for Groestl-512 computation:
- * it contains the intermediate values and some data from the last
- * entered block. Once a Groestl computation has been performed, the
- * context can be reused for another computation.
- *
- * The contents of this structure are private. A running Groestl
- * computation can be cloned by copying the context (e.g. with a simple
- * <code>memcpy()</code>).
- */
-typedef struct {
- unsigned char buf[128]; /* first field, for alignment */
- size_t ptr;
- union {
- uint64_t wide[16];
- uint32_t narrow[32];
- } state;
- uint64_t count;
-} sph_groestl_big_context;
-
-typedef sph_groestl_big_context GROESTL512_CTX;
-
-/**
- * Initialize a Groestl-512 context. This process performs no memory allocation.
- *
- * @param cc the Groestl-512 context (pointer to a
- * <code>GROESTL512_CTX</code>)
- */
-void groestl512_Init(void *cc);
-
-/**
- * Process some data bytes. It is acceptable that <code>len</code> is zero
- * (in which case this function does nothing).
- *
- * @param cc the Groestl-512 context
- * @param data the input data
- * @param len the input data length (in bytes)
- */
-void groestl512_Update(void *cc, const void *data, size_t len);
-
-/**
- * Terminate the current Groestl-512 computation and output the result into
- * the provided buffer. The destination buffer must be wide enough to
- * accomodate the result (64 bytes). The context is automatically
- * reinitialized.
- *
- * @param cc the Groestl-512 context
- * @param dst the destination buffer
- */
-void groestl512_Final(void *cc, void *dst);
-
-/* Calculate double Groestl-512 hash and truncate it to 256-bits. */
-void groestl512_DoubleTrunc(void *cc, void *dst);
-
-#endif
### crypto/groestl_internal.h
@@ -1,463 +0,0 @@
-/* Groestl hash from https://github.com/Groestlcoin/vanitygen
- * Trezor adaptation by Yura Pakhuchiy <pakhuchiy@gmail.com>. */
-/**
- * Basic type definitions.
- *
- * This header file defines the generic integer types that will be used
- * for the implementation of hash functions; it also contains helper
- * functions which encode and decode multi-byte integer values, using
- * either little-endian or big-endian conventions.
- *
- * This file contains a compile-time test on the size of a byte
- * (the <code>unsigned char</code> C type). If bytes are not octets,
- * i.e. if they do not have a size of exactly 8 bits, then compilation
- * is aborted. Architectures where bytes are not octets are relatively
- * rare, even in the embedded devices market. We forbid non-octet bytes
- * because there is no clear convention on how octet streams are encoded
- * on such systems.
- *
- * ==========================(LICENSE BEGIN)============================
- *
- * Copyright (c) 2007-2010 Projet RNRT SAPHIR
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * ===========================(LICENSE END)=============================
- *
- * @file sph_types.h
- * @author Thomas Pornin <thomas.pornin@cryptolog.com>
- */
-
-#ifndef GROESTL_INTERNAL_H__
-#define GROESTL_INTERNAL_H__
-
-#include <limits.h>
-
-/*
- * All our I/O functions are defined over octet streams. We do not know
- * how to handle input data if bytes are not octets.
- */
-#if CHAR_BIT != 8
-#error This code requires 8-bit bytes
-#endif
-
-#if defined __STDC__ && __STDC_VERSION__ >= 199901L
-
-#include <stdint.h>
-
-typedef uint32_t sph_u32;
-typedef int32_t sph_s32;
-typedef uint64_t sph_u64;
-typedef int64_t sph_s64;
-
-#define SPH_C32(x) ((sph_u32)(x))
-#define SPH_C64(x) ((sph_u64)(x))
-
-#else
-#error We need at least C99 compiler
-#endif
-
-#define SPH_T32(x) ((x) & SPH_C32(0xFFFFFFFF))
-#define SPH_ROTL32(x, n) SPH_T32(((x) << (n)) | ((x) >> (32 - (n))))
-#define SPH_ROTR32(x, n) SPH_ROTL32(x, (32 - (n)))
-
-#define SPH_T64(x) ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
-#define SPH_ROTL64(x, n) SPH_T64(((x) << (n)) | ((x) >> (64 - (n))))
-#define SPH_ROTR64(x, n) SPH_ROTL64(x, (64 - (n)))
-
-/*
- * 32-bit x86, aka "i386 compatible".
- */
-#if defined __i386__ || defined _M_IX86
-
-#define SPH_DETECT_LITTLE_ENDIAN 1
-#define SPH_DETECT_BIG_ENDIAN 0
-
-/*
- * 64-bit x86, hereafter known as "amd64".
- */
-#elif defined __x86_64 || defined _M_X64
-
-#define SPH_DETECT_LITTLE_ENDIAN 1
-#define SPH_DETECT_BIG_ENDIAN 0
-
-/*
- * ARM, little-endian.
- */
-#elif defined __arm__ && __ARMEL__
-
-#define SPH_DETECT_LITTLE_ENDIAN 1
-#define SPH_DETECT_BIG_ENDIAN 0
-
-/*
- * ARM64, little-endian.
- */
-#elif defined __aarch64__
-
-#define SPH_DETECT_LITTLE_ENDIAN 1
-#define SPH_DETECT_BIG_ENDIAN 0
-
-#endif
-
-#if defined SPH_DETECT_LITTLE_ENDIAN && !defined SPH_LITTLE_ENDIAN
-#define SPH_LITTLE_ENDIAN SPH_DETECT_LITTLE_ENDIAN
-#endif
-#if defined SPH_DETECT_BIG_ENDIAN && !defined SPH_BIG_ENDIAN
-#define SPH_BIG_ENDIAN SPH_DETECT_BIG_ENDIAN
-#endif
-
-static inline sph_u32 sph_bswap32(sph_u32 x) {
- x = SPH_T32((x << 16) | (x >> 16));
- x = ((x & SPH_C32(0xFF00FF00)) >> 8) | ((x & SPH_C32(0x00FF00FF)) << 8);
- return x;
-}
-
-/**
- * Byte-swap a 64-bit value.
- *
- * @param x the input value
- * @return the byte-swapped value
- */
-static inline sph_u64 sph_bswap64(sph_u64 x) {
- x = SPH_T64((x << 32) | (x >> 32));
- x = ((x & SPH_C64(0xFFFF0000FFFF0000)) >> 16) |
- ((x & SPH_C64(0x0000FFFF0000FFFF)) << 16);
- x = ((x & SPH_C64(0xFF00FF00FF00FF00)) >> 8) |
- ((x & SPH_C64(0x00FF00FF00FF00FF)) << 8);
- return x;
-}
-
-static inline void sph_enc16be(void *dst, unsigned val) {
- ((unsigned char *)dst)[0] = (val >> 8);
- ((unsigned char *)dst)[1] = val;
-}
-
-static inline unsigned sph_dec16be(const void *src) {
- return ((unsigned)(((const unsigned char *)src)[0]) << 8) |
- (unsigned)(((const unsigned char *)src)[1]);
-}
-
-static inline void sph_enc16le(void *dst, unsigned val) {
- ((unsigned char *)dst)[0] = val;
- ((unsigned char *)dst)[1] = val >> 8;
-}
-
-static inline unsigned sph_dec16le(const void *src) {
- return (unsigned)(((const unsigned char *)src)[0]) |
- ((unsigned)(((const unsigned char *)src)[1]) << 8);
-}
-
-/**
- * Encode a 32-bit value into the provided buffer (big endian convention).
- *
- * @param dst the destination buffer
- * @param val the 32-bit value to encode
- */
-static inline void sph_enc32be(void *dst, sph_u32 val) {
- ((unsigned char *)dst)[0] = (val >> 24);
- ((unsigned char *)dst)[1] = (val >> 16);
- ((unsigned char *)dst)[2] = (val >> 8);
- ((unsigned char *)dst)[3] = val;
-}
-
-/**
- * Encode a 32-bit value into the provided buffer (big endian convention).
- * The destination buffer must be properly aligned.
- *
- * @param dst the destination buffer (32-bit aligned)
- * @param val the value to encode
- */
-static inline void sph_enc32be_aligned(void *dst, sph_u32 val) {
-#if SPH_LITTLE_ENDIAN
- *(sph_u32 *)dst = sph_bswap32(val);
-#elif SPH_BIG_ENDIAN
- *(sph_u32 *)dst = val;
-#else
- ((unsigned char *)dst)[0] = (val >> 24);
- ((unsigned char *)dst)[1] = (val >> 16);
- ((unsigned char *)dst)[2] = (val >> 8);
- ((unsigned char *)dst)[3] = val;
-#endif
-}
-
-/**
- * Decode a 32-bit value from the provided buffer (big endian convention).
- *
- * @param src the source buffer
- * @return the decoded value
- */
-static inline sph_u32 sph_dec32be(const void *src) {
- return ((sph_u32)(((const unsigned char *)src)[0]) << 24) |
- ((sph_u32)(((const unsigned char *)src)[1]) << 16) |
- ((sph_u32)(((const unsigned char *)src)[2]) << 8) |
- (sph_u32)(((const unsigned char *)src)[3]);
-}
-
-/**
- * Decode a 32-bit value from the provided buffer (big endian convention).
- * The source buffer must be properly aligned.
- *
- * @param src the source buffer (32-bit aligned)
- * @return the decoded value
- */
-static inline sph_u32 sph_dec32be_aligned(const void *src) {
-#if SPH_LITTLE_ENDIAN
- return sph_bswap32(*(const sph_u32 *)src);
-#elif SPH_BIG_ENDIAN
- return *(const sph_u32 *)src;
-#else
- return ((sph_u32)(((const unsigned char *)src)[0]) << 24) |
- ((sph_u32)(((const unsigned char *)src)[1]) << 16) |
- ((sph_u32)(((const unsigned char *)src)[2]) << 8) |
- (sph_u32)(((const unsigned char *)src)[3]);
-#endif
-}
-
-/**
- * Encode a 32-bit value into the provided buffer (little endian convention).
- *
- * @param dst the destination buffer
- * @param val the 32-bit value to encode
- */
-static inline void sph_enc32le(void *dst, sph_u32 val) {
- ((unsigned char *)dst)[0] = val;
- ((unsigned char *)dst)[1] = (val >> 8);
- ((unsigned char *)dst)[2] = (val >> 16);
- ((unsigned char *)dst)[3] = (val >> 24);
-}
-
-/**
- * Encode a 32-bit value into the provided buffer (little endian convention).
- * The destination buffer must be properly aligned.
- *
- * @param dst the destination buffer (32-bit aligned)
- * @param val the value to encode
- */
-static inline void sph_enc32le_aligned(void *dst, sph_u32 val) {
-#if SPH_LITTLE_ENDIAN
- *(sph_u32 *)dst = val;
-#elif SPH_BIG_ENDIAN
- *(sph_u32 *)dst = sph_bswap32(val);
-#else
- ((unsigned char *)dst)[0] = val;
- ((unsigned char *)dst)[1] = (val >> 8);
- ((unsigned char *)dst)[2] = (val >> 16);
- ((unsigned char *)dst)[3] = (val >> 24);
-#endif
-}
-
-/**
- * Decode a 32-bit value from the provided buffer (little endian convention).
- *
- * @param src the source buffer
- * @return the decoded value
- */
-static inline sph_u32 sph_dec32le(const void *src) {
- return (sph_u32)(((const unsigned char *)src)[0]) |
- ((sph_u32)(((const unsigned char *)src)[1]) << 8) |
- ((sph_u32)(((const unsigned char *)src)[2]) << 16) |
- ((sph_u32)(((const unsigned char *)src)[3]) << 24);
-}
-
-/**
- * Decode a 32-bit value from the provided buffer (little endian convention).
- * The source buffer must be properly aligned.
- *
- * @param src the source buffer (32-bit aligned)
- * @return the decoded value
- */
-static inline sph_u32 sph_dec32le_aligned(const void *src) {
-#if SPH_LITTLE_ENDIAN
- return *(const sph_u32 *)src;
-#elif SPH_BIG_ENDIAN
- return sph_bswap32(*(const sph_u32 *)src);
-#else
- return (sph_u32)(((const unsigned char *)src)[0]) |
- ((sph_u32)(((const unsigned char *)src)[1]) << 8) |
- ((sph_u32)(((const unsigned char *)src)[2]) << 16) |
- ((sph_u32)(((const unsigned char *)src)[3]) << 24);
-#endif
-}
-
-/**
- * Encode a 64-bit value into the provided buffer (big endian convention).
- *
- * @param dst the destination buffer
- * @param val the 64-bit value to encode
- */
-static inline void sph_enc64be(void *dst, sph_u64 val) {
- ((unsigned char *)dst)[0] = (val >> 56);
- ((unsigned char *)dst)[1] = (val >> 48);
- ((unsigned char *)dst)[2] = (val >> 40);
- ((unsigned char *)dst)[3] = (val >> 32);
- ((unsigned char *)dst)[4] = (val >> 24);
- ((unsigned char *)dst)[5] = (val >> 16);
- ((unsigned char *)dst)[6] = (val >> 8);
- ((unsigned char *)dst)[7] = val;
-}
-
-/**
- * Encode a 64-bit value into the provided buffer (big endian convention).
- * The destination buffer must be properly aligned.
- *
- * @param dst the destination buffer (64-bit aligned)
- * @param val the value to encode
- */
-static inline void sph_enc64be_aligned(void *dst, sph_u64 val) {
-#if SPH_LITTLE_ENDIAN
- *(sph_u64 *)dst = sph_bswap64(val);
-#elif SPH_BIG_ENDIAN
- *(sph_u64 *)dst = val;
-#else
- ((unsigned char *)dst)[0] = (val >> 56);
- ((unsigned char *)dst)[1] = (val >> 48);
- ((unsigned char *)dst)[2] = (val >> 40);
- ((unsigned char *)dst)[3] = (val >> 32);
- ((unsigned char *)dst)[4] = (val >> 24);
- ((unsigned char *)dst)[5] = (val >> 16);
- ((unsigned char *)dst)[6] = (val >> 8);
- ((unsigned char *)dst)[7] = val;
-#endif
-}
-
-/**
- * Decode a 64-bit value from the provided buffer (big endian convention).
- *
- * @param src the source buffer
- * @return the decoded value
- */
-static inline sph_u64 sph_dec64be(const void *src) {
- return ((sph_u64)(((const unsigned char *)src)[0]) << 56) |
- ((sph_u64)(((const unsigned char *)src)[1]) << 48) |
- ((sph_u64)(((const unsigned char *)src)[2]) << 40) |
- ((sph_u64)(((const unsigned char *)src)[3]) << 32) |
- ((sph_u64)(((const unsigned char *)src)[4]) << 24) |
- ((sph_u64)(((const unsigned char *)src)[5]) << 16) |
- ((sph_u64)(((const unsigned char *)src)[6]) << 8) |
- (sph_u64)(((const unsigned char *)src)[7]);
-}
-
-/**
- * Decode a 64-bit value from the provided buffer (big endian convention).
- * The source buffer must be properly aligned.
- *
- * @param src the source buffer (64-bit aligned)
- * @return the decoded value
- */
-static inline sph_u64 sph_dec64be_aligned(const void *src) {
-#if SPH_LITTLE_ENDIAN
- return sph_bswap64(*(const sph_u64 *)src);
-#elif SPH_BIG_ENDIAN
- return *(const sph_u64 *)src;
-#else
- return ((sph_u64)(((const unsigned char *)src)[0]) << 56) |
- ((sph_u64)(((const unsigned char *)src)[1]) << 48) |
- ((sph_u64)(((const unsigned char *)src)[2]) << 40) |
- ((sph_u64)(((const unsigned char *)src)[3]) << 32) |
- ((sph_u64)(((const unsigned char *)src)[4]) << 24) |
- ((sph_u64)(((const unsigned char *)src)[5]) << 16) |
- ((sph_u64)(((const unsigned char *)src)[6]) << 8) |
- (sph_u64)(((const unsigned char *)src)[7]);
-#endif
-}
-
-/**
- * Encode a 64-bit value into the provided buffer (little endian convention).
- *
- * @param dst the destination buffer
- * @param val the 64-bit value to encode
- */
-static inline void sph_enc64le(void *dst, sph_u64 val) {
- ((unsigned char *)dst)[0] = val;
- ((unsigned char *)dst)[1] = (val >> 8);
- ((unsigned char *)dst)[2] = (val >> 16);
- ((unsigned char *)dst)[3] = (val >> 24);
- ((unsigned char *)dst)[4] = (val >> 32);
- ((unsigned char *)dst)[5] = (val >> 40);
- ((unsigned char *)dst)[6] = (val >> 48);
- ((unsigned char *)dst)[7] = (val >> 56);
-}
-
-/**
- * Encode a 64-bit value into the provided buffer (little endian convention).
- * The destination buffer must be properly aligned.
- *
- * @param dst the destination buffer (64-bit aligned)
- * @param val the value to encode
- */
-static inline void sph_enc64le_aligned(void *dst, sph_u64 val) {
-#if SPH_LITTLE_ENDIAN
- *(sph_u64 *)dst = val;
-#elif SPH_BIG_ENDIAN
- *(sph_u64 *)dst = sph_bswap64(val);
-#else
- ((unsigned char *)dst)[0] = val;
- ((unsigned char *)dst)[1] = (val >> 8);
- ((unsigned char *)dst)[2] = (val >> 16);
- ((unsigned char *)dst)[3] = (val >> 24);
- ((unsigned char *)dst)[4] = (val >> 32);
- ((unsigned char *)dst)[5] = (val >> 40);
- ((unsigned char *)dst)[6] = (val >> 48);
- ((unsigned char *)dst)[7] = (val >> 56);
-#endif
-}
-
-/**
- * Decode a 64-bit value from the provided buffer (little endian convention).
- *
- * @param src the source buffer
- * @return the decoded value
- */
-static inline sph_u64 sph_dec64le(const void *src) {
- return (sph_u64)(((const unsigned char *)src)[0]) |
- ((sph_u64)(((const unsigned char *)src)[1]) << 8) |
- ((sph_u64)(((const unsigned char *)src)[2]) << 16) |
- ((sph_u64)(((const unsigned char *)src)[3]) << 24) |
- ((sph_u64)(((const unsigned char *)src)[4]) << 32) |
- ((sph_u64)(((const unsigned char *)src)[5]) << 40) |
- ((sph_u64)(((const unsigned char *)src)[6]) << 48) |
- ((sph_u64)(((const unsigned char *)src)[7]) << 56);
-}
-
-/**
- * Decode a 64-bit value from the provided buffer (little endian convention).
- * The source buffer must be properly aligned.
- *
- * @param src the source buffer (64-bit aligned)
- * @return the decoded value
- */
-static inline sph_u64 sph_dec64le_aligned(const void *src) {
-#if SPH_LITTLE_ENDIAN
- return *(const sph_u64 *)src;
-#elif SPH_BIG_ENDIAN
- return sph_bswap64(*(const sph_u64 *)src);
-#else
- return (sph_u64)(((const unsigned char *)src)[0]) |
- ((sph_u64)(((const unsigned char *)src)[1]) << 8) |
- ((sph_u64)(((const unsigned char *)src)[2]) << 16) |
- ((sph_u64)(((const unsigned char *)src)[3]) << 24) |
- ((sph_u64)(((const unsigned char *)src)[4]) << 32) |
- ((sph_u64)(((const unsigned char *)src)[5]) << 40) |
- ((sph_u64)(((const unsigned char *)src)[6]) << 48) |
- ((sph_u64)(((const unsigned char *)src)[7]) << 56);
-#endif
-}
-
-#endif
### crypto/hasher.c
@@ -54,9 +54,6 @@ void hasher_InitParam(Hasher *hasher, HasherType type, const void *param,
case HASHER_BLAKE_RIPEMD:
blake256_Init(&hasher->ctx.blake);
break;
- case HASHER_GROESTLD_TRUNC:
- groestl512_Init(&hasher->ctx.groestl);
- break;
case HASHER_BLAKE2B:
blake2b_Init(&hasher->ctx.blake2b, 32);
break;
@@ -94,9 +91,6 @@ void hasher_Update(Hasher *hasher, const uint8_t *data, size_t length) {
case HASHER_BLAKE_RIPEMD:
blake256_Update(&hasher->ctx.blake, data, length);
break;
- case HASHER_GROESTLD_TRUNC:
- groestl512_Update(&hasher->ctx.groestl, data, length);
- break;
case HASHER_BLAKE2B:
case HASHER_BLAKE2B_PERSONAL:
blake2b_Update(&hasher->ctx.blake2b, data, length);
@@ -137,9 +131,6 @@ void hasher_Final(Hasher *hasher, uint8_t hash[HASHER_DIGEST_LENGTH]) {
blake256_Final(&hasher->ctx.blake, hash);
ripemd160(hash, HASHER_DIGEST_LENGTH, hash);
break;
- case HASHER_GROESTLD_TRUNC:
- groestl512_DoubleTrunc(&hasher->ctx.groestl, hash);
- break;
case HASHER_BLAKE2B:
case HASHER_BLAKE2B_PERSONAL:
blake2b_Final(&hasher->ctx.blake2b, hash, 32);
### crypto/hasher.h
@@ -28,7 +28,6 @@
#include "blake256.h"
#include "blake2b.h"
-#include "groestl.h"
#include "sha2.h"
#include "sha3.h"
@@ -49,8 +48,6 @@ typedef enum {
HASHER_BLAKED,
HASHER_BLAKE_RIPEMD,
- HASHER_GROESTLD_TRUNC, /* Double Groestl512 hasher truncated to 256 bits */
-
HASHER_BLAKE2B,
HASHER_BLAKE2B_PERSONAL,
} HasherType;
@@ -59,11 +56,10 @@ typedef struct {
HasherType type;
union {
- SHA256_CTX sha2; // for HASHER_SHA2{,D}
- SHA3_CTX sha3; // for HASHER_SHA3{,K}
- BLAKE256_CTX blake; // for HASHER_BLAKE{,D}
- GROESTL512_CTX groestl; // for HASHER_GROESTLD_TRUNC
- BLAKE2B_CTX blake2b; // for HASHER_BLAKE2B{,_PERSONAL}
+ SHA256_CTX sha2; // for HASHER_SHA2{,D}
+ SHA3_CTX sha3; // for HASHER_SHA3{,K}
+ BLAKE256_CTX blake; // for HASHER_BLAKE{,D}
+ BLAKE2B_CTX blake2b; // for HASHER_BLAKE2B{,_PERSONAL}
} ctx;
const void *param;
### crypto/secp256k1.c
@@ -75,15 +75,6 @@ const curve_info secp256k1_decred_info = {
.hasher_script = HASHER_BLAKE,
};
-const curve_info secp256k1_groestl_info = {
- .bip32_name = "Bitcoin seed",
- .params = &secp256k1,
- .hasher_base58 = HASHER_GROESTLD_TRUNC,
- .hasher_sign = HASHER_SHA2,
- .hasher_pubkey = HASHER_SHA2_RIPEMD,
- .hasher_script = HASHER_SHA2,
-};
-
const curve_info secp256k1_smart_info = {
.bip32_name = "Bitcoin seed",
.params = &secp256k1,
### crypto/secp256k1.h
@@ -32,7 +32,6 @@
extern const ecdsa_curve secp256k1;
extern const curve_info secp256k1_info;
extern const curve_info secp256k1_decred_info;
-extern const curve_info secp256k1_groestl_info;
extern const curve_info secp256k1_smart_info;
#endif
### crypto/tests/test_check.c
@@ -63,7 +63,6 @@
#include "ed25519-donna/ed25519-keccak.h"
#include "ed25519-donna/ed25519.h"
#include "elligator2.h"
-#include "groestl.h"
#include "hash_to_curve.h"
#include "hmac_drbg.h"
#include "memzero.h"
@@ -6926,37 +6925,6 @@ START_TEST(test_mnemonic) {
}
END_TEST
-START_TEST(test_groestl512) {
- static struct {
- const char *msg;
- const char *hash;
- } tests[] = {
- {"",
- "6d3ad29d279110eef3adbd66de2a0345a77baede1557f5d099fce0c03d6dc2ba8e6d4a6"
- "633dfbd66053c20faa87d1a11f39a7fbe4a6c2f009801370308fc4ad8"},
- // abc
- {"616263",
- "70e1c68c60df3b655339d67dc291cc3f1dde4ef343f11b23fdd44957693815a75a8339c"
- "682fc28322513fd1f283c18e53cff2b264e06bf83a2f0ac8c1f6fbff6"},
- // 64 bytes
- {"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
- "202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f",
- "6e8c9b90e36cea68c029a7d8b95b718c84205d81be227ba61510f567d46b83edd11f301"
- "bf1e7041be991b22fdbee82dbdce7ab0e0ee42a795ca965a439532a39"},
- };
-
- uint8_t hash[64];
- GROESTL512_CTX ctx;
-
- for (size_t i = 0; i < sizeof(tests) / sizeof(*tests); i++) {
- groestl512_Init(&ctx);
- groestl512_Update(&ctx, fromhex(tests[i].msg), strlen(tests[i].msg) / 2);
- groestl512_Final(&ctx, hash);
- ck_assert_mem_eq(hash, fromhex(tests[i].hash), 64);
- }
-}
-END_TEST
-
START_TEST(test_mnemonic_check) {
static const char *vectors_ok[] = {
"abandon abandon abandon abandon abandon abandon abandon abandon abandon "
@@ -7493,9 +7461,6 @@ START_TEST(test_address) {
ecdsa_get_address(pub_key, 48, HASHER_SHA2_RIPEMD, HASHER_SHA2D, address,
sizeof(address));
ck_assert_str_eq(address, "LMNJqZbe89yrPbm7JVzrcXJf28hZ1rKPaH");
- ecdsa_get_address(pub_key, 36, HASHER_SHA2_RIPEMD, HASHER_GROESTLD_TRUNC,
- address, sizeof(address));
- ck_assert_str_eq(address, "FXK52G2BbzRLaQ651U12o23DU5cEQdhvU6");
ecdsa_get_address_segwit_p2sh(pub_key, 5, HASHER_SHA2_RIPEMD, HASHER_SHA2D,
address, sizeof(address));
ck_assert_str_eq(address, "34PyTHn74syS796eTgsyoLfwoBC3cwLn6p");
@@ -7517,9 +7482,6 @@ START_TEST(test_address) {
ecdsa_get_address(pub_key, 48, HASHER_SHA2_RIPEMD, HASHER_SHA2D, address,
sizeof(address));
ck_assert_str_eq(address, "LTmtvyMmoZ49SpfLY73fhZMJEFRPdyohKh");
- ecdsa_get_address(pub_key, 36, HASHER_SHA2_RIPEMD, HASHER_GROESTLD_TRUNC,
- address, sizeof(address));
- ck_assert_str_eq(address, "Fdif7fnKHPVddczJF53qt45rgCL51yWN6x");
ecdsa_get_address_segwit_p2sh(pub_key, 5, HASHER_SHA2_RIPEMD, HASHER_SHA2D,
address, sizeof(address));
ck_assert_str_eq(address, "35trq6eeuHf6VL9L8pQv46x3vegHnHoTuB");
@@ -7541,9 +7503,6 @@ START_TEST(test_address) {
ecdsa_get_address(pub_key, 48, HASHER_SHA2_RIPEMD, HASHER_SHA2D, address,
sizeof(address));
ck_assert_str_eq(address, "LZjBHp5sSAwfKDQnnP5UCFaaXKV9YheGxQ");
- ecdsa_get_address(pub_key, 36, HASHER_SHA2_RIPEMD, HASHER_GROESTLD_TRUNC,
- address, sizeof(address));
- ck_assert_str_eq(address, "FjfwUWWQv1P9W1jkVM5eNkK8yGPq5XyZZy");
ecdsa_get_address_segwit_p2sh(pub_key, 5, HASHER_SHA2_RIPEMD, HASHER_SHA2D,
address, sizeof(address));
ck_assert_str_eq(address, "3456DYaKUWuY6RWWw8Hp5CftHLcQN29h9Y");
@@ -7565,9 +7524,6 @@ START_TEST(test_address) {
ecdsa_get_address(pub_key, 48, HASHER_SHA2_RIPEMD, HASHER_SHA2D, address,
sizeof(address));
ck_assert_str_eq(address, "LLCopoSTnHtz4eWdQQhLAVgNgT1zTi4QBK");
- ecdsa_get_address(pub_key, 36, HASHER_SHA2_RIPEMD, HASHER_GROESTLD_TRUNC,
- address, sizeof(address));
- ck_assert_str_eq(address, "FW9a1Vs1G8LUFSqb7NhWLzQw8PvfwAxmxA");
ecdsa_get_address_segwit_p2sh(pub_key, 5, HASHER_SHA2_RIPEMD, HASHER_SHA2D,
address, sizeof(address));
ck_assert_str_eq(address, "3DBU4tJ9tkMR9fnmCtjW48kjvseoNLQZXd");
@@ -7590,9 +7546,6 @@ START_TEST(test_address) {
ecdsa_get_address(pub_key, 48, HASHER_SHA2_RIPEMD, HASHER_SHA2D, address,
sizeof(address));
ck_assert_str_eq(address, "LTHPpodwAcSFWzHV4VsGnMHr4NEJajMnKX");
- ecdsa_get_address(pub_key, 36, HASHER_SHA2_RIPEMD, HASHER_GROESTLD_TRUNC,
- address, sizeof(address));
- ck_assert_str_eq(address, "FdEA1W4UeSsjhncSmTsSxr2QWK8z2xGkjc");
memcpy(
pub_key,
@@ -7612,9 +7565,6 @@ START_TEST(test_address) {
ecdsa_get_address(pub_key, 48, HASHER_SHA2_RIPEMD, HASHER_SHA2D, address,
sizeof(address));
ck_assert_str_eq(address, "LUFTvPWtFxVzo5wYnDJz2uueoqfcMYiuxH");
- ecdsa_get_address(pub_key, 36, HASHER_SHA2_RIPEMD, HASHER_GROESTLD_TRUNC,
- address, sizeof(address));
- ck_assert_str_eq(address, "FeCE75wRjnwUytGWVBKADQeDFnaHpJ8t3B");
memcpy(
pub_key,
@@ -7634,9 +7584,6 @@ START_TEST(test_address) {
ecdsa_get_address(pub_key, 48, HASHER_SHA2_RIPEMD, HASHER_SHA2D, address,
sizeof(address));
ck_assert_str_eq(address, "LTX5GvADs5CjQGy7EDhtjjhxxoQB2Uhicd");
- ecdsa_get_address(pub_key, 36, HASHER_SHA2_RIPEMD, HASHER_GROESTLD_TRUNC,
- address, sizeof(address));
- ck_assert_str_eq(address, "FdTqTcamLueDb5J4wBi4vESXQkJrS54H6k");
}
END_TEST
@@ -11661,10 +11608,6 @@ Suite *test_suite(void) {
tcase_add_test(tc, test_blake2s);
suite_add_tcase(s, tc);
- tc = tcase_create("groestl");
- tcase_add_test(tc, test_groestl512);
- suite_add_tcase(s, tc);
-
tc = tcase_create("chacha_drbg");
tcase_add_test(tc, test_chacha_drbg);
suite_add_tcase(s, tc);
### legacy/firmware/.changelog.d/8293.removed
@@ -0,0 +1 @@
+Remove Groestlcoin support.
### legacy/firmware/Makefile
@@ -109,7 +109,6 @@ OBJS += ../vendor/trezor-crypto/sha3.o
OBJS += ../vendor/trezor-crypto/blake256.o
OBJS += ../vendor/trezor-crypto/blake2b.o
OBJS += ../vendor/trezor-crypto/blake2s.o
-OBJS += ../vendor/trezor-crypto/groestl.o
OBJS += ../vendor/trezor-crypto/hasher.o
OBJS += ../vendor/trezor-crypto/aes/aescrypt.o
### tests/device_tests/bitcoin/test_getaddress.py
@@ -99,38 +99,6 @@ def test_bch(session: Session):
)
-@pytest.mark.altcoin
-def test_grs(session: Session):
- assert (
- btc.get_address(session, "Groestlcoin", parse_path("m/44h/17h/0h/0/0"))
- == "Fj62rBJi8LvbmWu2jzkaUX1NFXLEqDLoZM"
- )
- assert (
- btc.get_address(session, "Groestlcoin", parse_path("m/44h/17h/0h/1/0"))
- == "FmRaqvVBRrAp2Umfqx9V1ectZy8gw54QDN"
- )
- assert (
- btc.get_address(session, "Groestlcoin", parse_path("m/44h/17h/0h/1/1"))
- == "Fmhtxeh7YdCBkyQF7AQG4QnY8y3rJg89di"
- )
-
-
-@pytest.mark.altcoin
-def test_tgrs(session: Session):
- assert (
- btc.get_address(session, "Groestlcoin Testnet", parse_path("m/44h/1h/0h/0/0"))
- == "mvbu1Gdy8SUjTenqerxUaZyYjmvedc787y"
- )
- assert (
- btc.get_address(session, "Groestlcoin Testnet", parse_path("m/44h/1h/0h/1/0"))
- == "mm6kLYbGEL1tGe4ZA8xacfgRPdW1LMq8cN"
- )
- assert (
- btc.get_address(session, "Groestlcoin Testnet", parse_path("m/44h/1h/0h/1/1"))
- == "mjXZwmEi1z1MzveZrKUAo4DBgbdq6ZhGD6"
- )
-
-
@pytest.mark.altcoin
def test_elements(session: Session):
assert (
@@ -187,15 +155,6 @@ def test_altcoin_address_mac(session: Session):
== "d5f54aea2200f50d1a0419d2faae62a82198f27df63ae4eac56d0e625de174f5"
)
- resp = btc.get_authenticated_address(
- session, "Groestlcoin", parse_path("m/44h/17h/0h/1/1")
- )
- assert resp.address == "Fmhtxeh7YdCBkyQF7AQG4QnY8y3rJg89di"
- assert (
- resp.mac.hex()
- == "c988b6f968a55b5be918d97f0f672acfd3bdbc91c148bc1a04a0ae4e8753464c"
- )
-
@pytest.mark.multisig
def test_multisig_pubkeys_order(session: Session):
### tests/device_tests/bitcoin/test_getaddress_segwit.py
@@ -78,50 +78,6 @@ def test_show_segwit_altcoin(session: Session):
if is_core(session):
IF = InputFlowConfirmAllWarnings(session)
client.set_input_flow(IF.get())
- assert (
- btc.get_address(
- session,
- "Groestlcoin Testnet",
- parse_path("m/49h/1h/0h/1/0"),
- True,
- None,
- script_type=messages.InputScriptType.SPENDP2SHWITNESS,
- )
- == "2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7"
- )
- assert (
- btc.get_address(
- session,
- "Groestlcoin Testnet",
- parse_path("m/49h/1h/0h/0/0"),
- True,
- None,
- script_type=messages.InputScriptType.SPENDP2SHWITNESS,
- )
- == "2N4Q5FhU2497BryFfUgbqkAJE87aKDv3V3e"
- )
- assert (
- btc.get_address(
- session,
- "Groestlcoin Testnet",
- parse_path("m/44h/1h/0h/0/0"),
- True,
- None,
- script_type=messages.InputScriptType.SPENDP2SHWITNESS,
- )
- == "2N6UeBoqYEEnybg4cReFYDammpsyDzLXvCT"
- )
- assert (
- btc.get_address(
- session,
- "Groestlcoin Testnet",
- parse_path("m/44h/1h/0h/0/0"),
- True,
- None,
- script_type=messages.InputScriptType.SPENDADDRESS,
- )
- == "mvbu1Gdy8SUjTenqerxUaZyYjmvedc787y"
- )
assert (
btc.get_address(
session,
### tests/device_tests/bitcoin/test_getaddress_segwit_native.py
@@ -78,54 +78,6 @@
"bc1pgypgja2hmcx2l6s2ssq75k6ev68ved6nujcspt47dgvkp8euc70s6uegk6",
id="Bitcoin-m/86h/0h/0h/1/0",
),
- pytest.param(
- "Groestlcoin Testnet",
- "m/84h/1h/0h/0/0",
- messages.InputScriptType.SPENDWITNESS,
- "tgrs1qkvwu9g3k2pdxewfqr7syz89r3gj557l3ued7ja",
- marks=pytest.mark.altcoin,
- id="Groestlcoin_Testnet-m/84h/1h/0h/0/0",
- ),
- pytest.param(
- "Groestlcoin Testnet",
- "m/84h/1h/0h/1/0",
- messages.InputScriptType.SPENDWITNESS,
- "tgrs1qejqxwzfld7zr6mf7ygqy5s5se5xq7vmt9lkd57",
- marks=pytest.mark.altcoin,
- id="Groestlcoin_Testnet-m/84h/1h/0h/1/0",
- ),
- pytest.param(
- "Groestlcoin",
- "m/84h/17h/0h/0/0",
- messages.InputScriptType.SPENDWITNESS,
- "grs1qw4teyraux2s77nhjdwh9ar8rl9dt7zww8r6lne",
- marks=pytest.mark.altcoin,
- id="Groestlcoin-m/84h/17h/0h/0/0",
- ),
- pytest.param(
- "Groestlcoin",
- "m/84h/17h/0h/1/0",
- messages.InputScriptType.SPENDWITNESS,
- "grs1qzfpwn55tvkxcw0xwfa0g8k2gtlzlgkcq3z000e",
- marks=pytest.mark.altcoin,
- id="Groestlcoin-m/84h/17h/0h/1/0",
- ),
- pytest.param(
- "Groestlcoin Testnet",
- "m/86h/1h/0h/0/0",
- messages.InputScriptType.SPENDTAPROOT,
- "tgrs1pswrqtykue8r89t9u4rprjs0gt4qzkdfuursfnvqaa3f2yql07zmq5v2q7z",
- marks=pytest.mark.altcoin,
- id="Groestlcoin_Testnet-m/86h/1h/0h/0/0",
- ),
- pytest.param(
- "Groestlcoin",
- "m/86h/17h/0h/0/0",
- messages.InputScriptType.SPENDTAPROOT,
- "grs1pnacleslusvh6gdjd3j2y5kv3drq09038sww2zx4za68jssndmu6qkm698g",
- marks=pytest.mark.altcoin,
- id="Groestlcoin-m/86h/17h/0h/0/0",
- ),
pytest.param(
"Elements",
"m/84h/1h/0h/0/0",
### tests/device_tests/bitcoin/test_grs.py
@@ -1,246 +0,0 @@
-# This file is part of the Trezor project.
-#
-# Copyright (C) SatoshiLabs and contributors
-#
-# This library is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the License along with this library.
-# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
-
-import pytest
-
-from trezorlib import btc, messages
-from trezorlib.debuglink import DebugSession as Session
-from trezorlib.tools import parse_path
-
-from ...tx_cache import TxCache
-
-B = messages.ButtonRequestType
-TX_API = TxCache("Groestlcoin")
-TX_API_TESTNET = TxCache("Groestlcoin Testnet")
-
-TXHASH_cb74c8 = bytes.fromhex(
- "cb74c8478c5814742c87cffdb4a21231869888f8042fb07a90e015a9db1f9d4a"
-)
-TXHASH_09a48b = bytes.fromhex(
- "09a48bce2f9d5c6e4f0cb9ea1b32d0891855e8acfe5334f9ebd72b9ad2de60cf"
-)
-TXHASH_4f2f85 = bytes.fromhex(
- "4f2f857f39ed1afe05542d058fb0be865a387446e32fc876d086203f483f61d1"
-)
-TXHASH_45aeb9 = bytes.fromhex(
- "45aeb9af884b4082104b0212c5f40ffca8f0127e627a05810b69f0bad777678c"
-)
-
-pytestmark = pytest.mark.altcoin
-
-
-def test_legacy(session: Session):
- inp1 = messages.TxInputType(
- # FXHDsC5ZqWQHkDmShzgRVZ1MatpWhwxTAA
- address_n=parse_path("m/44h/17h/0h/0/2"),
- amount=210_016,
- prev_hash=TXHASH_cb74c8,
- prev_index=0,
- )
- out1 = messages.TxOutputType(
- address="FtM4zAn9aVYgHgxmamWBgWPyZsb6RhvkA9",
- amount=210_016 - 192,
- script_type=messages.OutputScriptType.PAYTOADDRESS,
- )
- _, serialized_tx = btc.sign_tx(
- session, "Groestlcoin", [inp1], [out1], prev_txes=TX_API
- )
- assert (
- serialized_tx.hex()
- == "01000000014a9d1fdba915e0907ab02f04f88898863112a2b4fdcf872c7414588c47c874cb000000006a47304402201fb96d20d0778f54520ab59afe70d5fb20e500ecc9f02281cf57934e8029e8e10220383d5a3e80f2e1eb92765b6da0f23d454aecbd8236f083d483e9a7430236876101210331693756f749180aeed0a65a0fab0625a2250bd9abca502282a4cf0723152e67ffffffff01a0330300000000001976a914fe40329c95c5598ac60752a5310b320cb52d18e688ac00000000"
- )
-
-
-def test_legacy_change(session: Session):
- inp1 = messages.TxInputType(
- # FXHDsC5ZqWQHkDmShzgRVZ1MatpWhwxTAA
- address_n=parse_path("m/44h/17h/0h/0/2"),
- amount=210_016,
- prev_hash=TXHASH_cb74c8,
- prev_index=0,
- )
- out1 = messages.TxOutputType(
- address_n=parse_path("m/44h/17h/0h/0/3"), # FtM4zAn9aVYgHgxmamWBgWPyZsb6RhvkA9
- amount=210_016 - 192,
- script_type=messages.OutputScriptType.PAYTOADDRESS,
- )
- _, serialized_tx = btc.sign_tx(
- session, "Groestlcoin", [inp1], [out1], prev_txes=TX_API
- )
- assert (
- serialized_tx.hex()
- == "01000000014a9d1fdba915e0907ab02f04f88898863112a2b4fdcf872c7414588c47c874cb000000006a47304402201fb96d20d0778f54520ab59afe70d5fb20e500ecc9f02281cf57934e8029e8e10220383d5a3e80f2e1eb92765b6da0f23d454aecbd8236f083d483e9a7430236876101210331693756f749180aeed0a65a0fab0625a2250bd9abca502282a4cf0723152e67ffffffff01a0330300000000001976a914fe40329c95c5598ac60752a5310b320cb52d18e688ac00000000"
- )
-
-
-def test_send_segwit_p2sh(session: Session):
- inp1 = messages.TxInputType(
- # 2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7
- address_n=parse_path("m/49h/1h/0h/1/0"),
- amount=123_456_789,
- prev_hash=TXHASH_09a48b,
- prev_index=0,
- script_type=messages.InputScriptType.SPENDP2SHWITNESS,
- sequence=0xFFFFFFFE,
- )
- out1 = messages.TxOutputType(
- address="mvbu1Gdy8SUjTenqerxUaZyYjmvedc787y",
- amount=12_300_000,
- script_type=messages.OutputScriptType.PAYTOADDRESS,
- )
- out2 = messages.TxOutputType(
- address="2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7",
- amount=123_456_789 - 11_000 - 12_300_000,
- script_type=messages.OutputScriptType.PAYTOADDRESS,
- )
- _, serialized_tx = btc.sign_tx(
- session,
- "Groestlcoin Testnet",
- [inp1],
- [out1, out2],
- lock_time=650_756,
- prev_txes=TX_API_TESTNET,
- )
- assert (
- serialized_tx.hex()
- == "01000000000101cf60ded29a2bd7ebf93453feace8551889d0321beab90c4f6e5c9d2fce8ba4090000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5feffffff02e0aebb00000000001976a914a579388225827d9f2fe9014add644487808c695d88ac3df39f060000000017a91458b53ea7f832e8f096e896b8713a8c6df0e892ca8702483045022100b7ce2972bcbc3a661fe320ba901e680913b2753fcb47055c9c6ba632fc4acf81022001c3cfd6c2fe92eb60f5176ce0f43707114dd7223da19c56f2df89c13c2fef80012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b7904ee0900"
- )
-
-
-def test_send_segwit_p2sh_change(session: Session):
- inp1 = messages.TxInputType(
- # 2N1LGaGg836mqSQqiuUBLfcyGBhyZYBtBZ7
- address_n=parse_path("m/49h/1h/0h/1/0"),
- amount=123_456_789,
- prev_hash=TXHASH_09a48b,
- prev_index=0,
- script_type=messages.InputScriptType.SPENDP2SHWITNESS,
- sequence=0xFFFFFFFE,
- )
- out1 = messages.TxOutputType(
- address="mvbu1Gdy8SUjTenqerxUaZyYjmvedc787y",
- amount=12_300_000,
- script_type=messages.OutputScriptType.PAYTOADDRESS,
- )
- out2 = messages.TxOutputType(
- address_n=parse_path("m/49h/1h/0h/1/0"),
- script_type=messages.OutputScriptType.PAYTOP2SHWITNESS,
- amount=123_456_789 - 11_000 - 12_300_000,
- )
- _, serialized_tx = btc.sign_tx(
- session,
- "Groestlcoin Testnet",
- [inp1],
- [out1, out2],
- lock_time=650_756,
- prev_txes=TX_API_TESTNET,
- )
- assert (
- serialized_tx.hex()
- == "01000000000101cf60ded29a2bd7ebf93453feace8551889d0321beab90c4f6e5c9d2fce8ba4090000000017160014d16b8c0680c61fc6ed2e407455715055e41052f5feffffff02e0aebb00000000001976a914a579388225827d9f2fe9014add644487808c695d88ac3df39f060000000017a91458b53ea7f832e8f096e896b8713a8c6df0e892ca8702483045022100b7ce2972bcbc3a661fe320ba901e680913b2753fcb47055c9c6ba632fc4acf81022001c3cfd6c2fe92eb60f5176ce0f43707114dd7223da19c56f2df89c13c2fef80012103e7bfe10708f715e8538c92d46ca50db6f657bbc455b7494e6a0303ccdb868b7904ee0900"
- )
-
-
-def test_send_segwit_native(session: Session):
- inp1 = messages.TxInputType(
- address_n=parse_path("m/84h/1h/0h/0/0"),
- amount=12_300_000,
- prev_hash=TXHASH_4f2f85,
- prev_index=0,
- script_type=messages.InputScriptType.SPENDWITNESS,
- sequence=0xFFFFFFFE,
- )
- out1 = messages.TxOutputType(
- address="2N4Q5FhU2497BryFfUgbqkAJE87aKDv3V3e",
- amount=5_000_000,
- script_type=messages.OutputScriptType.PAYTOADDRESS,
- )
- out2 = messages.TxOutputType(
- address="tgrs1qejqxwzfld7zr6mf7ygqy5s5se5xq7vmt9lkd57",
- script_type=messages.OutputScriptType.PAYTOADDRESS,
- amount=12_300_000 - 11_000 - 5_000_000,
- )
- _, serialized_tx = btc.sign_tx(
- session,
- "Groestlcoin Testnet",
- [inp1],
- [out1, out2],
- lock_time=650_713,
- prev_txes=TX_API_TESTNET,
- )
- assert (
- serialized_tx.hex()
- == "01000000000101d1613f483f2086d076c82fe34674385a86beb08f052d5405fe1aed397f852f4f0000000000feffffff02404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987a8386f0000000000160014cc8067093f6f843d6d3e22004a4290cd0c0f336b02483045022100ea8780bc1e60e14e945a80654a41748bbf1aa7d6f2e40a88d91dfc2de1f34bd10220181a474a3420444bd188501d8d270736e1e9fe379da9970de992ff445b0972e3012103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f862d9ed0900"
- )
-
-
-def test_send_segwit_native_change(session: Session):
- inp1 = messages.TxInputType(
- address_n=parse_path("m/84h/1h/0h/0/0"),
- amount=12_300_000,
- prev_hash=TXHASH_4f2f85,
- prev_index=0,
- script_type=messages.InputScriptType.SPENDWITNESS,
- sequence=0xFFFFFFFE,
- )
- out1 = messages.TxOutputType(
- address="2N4Q5FhU2497BryFfUgbqkAJE87aKDv3V3e",
- amount=5_000_000,
- script_type=messages.OutputScriptType.PAYTOADDRESS,
- )
- out2 = messages.TxOutputType(
- address_n=parse_path("m/84h/1h/0h/1/0"),
- script_type=messages.OutputScriptType.PAYTOWITNESS,
- amount=12_300_000 - 11_000 - 5_000_000,
- )
- _, serialized_tx = btc.sign_tx(
- session,
- "Groestlcoin Testnet",
- [inp1],
- [out1, out2],
- lock_time=650_713,
- prev_txes=TX_API_TESTNET,
- )
- assert (
- serialized_tx.hex()
- == "01000000000101d1613f483f2086d076c82fe34674385a86beb08f052d5405fe1aed397f852f4f0000000000feffffff02404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987a8386f0000000000160014cc8067093f6f843d6d3e22004a4290cd0c0f336b02483045022100ea8780bc1e60e14e945a80654a41748bbf1aa7d6f2e40a88d91dfc2de1f34bd10220181a474a3420444bd188501d8d270736e1e9fe379da9970de992ff445b0972e3012103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f862d9ed0900"
- )
-
-
-def test_send_p2tr(session: Session):
- inp1 = messages.TxInputType(
- # tgrs1paxhjl357yzctuf3fe58fcdx6nul026hhh6kyldpfsf3tckj9a3wsvuqrgn
- address_n=parse_path("m/86h/1h/1h/0/0"),
- amount=4_450,
- prev_hash=TXHASH_45aeb9,
- prev_index=0,
- script_type=messages.InputScriptType.SPENDTAPROOT,
- )
- out1 = messages.TxOutputType(
- # 86'/1'/0'/0/0
- address="tgrs1pswrqtykue8r89t9u4rprjs0gt4qzkdfuursfnvqaa3f2yql07zmq5v2q7z",
- amount=4_300,
- script_type=messages.OutputScriptType.PAYTOADDRESS,
- )
- _, serialized_tx = btc.sign_tx(
- session, "Groestlcoin Testnet", [inp1], [out1], prev_txes=TX_API_TESTNET
- )
- # Transaction hex changed with fix #2085, all other details are the same as this tx:
- # https://blockbook-test.groestlcoin.org/tx/c66a79075044aaab3dba17daffb23f48addee87d7c87c7bc88e2997ce38a74ee
- assert (
- serialized_tx.hex()
- == "010000000001018c6777d7baf0690b81057a627e12f0a8fc0ff4c512024b1082404b88afb9ae450000000000ffffffff01cc1000000000000022512083860592dcc9c672acbca8c23941e85d402b353ce0e099b01dec52a203eff0b60140115c1d0d8b5a04a7329c05d3302bf42e4e32ba0b20c8bf9c155c3c6be1b9b01adb6fb71fe7c66c9ad74d5fd116077875682283f2e48362fe0eb6adb4ca36950700000000"
- )
### tests/device_tests/bitcoin/test_signmessage.py
@@ -191,39 +191,6 @@ def case(
"1fda7733e666a4ab8ba86f3cfc3728d318ecf824a3bf99597570297aa131607c10316959136b2c500b2b478a73c563ba314c0b7b2a22065b6d9596118f246d360e",
altcoin=True,
),
- case(
- "grs-p2pkh",
- "Groestlcoin",
- "m/44h/17h/0h/0/0",
- S.SPENDADDRESS,
- False,
- "Fj62rBJi8LvbmWu2jzkaUX1NFXLEqDLoZM",
- "test",
- "20d39869afe38fc631cf7983e64f9b65f5268e48c1f55ce857874d1bbf91b015322b7d312fb23dc8c816595bec2f8e82e7242dc6d658d1c45193babd37a6fe6133",
- altcoin=True,
- ),
- case(
- "grs-segwit-p2sh",
- "Groestlcoin",
- "m/49h/17h/0h/0/0",
- S.SPENDP2SHWITNESS,
- False,
- "31inaRqambLsd9D7Ke4USZmGEVd3PHkh7P",
- "test",
- "23f340fc9f9ea6469e13dbc743b70313e4d076bcd8ce867eddd71ec41160d02a4a462205d21ec6e49502bf3e2a8463d48e895ca56f6b385b15ec2cc7556292ecae",
- altcoin=True,
- ),
- case(
- "grs-segwit-native",
- "Groestlcoin",
- "m/84h/17h/0h/0/0",
- S.SPENDWITNESS,
- False,
- "grs1qw4teyraux2s77nhjdwh9ar8rl9dt7zww8r6lne",
- "test",
- "288253db4b4a1d5dac059296385310a353ef80992c4777a44133a335d12d3444da6c287d32aec4071ec49ae327e208f89ba0a115a129f106221c8dd5590fd3df13",
- altcoin=True,
- ),
case(
"decred",
"Decred",
### tests/device_tests/bitcoin/test_verifymessage.py
@@ -14,8 +14,6 @@
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
-import base64
-
import pytest
from trezorlib import btc
@@ -68,20 +66,6 @@ def test_message_testnet(session: Session):
assert ret is True
-@pytest.mark.altcoin
-def test_message_grs(session: Session):
- ret = btc.verify_message(
- session,
- "Groestlcoin",
- "Fj62rBJi8LvbmWu2jzkaUX1NFXLEqDLoZM",
- base64.b64decode(
- "INOYaa/jj8Yxz3mD5k+bZfUmjkjB9VzoV4dNG7+RsBUyK30xL7I9yMgWWVvsL46C5yQtxtZY0cRRk7q9N6b+YTM="
- ),
- "test",
- )
- assert ret is True
-
-
def test_message_verify(session: Session):
res = btc.verify_message(
session,
### tests/ui_tests/fixtures.json
[binary or diff unavailable]Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.