diff --git a/core/src/apps/monero/signing/offloading_keys.py b/core/src/apps/monero/signing/offloading_keys.py index df1baf949..9b7449844 100644 --- a/core/src/apps/monero/signing/offloading_keys.py +++ b/core/src/apps/monero/signing/offloading_keys.py @@ -122,7 +122,7 @@ def det_comm_masks(key_enc, idx: int) -> Sc25519: return crypto.decodeint(_build_key(key_enc, b"out-mask", idx)) -async def gen_hmac_vini( +def gen_hmac_vini( key, src_entr: MoneroTransactionSourceEntry, vini_bin: bytes, idx: int ) -> bytes: """ @@ -146,7 +146,7 @@ async def gen_hmac_vini( src_entr.real_out_additional_tx_keys[src_entr.real_output_in_tx_index] ] - await protobuf.dump_message(kwriter, src_entr) + protobuf.dump_message(kwriter, src_entr) src_entr.outputs = real_outputs src_entr.real_out_additional_tx_keys = real_additional kwriter.write(vini_bin) @@ -156,7 +156,7 @@ async def gen_hmac_vini( return hmac_vini -async def gen_hmac_vouti( +def gen_hmac_vouti( key, dst_entr: MoneroTransactionDestinationEntry, tx_out_bin: bytes, idx: int ) -> bytes: """ @@ -166,7 +166,7 @@ async def gen_hmac_vouti( from apps.monero.xmr.keccak_hasher import get_keccak_writer kwriter = get_keccak_writer() - await protobuf.dump_message(kwriter, dst_entr) + protobuf.dump_message(kwriter, dst_entr) kwriter.write(tx_out_bin) hmac_key_vouti = hmac_key_txout(key, idx) @@ -174,7 +174,7 @@ async def gen_hmac_vouti( return hmac_vouti -async def gen_hmac_tsxdest( +def gen_hmac_tsxdest( key, dst_entr: MoneroTransactionDestinationEntry, idx: int ) -> bytes: """ @@ -184,7 +184,7 @@ async def gen_hmac_tsxdest( from apps.monero.xmr.keccak_hasher import get_keccak_writer kwriter = get_keccak_writer() - await protobuf.dump_message(kwriter, dst_entr) + protobuf.dump_message(kwriter, dst_entr) hmac_key = hmac_key_txdst(key, idx) hmac_tsxdest = crypto.compute_hmac(hmac_key, kwriter.get_digest()) diff --git a/core/src/apps/monero/signing/step_01_init_transaction.py b/core/src/apps/monero/signing/step_01_init_transaction.py index 2943b7f61..a0b4dc169 100644 --- a/core/src/apps/monero/signing/step_01_init_transaction.py +++ b/core/src/apps/monero/signing/step_01_init_transaction.py @@ -81,7 +81,7 @@ async def init_transaction( # Extra processing, payment id _process_payment_id(state, tsx_data) - await _compute_sec_keys(state, tsx_data) + _compute_sec_keys(state, tsx_data) gc.collect() # Iterative tx_prefix_hash hash computation @@ -104,7 +104,7 @@ async def init_transaction( # and trezor validates it. hmacs = [] for idx in range(state.output_count): - c_hmac = await offloading_keys.gen_hmac_tsxdest( + c_hmac = offloading_keys.gen_hmac_tsxdest( state.key_hmac, tsx_data.outputs[idx], idx ) hmacs.append(c_hmac) @@ -268,7 +268,7 @@ def _check_change(state: State, outputs: List[MoneroTransactionDestinationEntry] raise signing.ChangeAddressError("Change address differs from ours") -async def _compute_sec_keys(state: State, tsx_data: MoneroTransactionData): +def _compute_sec_keys(state: State, tsx_data: MoneroTransactionData): """ Generate master key H( H(TsxData || tx_priv) || rand ) """ @@ -276,7 +276,7 @@ async def _compute_sec_keys(state: State, tsx_data: MoneroTransactionData): from apps.monero.xmr.keccak_hasher import get_keccak_writer writer = get_keccak_writer() - await protobuf.dump_message(writer, tsx_data) + protobuf.dump_message(writer, tsx_data) writer.write(crypto.encodeint(state.tx_priv)) master_key = crypto.keccak_2hash( diff --git a/core/src/apps/monero/signing/step_02_set_input.py b/core/src/apps/monero/signing/step_02_set_input.py index 3f55a08ce..0469d53c1 100644 --- a/core/src/apps/monero/signing/step_02_set_input.py +++ b/core/src/apps/monero/signing/step_02_set_input.py @@ -95,7 +95,7 @@ async def set_input( state.mem_trace(2, True) # HMAC(T_in,i || vin_i) - hmac_vini = await offloading_keys.gen_hmac_vini( + hmac_vini = offloading_keys.gen_hmac_vini( state.key_hmac, src_entr, vini_bin, state.current_input_index ) state.mem_trace(3, True) diff --git a/core/src/apps/monero/signing/step_04_input_vini.py b/core/src/apps/monero/signing/step_04_input_vini.py index c77ce0433..c775e8fbe 100644 --- a/core/src/apps/monero/signing/step_04_input_vini.py +++ b/core/src/apps/monero/signing/step_04_input_vini.py @@ -44,7 +44,7 @@ async def input_vini( state.current_input_index += 1 # HMAC(T_in,i || vin_i) - hmac_vini_comp = await offloading_keys.gen_hmac_vini( + hmac_vini_comp = offloading_keys.gen_hmac_vini( state.key_hmac, src_entr, vini_bin, diff --git a/core/src/apps/monero/signing/step_06_set_output.py b/core/src/apps/monero/signing/step_06_set_output.py index 2e1e00441..1638fc53d 100644 --- a/core/src/apps/monero/signing/step_06_set_output.py +++ b/core/src/apps/monero/signing/step_06_set_output.py @@ -79,7 +79,7 @@ async def set_output( return MoneroTransactionSetOutputAck() # Tx header prefix hashing, hmac dst_entr - tx_out_bin, hmac_vouti = await _set_out_tx_out(state, dst_entr, tx_out_key) + tx_out_bin, hmac_vouti = _set_out_tx_out(state, dst_entr, tx_out_key) state.mem_trace(11, True) out_pk_dest, out_pk_commitment, ecdh_info_bin = _get_ecdh_info_and_out_pk( @@ -157,7 +157,7 @@ async def _validate( if not state.is_processing_offloaded: # HMAC check of the destination - dst_entr_hmac_computed = await offloading_keys.gen_hmac_tsxdest( + dst_entr_hmac_computed = offloading_keys.gen_hmac_tsxdest( state.key_hmac, dst_entr, state.current_output_index ) @@ -204,7 +204,7 @@ def _compute_tx_keys( return tx_out_key, amount_key -async def _set_out_tx_out( +def _set_out_tx_out( state: State, dst_entr: MoneroTransactionDestinationEntry, tx_out_key: Ge25519 ) -> Tuple[bytes, bytes]: """ @@ -221,7 +221,7 @@ async def _set_out_tx_out( state.mem_trace(9, True) # Hmac dst_entr - hmac_vouti = await offloading_keys.gen_hmac_vouti( + hmac_vouti = offloading_keys.gen_hmac_vouti( state.key_hmac, dst_entr, tx_out_bin, state.current_output_index ) state.mem_trace(10, True) diff --git a/core/src/apps/monero/signing/step_09_sign_input.py b/core/src/apps/monero/signing/step_09_sign_input.py index 129ed84b7..d0b257ed0 100644 --- a/core/src/apps/monero/signing/step_09_sign_input.py +++ b/core/src/apps/monero/signing/step_09_sign_input.py @@ -77,7 +77,7 @@ async def sign_input( # Check input's HMAC from apps.monero.signing import offloading_keys - vini_hmac_comp = await offloading_keys.gen_hmac_vini( + vini_hmac_comp = offloading_keys.gen_hmac_vini( state.key_hmac, src_entr, vini_bin, input_position ) if not crypto.ct_equals(vini_hmac_comp, vini_hmac):